From 7024e2789d3b673578e67bbbd731a8925eb77376 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Fri, 31 May 2013 21:30:14 +0200
Subject: [PATCH 1/6] Explicitly set search paths for libraries build.
The libraries build is prepared to work with binaries not part of the current
working tree. But in this case the default search path surely points to some
other working tree. Even the binaries in this working tree might have been
compiled with non-standard builtin search paths.
Anyway when building the libraries we want always to use the headers from
the current working tree. Therefore we want to set them explicitly. Instead
of setting all in all five paths on the command lines of ca65, cc65 and ld65 I
opted to just set the single environment variable.
---
libsrc/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libsrc/Makefile b/libsrc/Makefile
index 5cdc1f659..4204f00bb 100644
--- a/libsrc/Makefile
+++ b/libsrc/Makefile
@@ -206,6 +206,8 @@ CC := $(if $(wildcard ../bin/cc65*),../bin/cc65,cc65)
CO := $(if $(wildcard ../bin/co65*),../bin/co65,co65)
LD := $(if $(wildcard ../bin/ld65*),../bin/ld65,ld65)
+export CC65_HOME := $(abspath ..)
+
##########
define ASSEMBLE_recipe
From 619b215260ccb2db384df6a6c4a6ccaace2a77cb Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sat, 1 Jun 2013 00:11:31 +0200
Subject: [PATCH 2/6] 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 | 22 +++++++++++++---------
libsrc/c128/emd/c128-ram.s | 22 +++++++++++++---------
libsrc/c128/emd/c128-ram2.s | 22 +++++++++++++---------
libsrc/c128/emd/c128-ramcart.s | 22 +++++++++++++---------
libsrc/c128/emd/c128-reu.s | 22 +++++++++++++---------
libsrc/c128/emd/c128-vdc.s | 26 +++++++++++++++-----------
libsrc/c128/libref.s | 8 ++++++++
libsrc/c16/emd/c16-ram.s | 22 +++++++++++++---------
libsrc/c16/libref.s | 8 ++++++++
libsrc/c64/emd/c64-c256k.s | 22 +++++++++++++---------
libsrc/c64/emd/c64-dqbb.s | 22 +++++++++++++---------
libsrc/c64/emd/c64-georam.s | 22 +++++++++++++---------
libsrc/c64/emd/c64-isepic.s | 22 +++++++++++++---------
libsrc/c64/emd/c64-ram.s | 22 +++++++++++++---------
libsrc/c64/emd/c64-ramcart.s | 22 +++++++++++++---------
libsrc/c64/emd/c64-reu.s | 22 +++++++++++++---------
libsrc/c64/emd/c64-vdc.s | 22 +++++++++++++---------
libsrc/c64/emd/dtv-himem.s | 22 +++++++++++++---------
libsrc/c64/libref.s | 8 ++++++++
libsrc/cbm510/emd/cbm510-ram.s | 22 +++++++++++++---------
libsrc/cbm510/libref.s | 8 ++++++++
libsrc/cbm610/emd/cbm610-ram.s | 22 +++++++++++++---------
libsrc/cbm610/libref.s | 8 ++++++++
libsrc/em/em-kernel.s | 11 ++++++++++-
libsrc/geos-cbm/emd/geos-vdc.s | 22 +++++++++++++---------
libsrc/geos-cbm/system/libref.s | 8 ++++++++
31 files changed, 364 insertions(+), 206 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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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.
+; Library reference
- .word INSTALL
- .word UNINSTALL
- .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
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
From 23650cb9461c09718b9aae33520d3ca6f9c40dda Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sat, 1 Jun 2013 00:36:08 +0200
Subject: [PATCH 3/6] Added library reference joy_libref to JOY interface.
---
asminc/joy-kernel.inc | 14 +++++++-------
libsrc/apple2/joy/a2.stdjoy.s | 4 ++++
libsrc/apple2/libref.s | 3 ++-
libsrc/atari/joy/atrmj8.s | 4 ++++
libsrc/atari/joy/atrstd.s | 4 ++++
libsrc/atari/libref.s | 3 ++-
libsrc/atmos/joy/atmos-pase.s | 4 ++++
libsrc/atmos/libref.s | 8 ++++++++
libsrc/c128/joy/c128-ptvjoy.s | 4 ++++
libsrc/c128/joy/c128-stdjoy.s | 4 ++++
libsrc/c128/libref.s | 3 ++-
libsrc/c16/libref.s | 3 ++-
libsrc/c64/joy/c64-hitjoy.s | 4 ++++
libsrc/c64/joy/c64-numpad.s | 4 ++++
libsrc/c64/joy/c64-ptvjoy.s | 4 ++++
libsrc/c64/joy/c64-stdjoy.s | 4 ++++
libsrc/c64/libref.s | 3 ++-
libsrc/cbm510/joy/cbm510-std.s | 4 ++++
libsrc/cbm510/libref.s | 3 ++-
libsrc/geos-cbm/joy/geos-stdjoy.s | 4 ++++
libsrc/geos-cbm/system/libref.s | 3 ++-
libsrc/joystick/joy-kernel.s | 10 ++++++++++
libsrc/lynx/joy/lynx-stdjoy.s | 4 ++++
libsrc/lynx/libref.s | 8 ++++++++
libsrc/nes/joy/nes-stdjoy.s | 4 ++++
libsrc/nes/libref.s | 8 ++++++++
libsrc/pet/joy/pet-ptvjoy.s | 4 ++++
libsrc/pet/joy/pet-stdjoy.s | 4 ++++
libsrc/pet/libref.s | 8 ++++++++
libsrc/plus4/joy/plus4-stdjoy.s | 4 ++++
libsrc/plus4/libref.s | 8 ++++++++
libsrc/vic20/joy/vic20-ptvjoy.s | 4 ++++
libsrc/vic20/joy/vic20-stdjoy.s | 4 ++++
libsrc/vic20/libref.s | 8 ++++++++
34 files changed, 155 insertions(+), 14 deletions(-)
create mode 100644 libsrc/atmos/libref.s
create mode 100644 libsrc/lynx/libref.s
create mode 100644 libsrc/nes/libref.s
create mode 100644 libsrc/pet/libref.s
create mode 100644 libsrc/plus4/libref.s
create mode 100644 libsrc/vic20/libref.s
diff --git a/asminc/joy-kernel.inc b/asminc/joy-kernel.inc
index 6c360dd43..da22662b5 100644
--- a/asminc/joy-kernel.inc
+++ b/asminc/joy-kernel.inc
@@ -42,20 +42,21 @@
.struct JOY_HDR
ID .byte 3 ; $6A, $6F, $79 ("joy")
VERSION .byte 1 ; Interface version
+ LIBREF .addr ; Library reference
MASKS .byte 8 ; Joystick state mask array
JUMPTAB .struct
- INSTALL .word ; INSTALL routine
- UNINSTALL .word ; UNINSTALL routine
- COUNT .word ; COUNT routine
- READ .word ; READ routine
- IRQ .word ; IRQ routine
+ INSTALL .addr ; INSTALL routine
+ UNINSTALL .addr ; UNINSTALL routine
+ COUNT .addr ; COUNT routine
+ READ .addr ; READ routine
+ IRQ .addr ; IRQ routine
.endstruct
.endstruct
;------------------------------------------------------------------------------
; The JOY API version, stored in JOY_HDR::VERSION
-JOY_API_VERSION = $01
+JOY_API_VERSION = $02
;------------------------------------------------------------------------------
; Variables
@@ -82,4 +83,3 @@ JOY_API_VERSION = $01
.global _joy_read
.global _joy_clear_ptr
-
diff --git a/libsrc/apple2/joy/a2.stdjoy.s b/libsrc/apple2/joy/a2.stdjoy.s
index eecdd6a8a..043b7814e 100644
--- a/libsrc/apple2/joy/a2.stdjoy.s
+++ b/libsrc/apple2/joy/a2.stdjoy.s
@@ -36,6 +36,10 @@ PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $10
diff --git a/libsrc/apple2/libref.s b/libsrc/apple2/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/apple2/libref.s
+++ b/libsrc/apple2/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
diff --git a/libsrc/atari/joy/atrmj8.s b/libsrc/atari/joy/atrmj8.s
index 777a52615..04840fc99 100644
--- a/libsrc/atari/joy/atrmj8.s
+++ b/libsrc/atari/joy/atrmj8.s
@@ -26,6 +26,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $02 ; JOY_UP
diff --git a/libsrc/atari/joy/atrstd.s b/libsrc/atari/joy/atrstd.s
index caca34cc5..34034b554 100644
--- a/libsrc/atari/joy/atrstd.s
+++ b/libsrc/atari/joy/atrstd.s
@@ -25,6 +25,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/atari/libref.s b/libsrc/atari/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/atari/libref.s
+++ b/libsrc/atari/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
diff --git a/libsrc/atmos/joy/atmos-pase.s b/libsrc/atmos/joy/atmos-pase.s
index 81dba394a..c505a1b0f 100644
--- a/libsrc/atmos/joy/atmos-pase.s
+++ b/libsrc/atmos/joy/atmos-pase.s
@@ -21,6 +21,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $10 ; JOY_UP
diff --git a/libsrc/atmos/libref.s b/libsrc/atmos/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/atmos/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit
diff --git a/libsrc/c128/joy/c128-ptvjoy.s b/libsrc/c128/joy/c128-ptvjoy.s
index 5763fbe2d..d128b0ee0 100644
--- a/libsrc/c128/joy/c128-ptvjoy.s
+++ b/libsrc/c128/joy/c128-ptvjoy.s
@@ -24,6 +24,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/c128/joy/c128-stdjoy.s b/libsrc/c128/joy/c128-stdjoy.s
index f86853a81..860dab1ae 100644
--- a/libsrc/c128/joy/c128-stdjoy.s
+++ b/libsrc/c128/joy/c128-stdjoy.s
@@ -25,6 +25,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/c128/libref.s b/libsrc/c128/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/c128/libref.s
+++ b/libsrc/c128/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
diff --git a/libsrc/c16/libref.s b/libsrc/c16/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/c16/libref.s
+++ b/libsrc/c16/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
diff --git a/libsrc/c64/joy/c64-hitjoy.s b/libsrc/c64/joy/c64-hitjoy.s
index 637244b87..28495ee11 100644
--- a/libsrc/c64/joy/c64-hitjoy.s
+++ b/libsrc/c64/joy/c64-hitjoy.s
@@ -23,6 +23,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/c64/joy/c64-numpad.s b/libsrc/c64/joy/c64-numpad.s
index 28fd7e2b0..6eeebcc74 100644
--- a/libsrc/c64/joy/c64-numpad.s
+++ b/libsrc/c64/joy/c64-numpad.s
@@ -25,6 +25,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $02 ; JOY_UP "8"
diff --git a/libsrc/c64/joy/c64-ptvjoy.s b/libsrc/c64/joy/c64-ptvjoy.s
index 0b0e80e62..bb1ba0982 100644
--- a/libsrc/c64/joy/c64-ptvjoy.s
+++ b/libsrc/c64/joy/c64-ptvjoy.s
@@ -23,6 +23,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/c64/joy/c64-stdjoy.s b/libsrc/c64/joy/c64-stdjoy.s
index dc9434f4c..18722032a 100644
--- a/libsrc/c64/joy/c64-stdjoy.s
+++ b/libsrc/c64/joy/c64-stdjoy.s
@@ -24,6 +24,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/c64/libref.s b/libsrc/c64/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/c64/libref.s
+++ b/libsrc/c64/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
diff --git a/libsrc/cbm510/joy/cbm510-std.s b/libsrc/cbm510/joy/cbm510-std.s
index 8a24dcbbb..1d8b242a6 100644
--- a/libsrc/cbm510/joy/cbm510-std.s
+++ b/libsrc/cbm510/joy/cbm510-std.s
@@ -25,6 +25,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/cbm510/libref.s b/libsrc/cbm510/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/cbm510/libref.s
+++ b/libsrc/cbm510/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
diff --git a/libsrc/geos-cbm/joy/geos-stdjoy.s b/libsrc/geos-cbm/joy/geos-stdjoy.s
index 7cfd0ad08..9fb5461bb 100644
--- a/libsrc/geos-cbm/joy/geos-stdjoy.s
+++ b/libsrc/geos-cbm/joy/geos-stdjoy.s
@@ -22,6 +22,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/geos-cbm/system/libref.s b/libsrc/geos-cbm/system/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/geos-cbm/system/libref.s
+++ b/libsrc/geos-cbm/system/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
diff --git a/libsrc/joystick/joy-kernel.s b/libsrc/joystick/joy-kernel.s
index 71f94133a..d21727089 100644
--- a/libsrc/joystick/joy-kernel.s
+++ b/libsrc/joystick/joy-kernel.s
@@ -4,6 +4,7 @@
; Common functions of the joystick API.
;
+ .import joy_libref
.importzp ptr1
.interruptor joy_irq ; Export as IRQ handler
@@ -55,6 +56,15 @@ _joy_install:
dey
bpl @L0
+; Set the library reference
+
+ ldy #JOY_HDR::LIBREF
+ lda #joy_libref
+ sta (ptr1),y
+
; Copy the mask array
ldy #JOY_HDR::MASKS + .sizeof(JOY_HDR::MASKS) - 1
diff --git a/libsrc/lynx/joy/lynx-stdjoy.s b/libsrc/lynx/joy/lynx-stdjoy.s
index 9c5165a77..da7b4612c 100644
--- a/libsrc/lynx/joy/lynx-stdjoy.s
+++ b/libsrc/lynx/joy/lynx-stdjoy.s
@@ -26,6 +26,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
joy_mask:
diff --git a/libsrc/lynx/libref.s b/libsrc/lynx/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/lynx/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit
diff --git a/libsrc/nes/joy/nes-stdjoy.s b/libsrc/nes/joy/nes-stdjoy.s
index 76ca96005..1ff8395c9 100644
--- a/libsrc/nes/joy/nes-stdjoy.s
+++ b/libsrc/nes/joy/nes-stdjoy.s
@@ -23,6 +23,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $10 ; JOY_UP
diff --git a/libsrc/nes/libref.s b/libsrc/nes/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/nes/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit
diff --git a/libsrc/pet/joy/pet-ptvjoy.s b/libsrc/pet/joy/pet-ptvjoy.s
index 997352f06..19c2ca876 100644
--- a/libsrc/pet/joy/pet-ptvjoy.s
+++ b/libsrc/pet/joy/pet-ptvjoy.s
@@ -24,6 +24,10 @@ VIA_DDRA := $E843 ; Data direction register A
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/pet/joy/pet-stdjoy.s b/libsrc/pet/joy/pet-stdjoy.s
index 155dbbdf7..3377c8f81 100644
--- a/libsrc/pet/joy/pet-stdjoy.s
+++ b/libsrc/pet/joy/pet-stdjoy.s
@@ -21,6 +21,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/pet/libref.s b/libsrc/pet/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/pet/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit
diff --git a/libsrc/plus4/joy/plus4-stdjoy.s b/libsrc/plus4/joy/plus4-stdjoy.s
index 74dbc52e4..f67487781 100644
--- a/libsrc/plus4/joy/plus4-stdjoy.s
+++ b/libsrc/plus4/joy/plus4-stdjoy.s
@@ -24,6 +24,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/plus4/libref.s b/libsrc/plus4/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/plus4/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit
diff --git a/libsrc/vic20/joy/vic20-ptvjoy.s b/libsrc/vic20/joy/vic20-ptvjoy.s
index fabb802f6..533726c7b 100644
--- a/libsrc/vic20/joy/vic20-ptvjoy.s
+++ b/libsrc/vic20/joy/vic20-ptvjoy.s
@@ -23,6 +23,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
diff --git a/libsrc/vic20/joy/vic20-stdjoy.s b/libsrc/vic20/joy/vic20-stdjoy.s
index e49cd38f4..722aa8ea5 100644
--- a/libsrc/vic20/joy/vic20-stdjoy.s
+++ b/libsrc/vic20/joy/vic20-stdjoy.s
@@ -25,6 +25,10 @@
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $02 ; JOY_UP
diff --git a/libsrc/vic20/libref.s b/libsrc/vic20/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/vic20/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit
From 744abda24f31cfb27529676e01d55141f8346f7e Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sat, 1 Jun 2013 00:53:17 +0200
Subject: [PATCH 4/6] Added library reference mouse_libref to MOU interface.
---
asminc/mouse-kernel.inc | 3 ++-
libsrc/apple2/libref.s | 3 ++-
libsrc/apple2/mou/a2.stdmou.s | 5 ++++-
libsrc/c128/libref.s | 3 ++-
libsrc/c128/mou/c128-1351.s | 6 +++++-
libsrc/c128/mou/c128-joy.s | 6 +++++-
libsrc/c128/mou/c128-pot.s | 6 +++++-
libsrc/c64/libref.s | 3 ++-
libsrc/c64/mou/c64-1351.s | 6 +++++-
libsrc/c64/mou/c64-joy.s | 6 +++++-
libsrc/c64/mou/c64-pot.s | 6 +++++-
libsrc/mouse/mouse-kernel.s | 11 ++++++++++-
12 files changed, 52 insertions(+), 12 deletions(-)
diff --git a/asminc/mouse-kernel.inc b/asminc/mouse-kernel.inc
index 24a9f7632..9db47fcb8 100644
--- a/asminc/mouse-kernel.inc
+++ b/asminc/mouse-kernel.inc
@@ -56,6 +56,7 @@
.struct MOUSE_HDR
ID .byte 3 ; Contains 0x6D, 0x6F, 0x75 ("mou")
VERSION .byte 1 ; Interface version
+ LIBREF .addr ; Library reference
JUMPTAB .struct
INSTALL .addr
UNINSTALL .addr
@@ -96,7 +97,7 @@
;------------------------------------------------------------------------------
; The mouse API version, stored in MOUSE_HDR::VERSION
-MOUSE_API_VERSION = $02
+MOUSE_API_VERSION = $03
;------------------------------------------------------------------------------
; Bitmapped mouse driver flags, stored in MOUSE_HDR::FLAGS.
diff --git a/libsrc/apple2/libref.s b/libsrc/apple2/libref.s
index 933eb5911..09bdb057c 100644
--- a/libsrc/apple2/libref.s
+++ b/libsrc/apple2/libref.s
@@ -2,8 +2,9 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref
+ .export em_libref, joy_libref, mouse_libref
.import _exit
em_libref := _exit
joy_libref := _exit
+mouse_libref := _exit
diff --git a/libsrc/apple2/mou/a2.stdmou.s b/libsrc/apple2/mou/a2.stdmou.s
index 30ef85c54..8414cde36 100644
--- a/libsrc/apple2/mou/a2.stdmou.s
+++ b/libsrc/apple2/mou/a2.stdmou.s
@@ -34,7 +34,10 @@ status := $0778
.byte $6D, $6F, $75 ; "mou"
.byte MOUSE_API_VERSION ; Mouse driver API version number
- ; Jump table.
+ ; Library reference
+ .addr $0000
+
+ ; Jump table
.addr INSTALL
.addr UNINSTALL
.addr HIDE
diff --git a/libsrc/c128/libref.s b/libsrc/c128/libref.s
index 933eb5911..09bdb057c 100644
--- a/libsrc/c128/libref.s
+++ b/libsrc/c128/libref.s
@@ -2,8 +2,9 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref
+ .export em_libref, joy_libref, mouse_libref
.import _exit
em_libref := _exit
joy_libref := _exit
+mouse_libref := _exit
diff --git a/libsrc/c128/mou/c128-1351.s b/libsrc/c128/mou/c128-1351.s
index f7c74d3cb..f2a71647c 100644
--- a/libsrc/c128/mou/c128-1351.s
+++ b/libsrc/c128/mou/c128-1351.s
@@ -23,7 +23,11 @@ HEADER:
.byte $6d, $6f, $75 ; "mou"
.byte MOUSE_API_VERSION ; Mouse driver API version number
-; Jump table.
+; Library reference
+
+ .addr $0000
+
+; Jump table
.addr INSTALL
.addr UNINSTALL
diff --git a/libsrc/c128/mou/c128-joy.s b/libsrc/c128/mou/c128-joy.s
index 3ac7b5ee3..8c3bd779d 100644
--- a/libsrc/c128/mou/c128-joy.s
+++ b/libsrc/c128/mou/c128-joy.s
@@ -22,7 +22,11 @@ HEADER:
.byte $6d, $6f, $75 ; "mou"
.byte MOUSE_API_VERSION ; Mouse driver API version number
-; Jump table.
+; Library reference
+
+ .addr $0000
+
+; Jump table
.addr INSTALL
.addr UNINSTALL
diff --git a/libsrc/c128/mou/c128-pot.s b/libsrc/c128/mou/c128-pot.s
index 2713e3f4f..ab6922896 100644
--- a/libsrc/c128/mou/c128-pot.s
+++ b/libsrc/c128/mou/c128-pot.s
@@ -23,7 +23,11 @@ HEADER:
.byte $6d, $6f, $75 ; "mou"
.byte MOUSE_API_VERSION ; Mouse driver API version number
-; Jump table.
+; Library reference
+
+ .addr $0000
+
+; Jump table
.addr INSTALL
.addr UNINSTALL
diff --git a/libsrc/c64/libref.s b/libsrc/c64/libref.s
index 933eb5911..09bdb057c 100644
--- a/libsrc/c64/libref.s
+++ b/libsrc/c64/libref.s
@@ -2,8 +2,9 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref
+ .export em_libref, joy_libref, mouse_libref
.import _exit
em_libref := _exit
joy_libref := _exit
+mouse_libref := _exit
diff --git a/libsrc/c64/mou/c64-1351.s b/libsrc/c64/mou/c64-1351.s
index 7ffc0510e..ec053b0b2 100644
--- a/libsrc/c64/mou/c64-1351.s
+++ b/libsrc/c64/mou/c64-1351.s
@@ -42,7 +42,11 @@ HEADER:
.byte $6d, $6f, $75 ; "mou"
.byte MOUSE_API_VERSION ; Mouse driver API version number
-; Jump table.
+; Library reference
+
+ .addr $0000
+
+; Jump table
.addr INSTALL
.addr UNINSTALL
diff --git a/libsrc/c64/mou/c64-joy.s b/libsrc/c64/mou/c64-joy.s
index 8390aa37d..05f0ce50e 100644
--- a/libsrc/c64/mou/c64-joy.s
+++ b/libsrc/c64/mou/c64-joy.s
@@ -41,7 +41,11 @@ HEADER:
.byte $6d, $6f, $75 ; "mou"
.byte MOUSE_API_VERSION ; Mouse driver API version number
-; Jump table.
+; Library reference
+
+ .addr $0000
+
+; Jump table
.addr INSTALL
.addr UNINSTALL
diff --git a/libsrc/c64/mou/c64-pot.s b/libsrc/c64/mou/c64-pot.s
index 8ee0266e7..3eb977477 100644
--- a/libsrc/c64/mou/c64-pot.s
+++ b/libsrc/c64/mou/c64-pot.s
@@ -23,7 +23,11 @@ HEADER:
.byte $6d, $6f, $75 ; "mou"
.byte MOUSE_API_VERSION ; Mouse driver API version number
-; Jump table.
+; Library reference
+
+ .addr $0000
+
+; Jump table
.addr INSTALL
.addr UNINSTALL
diff --git a/libsrc/mouse/mouse-kernel.s b/libsrc/mouse/mouse-kernel.s
index 598b61ea2..2fa5b5e2d 100644
--- a/libsrc/mouse/mouse-kernel.s
+++ b/libsrc/mouse/mouse-kernel.s
@@ -4,7 +4,7 @@
; Common functions of the mouse driver API.
;
- .import return0, popsreg, incsp2
+ .import return0, popsreg, incsp2, mouse_libref
.importzp sreg, ptr1, tmp1, tmp2
.interruptor mouse_irq ; Export as IRQ handler
@@ -64,6 +64,15 @@ _mouse_install:
dey
bpl @L0
+; Set the library reference
+
+ ldy #MOUSE_HDR::LIBREF
+ lda #mouse_libref
+ sta (ptr1),y
+
; Reset flags
lda #1
From ae409e497851d1bc5bdb7cbec853bdeddf6f8750 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sat, 1 Jun 2013 11:03:14 +0200
Subject: [PATCH 5/6] Added library reference ser_libref to SER interface.
---
asminc/ser-kernel.inc | 21 +++++++++++----------
libsrc/apple2/libref.s | 3 ++-
libsrc/apple2/ser/a2.ssc.s | 5 ++++-
libsrc/atmos/libref.s | 3 ++-
libsrc/atmos/ser/atmos-acia.s | 5 ++++-
libsrc/c128/libref.s | 3 ++-
libsrc/c128/ser/c128-swlink.s | 6 +++++-
libsrc/c64/libref.s | 3 ++-
libsrc/c64/ser/c64-swlink.s | 6 +++++-
libsrc/cbm510/libref.s | 3 ++-
libsrc/cbm510/ser/cbm510-std.s | 6 +++++-
libsrc/cbm610/libref.s | 3 ++-
libsrc/cbm610/ser/cbm610-std.s | 6 +++++-
libsrc/lynx/libref.s | 3 ++-
libsrc/lynx/ser/lynx-comlynx.s | 5 ++++-
libsrc/plus4/libref.s | 3 ++-
libsrc/plus4/ser/plus4-stdser.s | 6 +++++-
libsrc/serial/ser-kernel.s | 11 ++++++++++-
18 files changed, 74 insertions(+), 27 deletions(-)
diff --git a/asminc/ser-kernel.inc b/asminc/ser-kernel.inc
index 7fc5bf9c2..fff9b1440 100644
--- a/asminc/ser-kernel.inc
+++ b/asminc/ser-kernel.inc
@@ -39,16 +39,17 @@
.struct SER_HDR
ID .byte 3 ; Contains 0x73, 0x65, 0x72 ("ser")
VERSION .byte 1 ; Interface version
+ LIBREF .addr ; Library reference
JUMPTAB .struct
- INSTALL .word ; INSTALL routine
- UNINSTALL .word ; UNINSTALL routine
- OPEN .word ; OPEN routine
- CLOSE .word ; CLOSE routine
- GET .word ; GET routine
- PUT .word ; PUT routine
- STATUS .word ; STATUS routine
- IOCTL .word ; IOCTL routine
- IRQ .word ; IRQ routine
+ INSTALL .addr ; INSTALL routine
+ UNINSTALL .addr ; UNINSTALL routine
+ OPEN .addr ; OPEN routine
+ CLOSE .addr ; CLOSE routine
+ GET .addr ; GET routine
+ PUT .addr ; PUT routine
+ STATUS .addr ; STATUS routine
+ IOCTL .addr ; IOCTL routine
+ IRQ .addr ; IRQ routine
.endstruct
.endstruct
@@ -56,7 +57,7 @@
;------------------------------------------------------------------------------
; The SER API version, stored SER_HDR::VERSION
-SER_API_VERSION = $00
+SER_API_VERSION = $01
;------------------------------------------------------------------------------
; ser_params
diff --git a/libsrc/apple2/libref.s b/libsrc/apple2/libref.s
index 09bdb057c..898a92f18 100644
--- a/libsrc/apple2/libref.s
+++ b/libsrc/apple2/libref.s
@@ -2,9 +2,10 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref, mouse_libref
+ .export em_libref, joy_libref, mouse_libref, ser_libref
.import _exit
em_libref := _exit
joy_libref := _exit
mouse_libref := _exit
+ser_libref := _exit
diff --git a/libsrc/apple2/ser/a2.ssc.s b/libsrc/apple2/ser/a2.ssc.s
index 374505638..19deefd39 100644
--- a/libsrc/apple2/ser/a2.ssc.s
+++ b/libsrc/apple2/ser/a2.ssc.s
@@ -34,7 +34,10 @@
.byte $73, $65, $72 ; "ser"
.byte SER_API_VERSION ; Serial API version number
- ; Jump table.
+ ; Library reference
+ .addr $0000
+
+ ; Jump table
.addr INSTALL
.addr UNINSTALL
.addr OPEN
diff --git a/libsrc/atmos/libref.s b/libsrc/atmos/libref.s
index e4afa7eb1..0bda1e7e8 100644
--- a/libsrc/atmos/libref.s
+++ b/libsrc/atmos/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export joy_libref
+ .export joy_libref, ser_libref
.import _exit
joy_libref := _exit
+ser_libref := _exit
diff --git a/libsrc/atmos/ser/atmos-acia.s b/libsrc/atmos/ser/atmos-acia.s
index 36071c32a..9d742bf66 100644
--- a/libsrc/atmos/ser/atmos-acia.s
+++ b/libsrc/atmos/ser/atmos-acia.s
@@ -35,7 +35,10 @@
.byte $73, $65, $72 ; "ser"
.byte SER_API_VERSION ; Serial API version number
- ; Jump table.
+ ; Library reference
+ .addr $0000
+
+ ; Jump table
.addr INSTALL
.addr UNINSTALL
.addr OPEN
diff --git a/libsrc/c128/libref.s b/libsrc/c128/libref.s
index 09bdb057c..898a92f18 100644
--- a/libsrc/c128/libref.s
+++ b/libsrc/c128/libref.s
@@ -2,9 +2,10 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref, mouse_libref
+ .export em_libref, joy_libref, mouse_libref, ser_libref
.import _exit
em_libref := _exit
joy_libref := _exit
mouse_libref := _exit
+ser_libref := _exit
diff --git a/libsrc/c128/ser/c128-swlink.s b/libsrc/c128/ser/c128-swlink.s
index 347452e85..02336d688 100644
--- a/libsrc/c128/ser/c128-swlink.s
+++ b/libsrc/c128/ser/c128-swlink.s
@@ -37,7 +37,11 @@
.byte $73, $65, $72 ; "ser"
.byte SER_API_VERSION ; Serial API version number
-; Jump table.
+; Library reference
+
+ .addr $0000
+
+; Jump table
.word INSTALL
.word UNINSTALL
diff --git a/libsrc/c64/libref.s b/libsrc/c64/libref.s
index 09bdb057c..898a92f18 100644
--- a/libsrc/c64/libref.s
+++ b/libsrc/c64/libref.s
@@ -2,9 +2,10 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref, mouse_libref
+ .export em_libref, joy_libref, mouse_libref, ser_libref
.import _exit
em_libref := _exit
joy_libref := _exit
mouse_libref := _exit
+ser_libref := _exit
diff --git a/libsrc/c64/ser/c64-swlink.s b/libsrc/c64/ser/c64-swlink.s
index f9121b8b6..d95e63d9c 100644
--- a/libsrc/c64/ser/c64-swlink.s
+++ b/libsrc/c64/ser/c64-swlink.s
@@ -37,7 +37,11 @@
.byte $73, $65, $72 ; "ser"
.byte SER_API_VERSION ; Serial API version number
-; Jump table.
+; Library reference
+
+ .addr $0000
+
+; Jump table
.word INSTALL
.word UNINSTALL
diff --git a/libsrc/cbm510/libref.s b/libsrc/cbm510/libref.s
index 933eb5911..515c62d19 100644
--- a/libsrc/cbm510/libref.s
+++ b/libsrc/cbm510/libref.s
@@ -2,8 +2,9 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref
+ .export em_libref, joy_libref, ser_libref
.import _exit
em_libref := _exit
joy_libref := _exit
+ser_libref := _exit
diff --git a/libsrc/cbm510/ser/cbm510-std.s b/libsrc/cbm510/ser/cbm510-std.s
index 9b721bd41..be17a027b 100644
--- a/libsrc/cbm510/ser/cbm510-std.s
+++ b/libsrc/cbm510/ser/cbm510-std.s
@@ -38,7 +38,11 @@
.byte $73, $65, $72 ; "ser"
.byte SER_API_VERSION ; Serial API version number
-; Jump table.
+; Library reference
+
+ .addr $0000
+
+; Jump table
.word INSTALL
.word UNINSTALL
diff --git a/libsrc/cbm610/libref.s b/libsrc/cbm610/libref.s
index 507c9887b..9c6994a5d 100644
--- a/libsrc/cbm610/libref.s
+++ b/libsrc/cbm610/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, ser_libref
.import _exit
em_libref := _exit
+ser_libref := _exit
diff --git a/libsrc/cbm610/ser/cbm610-std.s b/libsrc/cbm610/ser/cbm610-std.s
index 671698a28..2d090bf41 100644
--- a/libsrc/cbm610/ser/cbm610-std.s
+++ b/libsrc/cbm610/ser/cbm610-std.s
@@ -38,7 +38,11 @@
.byte $73, $65, $72 ; "ser"
.byte SER_API_VERSION ; Serial API version number
-; Jump table.
+; Library reference
+
+ .addr $0000
+
+; Jump table
.word INSTALL
.word UNINSTALL
diff --git a/libsrc/lynx/libref.s b/libsrc/lynx/libref.s
index e4afa7eb1..0bda1e7e8 100644
--- a/libsrc/lynx/libref.s
+++ b/libsrc/lynx/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export joy_libref
+ .export joy_libref, ser_libref
.import _exit
joy_libref := _exit
+ser_libref := _exit
diff --git a/libsrc/lynx/ser/lynx-comlynx.s b/libsrc/lynx/ser/lynx-comlynx.s
index 7035787c9..acd91a999 100644
--- a/libsrc/lynx/ser/lynx-comlynx.s
+++ b/libsrc/lynx/ser/lynx-comlynx.s
@@ -18,7 +18,10 @@
.byte $73, $65, $72 ; "ser"
.byte SER_API_VERSION ; Serial API version number
- ; Jump table.
+ ; Library reference
+ .addr $0000
+
+ ; Jump table
.addr INSTALL
.addr UNINSTALL
.addr OPEN
diff --git a/libsrc/plus4/libref.s b/libsrc/plus4/libref.s
index e4afa7eb1..0bda1e7e8 100644
--- a/libsrc/plus4/libref.s
+++ b/libsrc/plus4/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export joy_libref
+ .export joy_libref, ser_libref
.import _exit
joy_libref := _exit
+ser_libref := _exit
diff --git a/libsrc/plus4/ser/plus4-stdser.s b/libsrc/plus4/ser/plus4-stdser.s
index ed33aa8c7..86377b89c 100644
--- a/libsrc/plus4/ser/plus4-stdser.s
+++ b/libsrc/plus4/ser/plus4-stdser.s
@@ -37,7 +37,11 @@
.byte $73, $65, $72 ; "ser"
.byte SER_API_VERSION ; Serial API version number
-; Jump table.
+; Library reference
+
+ .addr $0000
+
+; Jump table
.word INSTALL
.word UNINSTALL
diff --git a/libsrc/serial/ser-kernel.s b/libsrc/serial/ser-kernel.s
index 7a91e5e4b..438189edb 100644
--- a/libsrc/serial/ser-kernel.s
+++ b/libsrc/serial/ser-kernel.s
@@ -4,7 +4,7 @@
; Common functions of the serial drivers
;
- .import return0
+ .import return0, ser_libref
.importzp ptr1
.interruptor ser_irq, 29 ; Export as high priority IRQ handler
@@ -58,6 +58,15 @@ _ser_install:
dey
bpl @L0
+; Set the library reference
+
+ ldy #SER_HDR::LIBREF
+ lda #ser_libref
+ sta (ptr1),y
+
; Copy the jump vectors
ldy #SER_HDR::JUMPTAB
From b0dd6c614ff422a6136d90549358e3a139584056 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sat, 1 Jun 2013 12:42:00 +0200
Subject: [PATCH 6/6] Added library reference tgi_libref to TGI interface.
---
asminc/tgi-kernel.inc | 1 +
libsrc/apple2/libref.s | 3 ++-
libsrc/apple2/tgi/a2.hi.s | 1 +
libsrc/apple2/tgi/a2.lo.s | 1 +
libsrc/atari/libref.s | 3 ++-
libsrc/atari/tgi/atari_tgi_common.inc | 1 +
libsrc/atmos/libref.s | 3 ++-
libsrc/atmos/tgi/atmos-228-200-3.s | 1 +
libsrc/atmos/tgi/atmos-240-200-2.s | 1 +
libsrc/c128/libref.s | 3 ++-
libsrc/c128/tgi/c128-vdc.s | 1 +
libsrc/c128/tgi/c128-vdc2.s | 1 +
libsrc/c64/libref.s | 3 ++-
libsrc/c64/tgi/c64-hi.s | 1 +
libsrc/geos-cbm/system/libref.s | 3 ++-
libsrc/geos-cbm/tgi/geos-tgi.s | 1 +
libsrc/lynx/libref.s | 3 ++-
libsrc/lynx/tgi/lynx-160-102-16.s | 1 +
libsrc/nes/libref.s | 3 ++-
libsrc/nes/tgi/nes-64-56-2.s | 3 ++-
libsrc/tgi/tgi-kernel.s | 16 +++++++++++++---
21 files changed, 42 insertions(+), 12 deletions(-)
diff --git a/asminc/tgi-kernel.inc b/asminc/tgi-kernel.inc
index c1182d371..6e687315d 100644
--- a/asminc/tgi-kernel.inc
+++ b/asminc/tgi-kernel.inc
@@ -39,6 +39,7 @@
.struct TGI_HDR
ID .byte 3 ; Contains 0x74, 0x67, 0x69 ("tgi")
VERSION .byte 1 ; Interface version
+ LIBREF .addr ; Library reference
VARS .struct
XRES .word 1 ; X resolution
YRES .word 1 ; Y resolution
diff --git a/libsrc/apple2/libref.s b/libsrc/apple2/libref.s
index 898a92f18..fb22515bd 100644
--- a/libsrc/apple2/libref.s
+++ b/libsrc/apple2/libref.s
@@ -2,10 +2,11 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref, mouse_libref, ser_libref
+ .export em_libref, joy_libref, mouse_libref, ser_libref, tgi_libref
.import _exit
em_libref := _exit
joy_libref := _exit
mouse_libref := _exit
ser_libref := _exit
+tgi_libref := _exit
diff --git a/libsrc/apple2/tgi/a2.hi.s b/libsrc/apple2/tgi/a2.hi.s
index 145b78e4a..2f00c83da 100644
--- a/libsrc/apple2/tgi/a2.hi.s
+++ b/libsrc/apple2/tgi/a2.hi.s
@@ -77,6 +77,7 @@ Y2 := ptr4
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
+ .addr $0000 ; Library reference
.word 280 ; X resolution
.word 192 ; Y resolution
.byte 8 ; Number of drawing colors
diff --git a/libsrc/apple2/tgi/a2.lo.s b/libsrc/apple2/tgi/a2.lo.s
index 7ac43e6cc..5c20ca4d2 100644
--- a/libsrc/apple2/tgi/a2.lo.s
+++ b/libsrc/apple2/tgi/a2.lo.s
@@ -47,6 +47,7 @@ Y2 := ptr4
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
+ .addr $0000 ; Library reference
.word 40 ; X resolution
.word 48 ; Y resolution
.byte 16 ; Number of drawing colors
diff --git a/libsrc/atari/libref.s b/libsrc/atari/libref.s
index 933eb5911..8d9ff3e08 100644
--- a/libsrc/atari/libref.s
+++ b/libsrc/atari/libref.s
@@ -2,8 +2,9 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref
+ .export em_libref, joy_libref, tgi_libref
.import _exit
em_libref := _exit
joy_libref := _exit
+tgi_libref := _exit
diff --git a/libsrc/atari/tgi/atari_tgi_common.inc b/libsrc/atari/tgi/atari_tgi_common.inc
index 9190fe8c8..7dba884fa 100644
--- a/libsrc/atari/tgi/atari_tgi_common.inc
+++ b/libsrc/atari/tgi/atari_tgi_common.inc
@@ -18,6 +18,7 @@
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
+ .addr $0000 ; Library reference
.word x_res ; X resolution
.word y_res ; Y resolution
.byte colors ; Number of drawing colors
diff --git a/libsrc/atmos/libref.s b/libsrc/atmos/libref.s
index 0bda1e7e8..62c78b8c5 100644
--- a/libsrc/atmos/libref.s
+++ b/libsrc/atmos/libref.s
@@ -2,8 +2,9 @@
; Oliver Schmidt, 2013-05-31
;
- .export joy_libref, ser_libref
+ .export joy_libref, ser_libref, tgi_libref
.import _exit
joy_libref := _exit
ser_libref := _exit
+tgi_libref := _exit
diff --git a/libsrc/atmos/tgi/atmos-228-200-3.s b/libsrc/atmos/tgi/atmos-228-200-3.s
index 9417fff0d..e03376015 100644
--- a/libsrc/atmos/tgi/atmos-228-200-3.s
+++ b/libsrc/atmos/tgi/atmos-228-200-3.s
@@ -26,6 +26,7 @@ YSIZE = 8 ; System font height
.byte "tgi"
.byte TGI_API_VERSION ; TGI API version number
+ .addr $0000 ; Library reference
.word 228 ; x resolution
.word 200 ; y resolution
.byte 3 ; Number of drawing colors
diff --git a/libsrc/atmos/tgi/atmos-240-200-2.s b/libsrc/atmos/tgi/atmos-240-200-2.s
index 735d75f93..e58ac36d2 100644
--- a/libsrc/atmos/tgi/atmos-240-200-2.s
+++ b/libsrc/atmos/tgi/atmos-240-200-2.s
@@ -26,6 +26,7 @@ YSIZE = 8 ; System font height
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
+ .addr $0000 ; Library reference
.word 240 ; X resolution
.word 200 ; Y resolution
.byte 2 ; Number of drawing colors
diff --git a/libsrc/c128/libref.s b/libsrc/c128/libref.s
index 898a92f18..fb22515bd 100644
--- a/libsrc/c128/libref.s
+++ b/libsrc/c128/libref.s
@@ -2,10 +2,11 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref, mouse_libref, ser_libref
+ .export em_libref, joy_libref, mouse_libref, ser_libref, tgi_libref
.import _exit
em_libref := _exit
joy_libref := _exit
mouse_libref := _exit
ser_libref := _exit
+tgi_libref := _exit
diff --git a/libsrc/c128/tgi/c128-vdc.s b/libsrc/c128/tgi/c128-vdc.s
index 226d2aea2..394f4080a 100644
--- a/libsrc/c128/tgi/c128-vdc.s
+++ b/libsrc/c128/tgi/c128-vdc.s
@@ -55,6 +55,7 @@ VDC_DATA = 31
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
+ .addr $0000 ; Library reference
xres: .word 640 ; X resolution
yres: .word 200 ; Y resolution
.byte 2 ; Number of drawing colors
diff --git a/libsrc/c128/tgi/c128-vdc2.s b/libsrc/c128/tgi/c128-vdc2.s
index e3c08037f..2e1d26ae5 100644
--- a/libsrc/c128/tgi/c128-vdc2.s
+++ b/libsrc/c128/tgi/c128-vdc2.s
@@ -56,6 +56,7 @@ VDC_DATA = 31
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
+ .addr $0000 ; Library reference
xres: .word 640 ; X resolution
yres: .word 480 ; Y resolution
.byte 2 ; Number of drawing colors
diff --git a/libsrc/c64/libref.s b/libsrc/c64/libref.s
index 898a92f18..fb22515bd 100644
--- a/libsrc/c64/libref.s
+++ b/libsrc/c64/libref.s
@@ -2,10 +2,11 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref, mouse_libref, ser_libref
+ .export em_libref, joy_libref, mouse_libref, ser_libref, tgi_libref
.import _exit
em_libref := _exit
joy_libref := _exit
mouse_libref := _exit
ser_libref := _exit
+tgi_libref := _exit
diff --git a/libsrc/c64/tgi/c64-hi.s b/libsrc/c64/tgi/c64-hi.s
index 1e829d274..d91196649 100644
--- a/libsrc/c64/tgi/c64-hi.s
+++ b/libsrc/c64/tgi/c64-hi.s
@@ -23,6 +23,7 @@
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
+ .addr $0000 ; Library reference
.word 320 ; X resolution
.word 200 ; Y resolution
.byte 2 ; Number of drawing colors
diff --git a/libsrc/geos-cbm/system/libref.s b/libsrc/geos-cbm/system/libref.s
index 933eb5911..8d9ff3e08 100644
--- a/libsrc/geos-cbm/system/libref.s
+++ b/libsrc/geos-cbm/system/libref.s
@@ -2,8 +2,9 @@
; Oliver Schmidt, 2013-05-31
;
- .export em_libref, joy_libref
+ .export em_libref, joy_libref, tgi_libref
.import _exit
em_libref := _exit
joy_libref := _exit
+tgi_libref := _exit
diff --git a/libsrc/geos-cbm/tgi/geos-tgi.s b/libsrc/geos-cbm/tgi/geos-tgi.s
index dbf9f4fc4..617e322ff 100644
--- a/libsrc/geos-cbm/tgi/geos-tgi.s
+++ b/libsrc/geos-cbm/tgi/geos-tgi.s
@@ -40,6 +40,7 @@ VDC_DATA = 31
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
+ .addr $0000 ; Library reference
xres: .word 320 ; X resolution
yres: .word 200 ; Y resolution
.byte 2 ; Number of drawing colors
diff --git a/libsrc/lynx/libref.s b/libsrc/lynx/libref.s
index 0bda1e7e8..62c78b8c5 100644
--- a/libsrc/lynx/libref.s
+++ b/libsrc/lynx/libref.s
@@ -2,8 +2,9 @@
; Oliver Schmidt, 2013-05-31
;
- .export joy_libref, ser_libref
+ .export joy_libref, ser_libref, tgi_libref
.import _exit
joy_libref := _exit
ser_libref := _exit
+tgi_libref := _exit
diff --git a/libsrc/lynx/tgi/lynx-160-102-16.s b/libsrc/lynx/tgi/lynx-160-102-16.s
index 4542cae1d..ef2eabf1d 100644
--- a/libsrc/lynx/tgi/lynx-160-102-16.s
+++ b/libsrc/lynx/tgi/lynx-160-102-16.s
@@ -27,6 +27,7 @@
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
+ .addr $0000 ; Library reference
.word 160 ; X resolution
.word 102 ; Y resolution
.byte 16 ; Number of drawing colors
diff --git a/libsrc/nes/libref.s b/libsrc/nes/libref.s
index e4afa7eb1..d947c1aa4 100644
--- a/libsrc/nes/libref.s
+++ b/libsrc/nes/libref.s
@@ -2,7 +2,8 @@
; Oliver Schmidt, 2013-05-31
;
- .export joy_libref
+ .export joy_libref, tgi_libref
.import _exit
joy_libref := _exit
+tgi_libref := _exit
diff --git a/libsrc/nes/tgi/nes-64-56-2.s b/libsrc/nes/tgi/nes-64-56-2.s
index cce83e231..512810b4c 100644
--- a/libsrc/nes/tgi/nes-64-56-2.s
+++ b/libsrc/nes/tgi/nes-64-56-2.s
@@ -26,13 +26,14 @@
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
+ .addr $0000 ; Library reference
xres: .word charsperline*2 ; Max X resolution
yres: .word 56 ; Max Y resolution
.byte 2 ; Number of drawing colors
.byte 1 ; Number of screens available
.byte 2 ; System font X size
.byte 2 ; System font Y size
- .word $100 ; Aspect ratio
+ .word $0100 ; Aspect ratio
.byte 0 ; TGI driver flags
; Next comes the jump table. Currently all entries must be valid and may point
diff --git a/libsrc/tgi/tgi-kernel.s b/libsrc/tgi/tgi-kernel.s
index d5b025506..3781795f6 100644
--- a/libsrc/tgi/tgi-kernel.s
+++ b/libsrc/tgi/tgi-kernel.s
@@ -4,12 +4,13 @@
; Common functions of the tgi graphics kernel.
;
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
+ .import tgi_libref
.importzp ptr1
.interruptor tgi_irq ; Export as IRQ handler
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
;----------------------------------------------------------------------------
; Variables
@@ -108,6 +109,15 @@ _tgi_install:
dey
bpl @L0
+; Set the library reference
+
+ ldy #TGI_HDR::LIBREF
+ lda #tgi_libref
+ sta (ptr1),y
+
; Copy the jump vectors
ldy #TGI_HDR::JUMPTAB