All but one joystick drivers didn't use IRQs. Espsecially when the joystick driver kernel was the only .interruptor this meant quite some unnecessary overhead because it pulled in the whole IRQ infrastructure.
I was told that the one driver using IRQs (the DXS/HIT-4 Player joystick driver for the C64) can be reworked to not do it. Until this is done that driver is defunct.
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 = $04
+JOY_API_VERSION = $05
;------------------------------------------------------------------------------
; Variables
.addr UNINSTALL
.addr COUNT
.addr READJOY
- .addr 0 ; IRQ not used
; ------------------------------------------------------------------------
.addr UNINSTALL
.addr COUNT
.addr READJOY
- .addr 0 ; IRQ entry not used
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READJOY
- .addr 0 ; IRQ entry not used
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READJOY
- .addr 0 ; IRQ entry not used
.code
.addr $0000
-; Button state masks (8 values)
-
- .byte $10 ; JOY_UP
- .byte $08 ; JOY_DOWN
- .byte $01 ; JOY_LEFT
- .byte $02 ; JOY_RIGHT
- .byte $20 ; JOY_FIRE
- .byte $00 ; Future expansion
- .byte $00 ; Future expansion
- .byte $00 ; Future expansion
-
; Jump table.
.addr INSTALL
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry not used
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr IRQ
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READJOY
- .addr 0 ; IRQ entry not used
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READJOY
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.import joy_libref
.importzp ptr1
- .interruptor joy_irq ; Export as IRQ handler
.include "joy-kernel.inc"
.include "joy-error.inc"
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
cpy #(JOY_HDR::JUMPTAB + .sizeof(JOY_HDR::JUMPTAB))
bne @L1
- jsr joy_install ; Call driver install routine
- tay ; Test error code
- bne @L2 ; Bail out if install had errors
-
-; 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 @L2 ; Jump if vector invalid
- ldy #$4C ; JMP opcode
- sty joy_irq ; Activate IRQ routine
-@L2: rts
+ jmp joy_install ; Call driver install routine
; Driver signature invalid
; */
_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
.include "joy-kernel.inc"
_joy_read = joy_read ; Use driver entry
-
-
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READJOY
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READJOY
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READJOY
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
.addr UNINSTALL
.addr COUNT
.addr READ
- .addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants