2 ; Ullrich von Bassewitz, 2002-11-29
4 ; Common functions of the extended memory API.
7 .export _em_install, _em_deinstall
12 .include "em-kernel.inc"
13 .include "em-error.inc"
16 ;----------------------------------------------------------------------------
21 _em_drv: .res 2 ; Pointer to driver
23 ; Jump table for the driver functions.
26 emd_install: jmp return0
27 emd_deinstall: jmp return0
28 emd_pagecount: jmp return0
31 emd_commit: jmp return0
32 emd_copyfrom: jmp return0
33 emd_copyto: jmp return0
35 ; Driver header signature
37 emd_sig: .byte $65, $6d, $64, $00 ; "emd", version
38 emd_sig_len = * - emd_sig
41 ;----------------------------------------------------------------------------
42 ; unsigned char __fastcall__ em_install (void* driver);
43 ; /* Install the driver once it is loaded */
52 ; Check the driver signature
61 ; Copy the jump vectors
65 @L1: inx ; Skip the JMP opcode
66 jsr copy ; Copy one byte
67 jsr copy ; Copy one byte
68 cpx #(EMD_HDR_JUMPCOUNT*3)
71 jmp emd_install ; Call driver install routine
73 ; Driver signature invalid
76 lda #EM_ERR_INV_DRIVER
80 ; Copy one byte from the jump vectors
84 set: sta emd_vectors,x
88 ;----------------------------------------------------------------------------
89 ; void __fastcall__ em_deinstall (void);
90 ; /* Deinstall the driver before unloading it */
93 jsr emd_deinstall ; Call driver routine
95 ; Point all jump vectors to return0
98 @L1: inx ; Skip JMP opcode
103 cpx #(EMD_HDR_JUMPCOUNT*3)