From 116ade035ca6ebfcd120ea8dd68877c2329b2ee7 Mon Sep 17 00:00:00 2001 From: cuz Date: Sat, 6 Nov 2004 13:05:26 +0000 Subject: [PATCH] Added the IRQ entry point git-svn-id: svn://svn.cc65.org/cc65/trunk@3276 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/apple2/apple2-stdjoy.s | 11 ++++++----- libsrc/joystick/joy-kernel.s | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/libsrc/apple2/apple2-stdjoy.s b/libsrc/apple2/apple2-stdjoy.s index b42876a69..5011e619a 100644 --- a/libsrc/apple2/apple2-stdjoy.s +++ b/libsrc/apple2/apple2-stdjoy.s @@ -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 diff --git a/libsrc/joystick/joy-kernel.s b/libsrc/joystick/joy-kernel.s index 7b8c878e5..6bfb7aff2 100644 --- a/libsrc/joystick/joy-kernel.s +++ b/libsrc/joystick/joy-kernel.s @@ -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 -- 2.39.5