Fixed multiple clicks between mouse-moves not being detected on //c

This commit is contained in:
Quinn Dunki 2015-07-16 16:10:27 -05:00
parent 0f6ab21293
commit 894dcd5afb
3 changed files with 34 additions and 3 deletions

Binary file not shown.

37
mouse.s
View File

@ -51,7 +51,7 @@ MOUSEMODE_OFF = $00 ; Mouse off
MOUSEMODE_PASSIVE = $01 ; Passive mode (polling only)
MOUSEMODE_MOVEINT = $03 ; Interrupts on movement
MOUSEMODE_BUTINT = $05 ; Interrupts on button
MOUSEMODE_COMBINT = $07 ; Interrupts on movement and button
MOUSEMODE_COMBINT = $0f ; Interrupts on VBL, movement and button
; Mouse firmware is all indirectly called, because
@ -185,6 +185,9 @@ WGDisableMouse:
stz WG_MOUSEACTIVE
lda #MOUSEMODE_OFF ; Disable VBL manually
CALLMOUSE SETMOUSE
; Remove our interrupt handler via ProDOS (done playing nice!)
lda WG_PRODOS_ALLOC+1 ; Copy interrupt ID that ProDOS gave us
sta WG_PRODOS_DEALLOC+1
@ -315,8 +318,10 @@ WGMouseInterruptHandler:
SAVE_AXY
CALLMOUSE SERVEMOUSE
bcs WGMouseInterruptHandler_disregard
bcc WGMouseInterruptHandler_regard
jmp WGMouseInterruptHandler_disregard
WGMouseInterruptHandler_regard:
php
sei
@ -329,6 +334,12 @@ WGMouseInterruptHandler:
and #MOUSTAT_MASK_BUTTONINT
bne WGMouseInterruptHandler_button
lda MOUSTAT,x
and #MOUSTAT_MASK_MOVEINT
bne WGMouseInterruptHandler_mouse
jmp WGMouseInterruptHandler_VBL
WGMouseInterruptHandler_mouse:
jsr WGUndrawPointer ; Erase the old mouse pointer
; Read the mouse state. Note that interrupts need to remain
@ -392,9 +403,15 @@ WGMouseInterruptHandler_button:
bit WG_MOUSE_STAT ; Check for rising edge of button state
bpl WGMouseInterruptHandler_intDone
bvs WGMouseInterruptHandler_intDone ; Held, so ignore (//c only, but more elegant code to leave in for both)
lda WG_MOUSE_BUTTON_DOWN
bne WGMouseInterruptHandler_intDone
WGMouseInterruptHandler_buttonDown:
; Button went down, so make a note of location for later
lda #1
sta WG_MOUSE_BUTTON_DOWN
lda WG_MOUSEPOS_X
sta WG_MOUSECLICK_X
lda WG_MOUSEPOS_Y
@ -406,6 +423,17 @@ WGMouseInterruptHandler_intDone:
SETSWITCH PAGE2ON
bra WGMouseInterruptHandler_done
WGMouseInterruptHandler_VBL:
CALLMOUSE READMOUSE
ldx WG_MOUSE_SLOT
lda MOUSTAT,x ; Movement/button status bits are now valid
sta WG_MOUSE_STAT
bmi WGMouseInterruptHandler_intDone
stz WG_MOUSE_BUTTON_DOWN
bra WGMouseInterruptHandler_intDone
WGMouseInterruptHandler_intDoneBankOff:
SETSWITCH PAGE2OFF
@ -598,6 +626,9 @@ WG_MOUSECLICK_X:
.byte $ff
WG_MOUSECLICK_Y:
.byte 0
WG_MOUSE_BUTTON_DOWN:
.byte 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ProDOS system call parameter blocks

Binary file not shown.