]> git.sur5r.net Git - cc65/commitdiff
Removed IRQ support from TGI drivers.
authorOliver Schmidt <ol.sc@web.de>
Fri, 2 Feb 2018 17:15:45 +0000 (18:15 +0100)
committerOliver Schmidt <ol.sc@web.de>
Fri, 2 Feb 2018 17:15:45 +0000 (18:15 +0100)
All but one TGI drivers didn't use IRQs. Especially when the TGI driver kernel was the only .interruptor this meant quite some unnecessary overhead because it pulled in the whole IRQ infrastructure.

The one driver using IRQs (the graphics driver for the 160x102x16 mode on the Lynx) now uses a library reference to set up a JMP to its IRQ handler.

17 files changed:
asminc/tgi-kernel.inc
libsrc/apple2/tgi/a2.hi.s
libsrc/apple2/tgi/a2.lo.s
libsrc/atari/tgi/atari_tgi_common.inc
libsrc/atmos/tgi/atmos-228-200-3.s
libsrc/atmos/tgi/atmos-240-200-2.s
libsrc/c128/tgi/c128-vdc.s
libsrc/c128/tgi/c128-vdc2.s
libsrc/c64/tgi/c64-hi.s
libsrc/geos-cbm/tgi/geos-tgi.s
libsrc/lynx/libref.s
libsrc/lynx/tgi/lynx-160-102-16.s
libsrc/lynx/tgi_irq.s [new file with mode: 0644]
libsrc/nes/tgi/nes-64-56-2.s
libsrc/telestrat/tgi/telestrat-228-200-3.s
libsrc/telestrat/tgi/telestrat-240-200-2.s
libsrc/tgi/tgi-kernel.s

index e9f2f6aa9abd92528a8de9d72995518f54de0d8a..fba78afff51d2d0b52dd88cb2a7ea73d84213b1e 100644 (file)
             BAR             .addr       ; BAR routine
             TEXTSTYLE       .addr       ; TEXTSTYLE routine
             OUTTEXT         .addr       ; OUTTEXT routine
-            IRQ             .addr       ; IRQ routine
         .endstruct
 .endstruct
 
 ;------------------------------------------------------------------------------
 ; The TGI API version, stored at TGI_HDR_VERSION
 
-TGI_API_VERSION         = $05
+TGI_API_VERSION         = $06
 
 ;------------------------------------------------------------------------------
 ; Bitmapped tgi driver flags, stored in TGI_HDR::VARS::FLAGS.
index 18f5724b5bf5b9069ffaf2e9b1982e9a4e978cea..e06b4a617f8b71efceb814bbf14a3ebb540b47ac 100644 (file)
@@ -115,7 +115,6 @@ pages:  .byte   2               ; Number of screens available
         .addr   BAR
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   0               ; IRQ entry is unused
 
 ; ------------------------------------------------------------------------
 
index 045b0044fec01913fb258899f3cc1d4330ee5495..7238463a9a24211d7b9c03a1c1d39757f923b31b 100644 (file)
@@ -85,7 +85,6 @@ Y2      :=      ptr4
         .addr   BAR
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   0               ; IRQ entry is unused
 
 ; ------------------------------------------------------------------------
 
index f4ef68165ae5c425fad88adebb00454393df61d5..cd486d91b15558ba6956e4a45edcd825143a656d 100644 (file)
@@ -68,7 +68,6 @@ libref: .addr   $0000                   ; Library reference
         .addr   BAR
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   0                       ; IRQ entry is unused
 
 ; ******************************************************************************
 
index ae9b0f77532c9194c820f1c19732ceb0180cda72..98d2cef96adc8163c603ee854f625aab0579f14c 100644 (file)
@@ -59,7 +59,6 @@ YSIZE   =       8               ; System font height
         .addr   BAR
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   0               ; IRQ entry is unused
 
 ; ------------------------------------------------------------------------
 ; Data.
index 943ec5389154959df89b1d6687f6f921b7f0145b..2643e08fd481d154a8158306a658627934be5492 100644 (file)
@@ -59,7 +59,6 @@ YSIZE   =       8                       ; System font height
         .addr   BAR
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   0                       ; IRQ entry is unused
 
 ; ------------------------------------------------------------------------
 ; Data.
index 5100f7f7d0fef66f54f18759c1dd5707e023a761..f48b530f69e365de9934412b29eeb2adeb1bcf90 100644 (file)
@@ -88,7 +88,6 @@ pages:  .byte   1                       ; Number of screens available
         .addr   BAR
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   0                       ; IRQ entry is unused
 
 ; ------------------------------------------------------------------------
 ; Data.
index a7238e87788470d8e75c3cd6d8b2eebff83136e5..4b7b17c57857546d4fd46d2592030183ac8edcf5 100644 (file)
@@ -89,7 +89,6 @@ pages:  .byte   0                       ; Number of screens available
         .addr   BAR
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   0                       ; IRQ entry is unused
 
 ; ------------------------------------------------------------------------
 ; Data.
index 580220ecc3215cddec3a2fa6c6361874a0efc07c..8368c6ba2e71921476dc7963b7bdc8bfb504fc22 100644 (file)
@@ -57,7 +57,6 @@
         .addr   BAR
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   0                       ; IRQ entry is unused
 
 ; ------------------------------------------------------------------------
 ; Data.
index 5a1af65e412212be4b3a848f0b366d805bfc23d3..08927e6c1fc2c4ed206e5a35faea9fd27015b84b 100644 (file)
@@ -74,7 +74,6 @@ aspect: .word $00D4             ; Aspect ratio (based on 4/3 display)
         .addr BAR
         .addr TEXTSTYLE
         .addr OUTTEXT
-        .addr 0                 ; IRQ entry is unused
 
 ; ------------------------------------------------------------------------
 ; Data.
index 62c78b8c5d2d8030c9f55bd5f57e97f73e7e6515..0bda1e7e8a31fcb256e8e6cdfd2d9928611aba90 100644 (file)
@@ -2,9 +2,8 @@
 ; Oliver Schmidt, 2013-05-31
 ;
 
-        .export         joy_libref, ser_libref, tgi_libref
+        .export         joy_libref, ser_libref
         .import         _exit
 
 joy_libref      := _exit
 ser_libref      := _exit
-tgi_libref      := _exit
index e6659631bd27af6a66ffad453d867f82b81a5fc9..04bdaae044d5e9a2b983f33c3e644a6a518241a0 100644 (file)
@@ -29,7 +29,7 @@
 
         .byte   $74, $67, $69           ; "tgi"
         .byte   TGI_API_VERSION         ; TGI API version number
-        .addr   $0000                   ; Library reference
+libref: .addr   $0000                   ; Library reference
         .word   160                     ; X resolution
         .word   102                     ; Y resolution
         .byte   16                      ; Number of drawing colors
@@ -64,7 +64,6 @@
         .addr   BAR
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   IRQ
 
 
 ; ------------------------------------------------------------------------
@@ -164,6 +163,18 @@ INSTALL:
         stz     BGINDEX
         stz     DRAWPAGE
         stz     SWAPREQUEST
+        lda     libref
+        ldx     libref+1
+        sta     ptr1
+        stx     ptr1+1
+        ldy     #1
+        lda     #<irq
+        sta     (ptr1),y
+        iny
+        lda     #>irq
+        sta     (ptr1),y
+        lda     #$4C            ; Jump opcode
+        sta     (ptr1)          ; Activate IRQ routine
         rts
 
 
@@ -175,6 +186,12 @@ INSTALL:
 ;
 
 UNINSTALL:
+        lda     libref
+        ldx     libref+1
+        sta     ptr1
+        stx     ptr1+1
+        lda     #$60            ; RTS opcode
+        sta     (ptr1)          ; Disable IRQ routine
         rts
 
 
@@ -466,14 +483,10 @@ SETDRAWPAGE:
         stx     DRAWPAGEH
         rts
 
-; ------------------------------------------------------------------------
-; IRQ: VBL interrupt handler
-;
-
-IRQ:
+irq:
         lda     INTSET          ; Poll all pending interrupts
         and     #VBL_INTERRUPT
-        beq     IRQEND          ; Exit if not a VBL interrupt
+        beq     @L0             ; Exit if not a VBL interrupt
 
         lda     SWAPREQUEST
         beq     @L0
@@ -485,7 +498,6 @@ IRQ:
         jsr     SETDRAWPAGE
         stz     SWAPREQUEST
 @L0:
-IRQEND:
         clc
         rts
 
diff --git a/libsrc/lynx/tgi_irq.s b/libsrc/lynx/tgi_irq.s
new file mode 100644 (file)
index 0000000..3968dc0
--- /dev/null
@@ -0,0 +1,11 @@
+;
+; Oliver Schmidt, 2018-02-02
+;
+
+        .export         tgi_libref
+        .interruptor    tgi_irq         ; Export as IRQ handler
+
+        .data
+
+tgi_libref:
+tgi_irq:        .byte   $60, $00, $00   ; RTS plus two dummy bytes
index 70e23e1193bf29482d5d0f55181e6bfce38241ee..e4dcb56ceab311832f10e8a6455d9286fd2b439f 100644 (file)
@@ -60,7 +60,6 @@ yres:   .word   56                      ; Max Y resolution
         .addr   BAR
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   0                       ; IRQ entry is unused
 
 ; ------------------------------------------------------------------------
 ; Data.
index 09c308e269b52ed493083fe6e8b85a0ac335f8c1..ce501f0bf29177ebd780263dcb0c3b65041d0dac 100644 (file)
@@ -58,7 +58,6 @@ YSIZE   =       8               ; System font height
         .addr   CIRCLE
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   0               ; IRQ entry is unused
 
 ; ------------------------------------------------------------------------
 ; Data.
index 8a30ddd45f85e779fc9572fc9752c2fdabce2779..3ee918c4fd5e1aad3428abcacaf58503fd04b9b1 100644 (file)
@@ -58,7 +58,6 @@ YSIZE   =       8                       ; System font height
         .addr   BAR
         .addr   TEXTSTYLE
         .addr   OUTTEXT
-        .addr   0                       ; IRQ entry is unused
 
 ; ------------------------------------------------------------------------
 ; Data.
index ed65760af183bc08fb3ffa5394f554080f3cd9a5..3a388b6dc83f7794db512a41e46d47713b9de999 100644 (file)
@@ -6,7 +6,6 @@
 
         .import         tgi_libref
         .importzp       ptr1
-        .interruptor    tgi_irq         ; Export as IRQ handler
 
         .include        "tgi-kernel.inc"
         .include        "tgi-error.inc"
@@ -81,7 +80,6 @@ tgi_line:           jmp     $0000
 tgi_bar:            jmp     $0000
 tgi_textstyle:      jmp     $0000
 tgi_outtext:        jmp     $0000
-tgi_irq:            .byte   $60, $00, $00       ; RTS plus two dummy bytes
 
 ; Driver header signature
 .rodata
@@ -144,20 +142,13 @@ _tgi_install:
         dex
         bpl     @L3
 
-; Install the IRQ vector if the driver needs it.
-
-        lda     tgi_irq+2               ; Check high byte of IRQ vector
-        beq     @L4                     ; Jump if vector invalid
-        lda     #$4C                    ; Jump opcode
-        sta     tgi_irq                 ; Activate IRQ routine
-
 ; Initialize some other variables
 
         lda     #$00
-@L4:    ldx     #csize-1
-@L5:    sta     cstart,x                ; Clear error/mode/curx/cury/...
+        ldx     #csize-1
+@L4:    sta     cstart,x                ; Clear error/mode/curx/cury/...
         dex
-        bpl     @L5
+        bpl     @L4
 
         rts
 
@@ -206,9 +197,6 @@ _tgi_uninstall:
 
         jsr     tgi_uninstall           ; Allow the driver to clean up
 
-        lda     #$60                    ; RTS opcode
-        sta     tgi_irq                 ; Disable IRQ entry point
-
 ; Clear driver pointer and error code
 
 tgi_clear_ptr: