2 ; Ullrich von Bassewitz, 2002-11-29
4 ; Common functions of the extended memory API.
11 .include "em-kernel.inc"
12 .include "em-error.inc"
15 ;----------------------------------------------------------------------------
20 _em_drv: .res 2 ; Pointer to driver
22 ; Jump table for the driver functions.
25 emd_install: jmp return0
26 emd_uninstall: jmp return0
27 emd_pagecount: jmp return0
30 emd_commit: jmp return0
31 emd_copyfrom: jmp return0
32 emd_copyto: jmp return0
34 ; Driver header signature
36 emd_sig: .byte $65, $6d, $64, $00 ; "emd", version
37 emd_sig_len = * - emd_sig
40 ;----------------------------------------------------------------------------
41 ; unsigned char __fastcall__ em_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 #(EMD_HDR_JUMPCOUNT*3)
70 jmp emd_install ; Call driver install routine
72 ; Driver signature invalid
75 lda #EM_ERR_INV_DRIVER
79 ; Copy one byte from the jump vectors
87 ;----------------------------------------------------------------------------
88 ; unsigned char __fastcall__ em_uninstall (void);
89 ; /* Uninstall the currently loaded driver and return an error code.
90 ; * Note: This call does not free allocated memory.
94 jsr emd_uninstall ; Call driver routine
96 em_clear_ptr: ; External entry point
99 sta _em_drv+1 ; Clear the driver pointer