1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-12 17:30:50 +00:00

Added the IRQ entry point

git-svn-id: svn://svn.cc65.org/cc65/trunk@3276 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2004-11-06 13:05:26 +00:00
parent 0ad0a2e138
commit 116ade035c
2 changed files with 20 additions and 6 deletions

View 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

View 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