From 619b215260ccb2db384df6a6c4a6ccaace2a77cb Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sat, 1 Jun 2013 00:11:31 +0200
Subject: [PATCH] Added library reference em_libref to EMD interface.
Occasionally dynamically drivers suffer from not being to refer to
content in the C library. Therefore I added a mechanism to allow
a C library for a certian target to define a symbol that will be
handed over to dynamic drivers for that target. Then the drivers
can use their refernce to that symbol to access content in the C
library.
---
asminc/em-kernel.inc | 21 +++++++++++----------
libsrc/apple2/emd/a2.auxmem.s | 26 +++++++++++++++-----------
libsrc/apple2/libref.s | 8 ++++++++
libsrc/atari/emd/atr130.s | 26 +++++++++++++++-----------
libsrc/atari/libref.s | 8 ++++++++
libsrc/c128/emd/c128-georam.s | 24 ++++++++++++++----------
libsrc/c128/emd/c128-ram.s | 24 ++++++++++++++----------
libsrc/c128/emd/c128-ram2.s | 24 ++++++++++++++----------
libsrc/c128/emd/c128-ramcart.s | 24 ++++++++++++++----------
libsrc/c128/emd/c128-reu.s | 24 ++++++++++++++----------
libsrc/c128/emd/c128-vdc.s | 26 +++++++++++++++-----------
libsrc/c128/libref.s | 8 ++++++++
libsrc/c16/emd/c16-ram.s | 24 ++++++++++++++----------
libsrc/c16/libref.s | 8 ++++++++
libsrc/c64/emd/c64-c256k.s | 24 ++++++++++++++----------
libsrc/c64/emd/c64-dqbb.s | 24 ++++++++++++++----------
libsrc/c64/emd/c64-georam.s | 24 ++++++++++++++----------
libsrc/c64/emd/c64-isepic.s | 24 ++++++++++++++----------
libsrc/c64/emd/c64-ram.s | 24 ++++++++++++++----------
libsrc/c64/emd/c64-ramcart.s | 24 ++++++++++++++----------
libsrc/c64/emd/c64-reu.s | 24 ++++++++++++++----------
libsrc/c64/emd/c64-vdc.s | 24 ++++++++++++++----------
libsrc/c64/emd/dtv-himem.s | 24 ++++++++++++++----------
libsrc/c64/libref.s | 8 ++++++++
libsrc/cbm510/emd/cbm510-ram.s | 24 ++++++++++++++----------
libsrc/cbm510/libref.s | 8 ++++++++
libsrc/cbm610/emd/cbm610-ram.s | 24 ++++++++++++++----------
libsrc/cbm610/libref.s | 8 ++++++++
libsrc/em/em-kernel.s | 11 ++++++++++-
libsrc/geos-cbm/emd/geos-vdc.s | 24 ++++++++++++++----------
libsrc/geos-cbm/system/libref.s | 8 ++++++++
31 files changed, 382 insertions(+), 224 deletions(-)
create mode 100644 libsrc/apple2/libref.s
create mode 100644 libsrc/atari/libref.s
create mode 100644 libsrc/c128/libref.s
create mode 100644 libsrc/c16/libref.s
create mode 100644 libsrc/c64/libref.s
create mode 100644 libsrc/cbm510/libref.s
create mode 100644 libsrc/cbm610/libref.s
create mode 100644 libsrc/geos-cbm/system/libref.s
diff --git a/asminc/em-kernel.inc b/asminc/em-kernel.inc
index 1df969225..313bfc0bf 100644
--- a/asminc/em-kernel.inc
+++ b/asminc/em-kernel.inc
@@ -39,28 +39,29 @@
.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
diff --git a/libsrc/apple2/emd/a2.auxmem.s b/libsrc/apple2/emd/a2.auxmem.s
index ecf78fc37..0ceb083b9 100644
--- a/libsrc/apple2/emd/a2.auxmem.s
+++ b/libsrc/apple2/emd/a2.auxmem.s
@@ -20,16 +20,20 @@
.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
@@ -69,11 +73,11 @@ INSTALL:
; 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
diff --git a/libsrc/apple2/libref.s b/libsrc/apple2/libref.s
new file mode 100644
index 000000000..507c9887b
--- /dev/null
+++ b/libsrc/apple2/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
diff --git a/libsrc/atari/emd/atr130.s b/libsrc/atari/emd/atr130.s
index b3c31a205..7d663e446 100644
--- a/libsrc/atari/emd/atr130.s
+++ b/libsrc/atari/emd/atr130.s
@@ -43,16 +43,20 @@
.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
@@ -191,11 +195,11 @@ INSTALL:
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
diff --git a/libsrc/atari/libref.s b/libsrc/atari/libref.s
new file mode 100644
index 000000000..507c9887b
--- /dev/null
+++ b/libsrc/atari/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
diff --git a/libsrc/c128/emd/c128-georam.s b/libsrc/c128/emd/c128-georam.s
index 0c106f406..f2de80916 100644
--- a/libsrc/c128/emd/c128-georam.s
+++ b/libsrc/c128/emd/c128-georam.s
@@ -27,16 +27,20 @@
.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
diff --git a/libsrc/c128/emd/c128-ram.s b/libsrc/c128/emd/c128-ram.s
index 02979a6dc..f382e9b87 100644
--- a/libsrc/c128/emd/c128-ram.s
+++ b/libsrc/c128/emd/c128-ram.s
@@ -25,16 +25,20 @@
.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
diff --git a/libsrc/c128/emd/c128-ram2.s b/libsrc/c128/emd/c128-ram2.s
index 9fb8a2836..8a0ba0fac 100644
--- a/libsrc/c128/emd/c128-ram2.s
+++ b/libsrc/c128/emd/c128-ram2.s
@@ -28,16 +28,20 @@
.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
diff --git a/libsrc/c128/emd/c128-ramcart.s b/libsrc/c128/emd/c128-ramcart.s
index 0bf1072de..6d6a91bbe 100644
--- a/libsrc/c128/emd/c128-ramcart.s
+++ b/libsrc/c128/emd/c128-ramcart.s
@@ -26,16 +26,20 @@
.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
diff --git a/libsrc/c128/emd/c128-reu.s b/libsrc/c128/emd/c128-reu.s
index b1a979cb5..094ad1d39 100644
--- a/libsrc/c128/emd/c128-reu.s
+++ b/libsrc/c128/emd/c128-reu.s
@@ -25,16 +25,20 @@
.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
diff --git a/libsrc/c128/emd/c128-vdc.s b/libsrc/c128/emd/c128-vdc.s
index 29dbb4569..dd28ae774 100644
--- a/libsrc/c128/emd/c128-vdc.s
+++ b/libsrc/c128/emd/c128-vdc.s
@@ -23,16 +23,20 @@
.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
@@ -141,11 +145,11 @@ settestadr2:
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
diff --git a/libsrc/c128/libref.s b/libsrc/c128/libref.s
new file mode 100644
index 000000000..507c9887b
--- /dev/null
+++ b/libsrc/c128/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
diff --git a/libsrc/c16/emd/c16-ram.s b/libsrc/c16/emd/c16-ram.s
index 98ba5e909..1d7d41ae0 100644
--- a/libsrc/c16/emd/c16-ram.s
+++ b/libsrc/c16/emd/c16-ram.s
@@ -24,16 +24,20 @@
.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
diff --git a/libsrc/c16/libref.s b/libsrc/c16/libref.s
new file mode 100644
index 000000000..507c9887b
--- /dev/null
+++ b/libsrc/c16/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
diff --git a/libsrc/c64/emd/c64-c256k.s b/libsrc/c64/emd/c64-c256k.s
index f559bf7f3..8508b8b56 100644
--- a/libsrc/c64/emd/c64-c256k.s
+++ b/libsrc/c64/emd/c64-c256k.s
@@ -22,16 +22,20 @@
.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
diff --git a/libsrc/c64/emd/c64-dqbb.s b/libsrc/c64/emd/c64-dqbb.s
index fcfeaeb9b..c06a83daf 100644
--- a/libsrc/c64/emd/c64-dqbb.s
+++ b/libsrc/c64/emd/c64-dqbb.s
@@ -22,16 +22,20 @@
.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
diff --git a/libsrc/c64/emd/c64-georam.s b/libsrc/c64/emd/c64-georam.s
index 0c106f406..f2de80916 100644
--- a/libsrc/c64/emd/c64-georam.s
+++ b/libsrc/c64/emd/c64-georam.s
@@ -27,16 +27,20 @@
.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
diff --git a/libsrc/c64/emd/c64-isepic.s b/libsrc/c64/emd/c64-isepic.s
index a2a2e4783..67a33ecf6 100644
--- a/libsrc/c64/emd/c64-isepic.s
+++ b/libsrc/c64/emd/c64-isepic.s
@@ -22,16 +22,20 @@
.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
diff --git a/libsrc/c64/emd/c64-ram.s b/libsrc/c64/emd/c64-ram.s
index 1c2961591..b73ccc547 100644
--- a/libsrc/c64/emd/c64-ram.s
+++ b/libsrc/c64/emd/c64-ram.s
@@ -24,16 +24,20 @@
.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
diff --git a/libsrc/c64/emd/c64-ramcart.s b/libsrc/c64/emd/c64-ramcart.s
index b4192e74b..d424024c7 100644
--- a/libsrc/c64/emd/c64-ramcart.s
+++ b/libsrc/c64/emd/c64-ramcart.s
@@ -26,16 +26,20 @@
.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
diff --git a/libsrc/c64/emd/c64-reu.s b/libsrc/c64/emd/c64-reu.s
index 133e0af03..c397a739d 100644
--- a/libsrc/c64/emd/c64-reu.s
+++ b/libsrc/c64/emd/c64-reu.s
@@ -24,16 +24,20 @@
.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
diff --git a/libsrc/c64/emd/c64-vdc.s b/libsrc/c64/emd/c64-vdc.s
index a69c68f15..cd09d33f4 100644
--- a/libsrc/c64/emd/c64-vdc.s
+++ b/libsrc/c64/emd/c64-vdc.s
@@ -27,16 +27,20 @@
.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
diff --git a/libsrc/c64/emd/dtv-himem.s b/libsrc/c64/emd/dtv-himem.s
index 555b0b95a..62bc2007b 100644
--- a/libsrc/c64/emd/dtv-himem.s
+++ b/libsrc/c64/emd/dtv-himem.s
@@ -26,16 +26,20 @@
.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
diff --git a/libsrc/c64/libref.s b/libsrc/c64/libref.s
new file mode 100644
index 000000000..507c9887b
--- /dev/null
+++ b/libsrc/c64/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
diff --git a/libsrc/cbm510/emd/cbm510-ram.s b/libsrc/cbm510/emd/cbm510-ram.s
index 65ebbddf8..df7e17dc7 100644
--- a/libsrc/cbm510/emd/cbm510-ram.s
+++ b/libsrc/cbm510/emd/cbm510-ram.s
@@ -24,16 +24,20 @@
.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
diff --git a/libsrc/cbm510/libref.s b/libsrc/cbm510/libref.s
new file mode 100644
index 000000000..507c9887b
--- /dev/null
+++ b/libsrc/cbm510/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
diff --git a/libsrc/cbm610/emd/cbm610-ram.s b/libsrc/cbm610/emd/cbm610-ram.s
index 8f71e405c..6131d0093 100644
--- a/libsrc/cbm610/emd/cbm610-ram.s
+++ b/libsrc/cbm610/emd/cbm610-ram.s
@@ -24,16 +24,20 @@
.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
diff --git a/libsrc/cbm610/libref.s b/libsrc/cbm610/libref.s
new file mode 100644
index 000000000..507c9887b
--- /dev/null
+++ b/libsrc/cbm610/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
diff --git a/libsrc/em/em-kernel.s b/libsrc/em/em-kernel.s
index 9c1342964..21203d250 100644
--- a/libsrc/em/em-kernel.s
+++ b/libsrc/em/em-kernel.s
@@ -4,7 +4,7 @@
; Common functions of the extended memory API.
;
- .import return0
+ .import return0, em_libref
.importzp ptr1
.include "em-kernel.inc"
@@ -55,6 +55,15 @@ _em_install:
dey
bpl @L0
+; Set the library reference
+
+ ldy #EMD_HDR::LIBREF
+ lda #em_libref
+ sta (ptr1),y
+
; Copy the jump vectors
ldy #EMD_HDR::JUMPTAB
diff --git a/libsrc/geos-cbm/emd/geos-vdc.s b/libsrc/geos-cbm/emd/geos-vdc.s
index 7064a78fc..60a805c4e 100644
--- a/libsrc/geos-cbm/emd/geos-vdc.s
+++ b/libsrc/geos-cbm/emd/geos-vdc.s
@@ -21,16 +21,20 @@
.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
diff --git a/libsrc/geos-cbm/system/libref.s b/libsrc/geos-cbm/system/libref.s
new file mode 100644
index 000000000..507c9887b
--- /dev/null
+++ b/libsrc/geos-cbm/system/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export em_libref
+ .import _exit
+
+em_libref := _exit
--
2.39.5