2 ; Ullrich von Bassewitz, 2003-04-15
4 ; Common functions of the serial drivers
11 .include "ser-kernel.inc"
12 .include "ser-error.inc"
15 ;----------------------------------------------------------------------------
20 _ser_drv: .res 2 ; Pointer to driver
22 ; Jump table for the driver functions.
25 ser_install: jmp return0
26 ser_uninstall: jmp return0
27 ser_params: jmp return0
30 ser_pause: jmp return0
31 ser_unpause: jmp return0
32 ser_status: jmp return0
34 ; Driver header signature
36 ser_sig: .byte $73, $65, $72, $00 ; "ser", version
37 ser_sig_len = * - ser_sig
40 ;----------------------------------------------------------------------------
41 ; unsigned char __fastcall__ ser_install (void* driver);
42 ; /* Install the driver once it is loaded */
51 ; Check the driver signature
60 ; Copy the jump vectors
64 @L1: inx ; Skip the JMP opcode
65 jsr copy ; Copy one byte
66 jsr copy ; Copy one byte
67 cpx #(SER_HDR_JUMPCOUNT*3)
70 jmp ser_install ; Call driver install routine
72 ; Driver signature invalid
75 lda #SER_ERR_INV_DRIVER
79 ; Copy one byte from the jump vectors
87 ;----------------------------------------------------------------------------
88 ; unsigned char __fastcall__ ser_uninstall (void);
89 ; /* Uninstall the currently loaded driver and return an error code.
90 ; * Note: This call does not free allocated memory.
94 jsr ser_uninstall ; Call driver routine
96 ser_clear_ptr: ; External entry point
99 sta _ser_drv+1 ; Clear the driver pointer