]> git.sur5r.net Git - cc65/commitdiff
Added the IRQ entry point
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 6 Nov 2004 13:05:26 +0000 (13:05 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 6 Nov 2004 13:05:26 +0000 (13:05 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3276 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/apple2/apple2-stdjoy.s
libsrc/joystick/joy-kernel.s

index b42876a69aaa84a892efbeb46c813131de484f36..5011e619a4192b3b2bf28d545d5f26a4e27253fe 100644 (file)
@@ -42,16 +42,17 @@ PREAD       :=      $FB1E   ; Read paddle in X, return AD conv. value in Y
         .byte   $10
         .byte   $20
         .byte   $08
-        .byte   $00                     ; Future expansion
+        .byte   $00                     ; FIRE2 not available
         .byte   $00                     ; Future expansion
         .byte   $00                     ; Future expansion
 
 ; Jump table.
 
-        .word   INSTALL
-        .word   UNINSTALL
-        .word   COUNT
-        .word   READJOY
+        .addr   INSTALL
+        .addr   UNINSTALL
+        .addr   COUNT
+        .addr   READJOY
+        .addr   0                       ; IRQ not used
 
 ; ------------------------------------------------------------------------
 ; Constants
index 7b8c878e5646048fe061519906469b027d24caaf..6bfb7aff217564d3b00dc6598312c38bdb5b7296 100644 (file)
@@ -29,6 +29,7 @@ joy_install:          jmp     $0000
 joy_uninstall:         jmp     $0000
 joy_count:      jmp     $0000
 joy_read:       jmp     $0000
+joy_irq:        .byte   $60, $00, $00   ; RTS plus two dummy bytes
 
 ; Driver header signature
 .rodata
@@ -75,7 +76,16 @@ _joy_install:
         cpy     #(JOY_HDR::JUMPTAB + .sizeof(JOY_HDR::JUMPTAB))
         bne     @L2
 
-        jmp     joy_install             ; Call driver install routine
+        jsr     joy_install             ; Call driver install routine
+
+; Install the IRQ vector if the driver needs it. A/X contains the error code
+; from joy_install, so don't use it.
+
+        ldy     joy_irq+2               ; Check high byte of IRQ vector
+        beq     @L3                     ; Jump if vector invalid
+       ldy     #$4C                    ; JMP opcode
+               sty     joy_irq                 ; Activate IRQ routine
+@L3:    rts
 
 ; Driver signature invalid
 
@@ -99,6 +109,9 @@ set:    sta     joy_vectors,x
 ;  */
 
 _joy_uninstall:
+       lda     #$60                    ; RTS opcode
+               sta     joy_irq                 ; Disable IRQ entry point
+
         jsr     joy_uninstall           ; Call the driver routine
 
 joy_clear_ptr:                          ; External entry point