mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
Back-migrated some phantom-key rejection optimizations.
This commit is contained in:
parent
667f8229c0
commit
7d512ca238
@ -3,7 +3,8 @@
|
||||
; the Commodore 1351 mouse users guide.
|
||||
;
|
||||
; 2009-09-26, Ullrich von Bassewitz
|
||||
; 2014-03-17, Greg King
|
||||
; 2014-04-26, Christian Groessler
|
||||
; 2014-04-30, Greg King
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
@ -12,8 +13,6 @@
|
||||
|
||||
.macpack generic
|
||||
|
||||
IRQInd = $2FD
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Header. Includes jump table
|
||||
|
||||
@ -28,8 +27,7 @@ HEADER:
|
||||
|
||||
; Library reference
|
||||
|
||||
libref:
|
||||
.addr $0000
|
||||
libref: .addr $0000
|
||||
|
||||
; Jump table
|
||||
|
||||
@ -210,7 +208,7 @@ UNINSTALL:
|
||||
sta IRQInd+1
|
||||
lda old_irq+1
|
||||
sta IRQInd+2
|
||||
cli
|
||||
;cli
|
||||
|
||||
jsr HIDE ; Hide cursor on exit
|
||||
lda INIT_save
|
||||
@ -351,7 +349,7 @@ INFO: jsr POS
|
||||
|
||||
; Fill in the button state
|
||||
|
||||
jsr BUTTONS ; Will not touch ptr1
|
||||
lda Buttons
|
||||
ldy #MOUSE_INFO::BUTTONS
|
||||
sta (ptr1),y
|
||||
|
||||
@ -363,7 +361,7 @@ INFO: jsr POS
|
||||
; Must return an error code in a/x.
|
||||
;
|
||||
|
||||
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
|
||||
ldx #>MOUSE_ERR_INV_IOCTL
|
||||
rts
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
; Driver for a "joystick mouse".
|
||||
;
|
||||
; 2009-09-26, Ullrich von Bassewitz
|
||||
; 2014-03-17, Greg King
|
||||
; 2014-04-26, Christian Groessler
|
||||
; 2014-05-01, Greg King
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
@ -11,8 +12,6 @@
|
||||
|
||||
.macpack generic
|
||||
|
||||
IRQInd = $2FD
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Header. Includes jump table
|
||||
|
||||
@ -27,8 +26,7 @@ HEADER:
|
||||
|
||||
; Library reference
|
||||
|
||||
libref:
|
||||
.addr $0000
|
||||
libref: .addr $0000
|
||||
|
||||
; Jump table
|
||||
|
||||
@ -91,10 +89,6 @@ Buttons: .res 1 ; Button mask
|
||||
|
||||
INIT_save: .res 1
|
||||
|
||||
; Temporary value used in the int handler
|
||||
|
||||
Temp: .res 1
|
||||
|
||||
; Keyboard buffer fill level at start of interrupt
|
||||
|
||||
old_key_count: .res 1
|
||||
@ -215,7 +209,7 @@ UNINSTALL:
|
||||
sta IRQInd+1
|
||||
lda old_irq+1
|
||||
sta IRQInd+2
|
||||
cli
|
||||
;cli
|
||||
|
||||
jsr HIDE ; Hide cursor on exit
|
||||
lda INIT_save
|
||||
@ -318,6 +312,7 @@ MOVE: sei ; No interrupts
|
||||
BUTTONS:
|
||||
lda Buttons
|
||||
ldx #$00
|
||||
and #MOUSE_BTN_LEFT ; Left button -- same as JOY::FIRE
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@ -356,7 +351,7 @@ INFO: jsr POS
|
||||
|
||||
; Fill in the button state
|
||||
|
||||
lda Buttons
|
||||
jsr BUTTONS
|
||||
ldy #MOUSE_INFO::BUTTONS
|
||||
sta (ptr1),y
|
||||
|
||||
@ -368,7 +363,7 @@ INFO: jsr POS
|
||||
; Must return an error code in a/x.
|
||||
;
|
||||
|
||||
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls for now
|
||||
ldx #>MOUSE_ERR_INV_IOCTL
|
||||
rts
|
||||
|
||||
@ -387,19 +382,10 @@ IRQ: jsr CPREP
|
||||
lda CIA1_PRB ; Read joystick #0
|
||||
and #$1F
|
||||
eor #$1F ; Make all bits active high
|
||||
sta Temp
|
||||
|
||||
; Check for a pressed button and place the result into Buttons
|
||||
|
||||
ldx #$00 ; Assume no button pressed
|
||||
and #JOY::FIRE ; Check fire button
|
||||
beq @L0 ; Jump if not pressed
|
||||
ldx #MOUSE_BTN_LEFT ; Left (only) button is pressed
|
||||
@L0: stx Buttons
|
||||
sta Buttons
|
||||
|
||||
; Check left/right
|
||||
|
||||
lda Temp ; Read joystick #0
|
||||
and #(JOY::LEFT | JOY::RIGHT)
|
||||
beq @SkipX ;
|
||||
|
||||
@ -447,7 +433,7 @@ IRQ: jsr CPREP
|
||||
|
||||
; Calculate the Y movement vector
|
||||
|
||||
@SkipX: lda Temp ; Read joystick #0
|
||||
@SkipX: lda Buttons ; Read joystick #0
|
||||
and #(JOY::UP | JOY::DOWN) ; Check up/down
|
||||
beq @SkipY ;
|
||||
|
||||
@ -499,5 +485,5 @@ IRQ: jsr CPREP
|
||||
clc ; Interrupt not "handled"
|
||||
rts
|
||||
|
||||
.define OLD_BUTTONS Temp ; tells callback.inc where the old port status is stored
|
||||
.define OLD_BUTTONS Buttons ; tells callback.inc where the old port status is stored
|
||||
.include "callback.inc"
|
||||
|
@ -4,7 +4,7 @@
|
||||
;
|
||||
; Christian Groessler, 24.04.2014
|
||||
;
|
||||
; Check if there was joystick activity before and/or after the ROM handler.
|
||||
; Check if there was button/joystick activity before and/or after the ROM handler.
|
||||
; If there was activity, discard the key presses since they are most
|
||||
; probably "phantom" key presses.
|
||||
|
||||
|
@ -1,7 +1,11 @@
|
||||
;
|
||||
; Pointer for library references by device drivers.
|
||||
;
|
||||
; Helper-routines for the interrupt handler that rejects bogus keypresses
|
||||
; that are caused by mouse-like devices.
|
||||
;
|
||||
; 2013-07-25, Greg King
|
||||
; 2014-04-26, Christian Groessler
|
||||
;
|
||||
|
||||
.include "c128.inc"
|
||||
@ -23,6 +27,7 @@ mouse_libref: ; generic label for mouse-kernel
|
||||
;
|
||||
_pen_adjuster:
|
||||
.addr $0000
|
||||
|
||||
.addr IRQStub2
|
||||
callback: ; callback into mouse driver after ROM IRQ handler has been run
|
||||
.addr $0000 ; (filled in by mouse driver)
|
||||
@ -83,7 +88,7 @@ IRQStub2:
|
||||
rts ; jump to callback routine
|
||||
|
||||
@IRQCont2:
|
||||
|
||||
|
||||
; return from interrupt
|
||||
; We could just jump to $FF33, but since I don't know whether this address is valid in all
|
||||
; ROM versions, duplicate that code here.
|
||||
|
Loading…
x
Reference in New Issue
Block a user