;
-; Extended memory driver for the GEORAM cartridge
+; Extended memory driver for the GEORAM cartridge. Driver works without
+; problems when statically linked.
;
; Ullrich von Bassewitz, 2002-11-29
;
; Driver signature
.byte $65, $6d, $64 ; "emd"
- .byte $00 ; EM API version number
+ .byte EMD_API_VERSION ; EM API version number
; Jump table.
.word INSTALL
- .word DEINSTALL
+ .word UNINSTALL
.word PAGECOUNT
.word MAP
+ .word USE
.word COMMIT
.word COPYFROM
.word COPYTO
INSTALL:
lda #<EM_ERR_OK
ldx #>EM_ERR_OK
- rts
+; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
-; DEINSTALL routine. Is called before the driver is removed from memory.
+; UNINSTALL routine. Is called before the driver is removed from memory.
; Can do cleanup or whatever. Must not return anything.
;
-DEINSTALL:
+UNINSTALL:
rts
ldx pagecount+1
rts
+; ------------------------------------------------------------------------
+; USE: Tell the driver that the window is now associated with a given page.
+; The GeoRAM cartridge does not copy but actually map the window, so USE is
+; identical to MAP.
+
+USE = MAP
+
; ------------------------------------------------------------------------
; MAP: Map the page in a/x into memory and return a pointer to the page in
; a/x. The contents of the currently mapped page (if any) may be discarded
; Get the page number from the struct and adjust it so that it may be used
; with the hardware. That is: lower 6 bits in tmp1, high bits in tmp2.
- ldy #EM_COPY_PAGE+1
+ ldy #EM_COPY::PAGE+1
lda (ptr1),y
sta tmp2
dey
; Get the buffer pointer into ptr2
- ldy #EM_COPY_BUF
+ ldy #EM_COPY::BUF
lda (ptr1),y
sta ptr2
iny
; Get the count, calculate -(count-1) and store it into ptr3
- ldy #EM_COPY_COUNT
+ ldy #EM_COPY::COUNT
lda (ptr1),y
eor #$FF
sta ptr3
; Get the page offset into X and clear Y
- ldy #EM_COPY_OFFS
+ ldy #EM_COPY::OFFS
lda (ptr1),y
tax
ldy #$00