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