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 $0000
27 emd_deinstall: jmp $0000
28 emd_pagecount: jmp $0000
30 emd_mapclean: jmp $0000
31 emd_copyfrom: jmp $0000
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
83 set: sta emd_vectors,x
87 ;----------------------------------------------------------------------------
88 ; void __fastcall__ em_deinstall (void);
89 ; /* Deinstall the driver before unloading it */
92 jsr emd_deinstall ; Call driver routine
94 ; Point all jump vectors to return0
97 @L1: inx ; Skip JMP opcode
102 cpx #(EMD_HDR_JUMPCOUNT*3)