.struct EMD_HDR
ID .byte 3 ; Contains 0x65, 0x6d, 0x64 ("emd")
VERSION .byte 1 ; Interface version
+ LIBREF .addr ; Library reference
JUMPTAB .struct
- INSTALL .word ; INSTALL routine
- UNINSTALL .word ; UNINSTALL routine
- PAGECOUNT .word ; PAGECOUNT routine
- MAP .word ; MAP routine
- USE .word ; USE routine
- MAPCLEAN .word ; MAPCLEAN routine
- COPYFROM .word ; COPYFROM routine
- COPYTO .word ; COPYTO routine
+ INSTALL .addr ; INSTALL routine
+ UNINSTALL .addr ; UNINSTALL routine
+ PAGECOUNT .addr ; PAGECOUNT routine
+ MAP .addr ; MAP routine
+ USE .addr ; USE routine
+ MAPCLEAN .addr ; MAPCLEAN routine
+ COPYFROM .addr ; COPYFROM routine
+ COPYTO .addr ; COPYTO routine
.endstruct
.endstruct
;------------------------------------------------------------------------------
; The EMD API version, stored in EMD_HDR::VERSION
-EMD_API_VERSION = $00
+EMD_API_VERSION = $01
;------------------------------------------------------------------------------
; The asm equivalent to the C em_copy structure
.struct EM_COPY
- BUF .word ; Memory buffer to copy from or to
+ BUF .addr ; Memory buffer to copy from or to
OFFS .byte ; Offset into page
PAGE .word ; Starting page to copy from or to
COUNT .word ; Number of bytes to copy
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
+; Library reference
- .word INSTALL
- .word DEINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
; rts
; ------------------------------------------------------------------------
-; 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
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
+; Library reference
- .word INSTALL
- .word DEINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
rts
; ------------------------------------------------------------------------
-; 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
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
+; Library reference
- .word INSTALL
- .word DEINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
jmp vdcsetsrcaddr
; ------------------------------------------------------------------------
-; 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:
;on C128 restore font and clear the screen?
rts
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
; Common functions of the extended memory API.
;
- .import return0
+ .import return0, em_libref
.importzp ptr1
.include "em-kernel.inc"
dey
bpl @L0
+; Set the library reference
+
+ ldy #EMD_HDR::LIBREF
+ lda #<em_libref
+ sta (ptr1),y
+ iny
+ lda #>em_libref
+ sta (ptr1),y
+
; Copy the jump vectors
ldy #EMD_HDR::JUMPTAB
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
-; Jump table.
-
- .word INSTALL
- .word UNINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
+; Library reference
+
+ .addr $0000
+
+; Jump table
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr PAGECOUNT
+ .addr MAP
+ .addr USE
+ .addr COMMIT
+ .addr COPYFROM
+ .addr COPYTO
; ------------------------------------------------------------------------
; Constants
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit