From f6411df3025f10bd40df6ea35ad95407dd669ed0 Mon Sep 17 00:00:00 2001 From: Quinn Dunki Date: Thu, 16 Jul 2015 15:24:59 -0500 Subject: [PATCH] Fixed problem with subsequent click detection not working if mouse doesn't move --- README.md | 3 ++- V2Make.scpt | Bin 3694 -> 3694 bytes mouse.s | 35 +++++++++++++++++++++++++++++++---- mousedemo.dsk | Bin 143360 -> 143360 bytes 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1727076..46ce2b4 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Supports the Apple //e Enhanced with a mouse card in any slot. Also supports App Known issues ------------ -- Subsequent clicks will not be detected if the mouse doesn't move in between +- On Apple //c, mouse movement is ignored while button is down + diff --git a/V2Make.scpt b/V2Make.scpt index 2e09260f5e81a741db380ddb1c45f9b8cd709f08..39b1a324c8deb04ba5ba7c3b694304a055ad272b 100644 GIT binary patch delta 29 lcmaDS^G;?%1{ZtyExrpc&azL==dxqD@KP~-^G2?{%mBr?48{Ne delta 29 lcmaDS^G;?%1{b?P<;`;^8(JpkbJ?++J9*{F=8ar?nE}pp4h8@K diff --git a/mouse.s b/mouse.s index 998b2ab..61c6279 100644 --- a/mouse.s +++ b/mouse.s @@ -59,6 +59,7 @@ MOUSE_ZEROL = $0478 ; Zero value of mouse (LSB). Slot independent. MOUSE_ZEROH = $0578 ; Zero value of mouse (MSB). Slot independent. MOUSTAT_MASK_BUTTONINT = %00000100 +MOUSTAT_MASK_VBLINT = %00001000 MOUSTAT_MASK_MOVEINT = %00000010 MOUSTAT_MASK_DOWN = %10000000 MOUSTAT_MASK_WASDOWN = %01000000 @@ -68,7 +69,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 @@ -330,8 +331,10 @@ WGMouseInterruptHandler: SAVE_AXY CALLMOUSE SERVEMOUSE - bcs WGMouseInterruptHandler_disregard + bcc WGMouseInterruptHandler_regard + jmp WGMouseInterruptHandler_disregard +WGMouseInterruptHandler_regard: php sei @@ -344,6 +347,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 @@ -409,9 +418,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 @@ -423,6 +438,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 @@ -488,7 +514,8 @@ WG_MOUSE_SLOT: .byte 0 WG_MOUSE_SLOTSHIFTED: .byte 0 - +WG_MOUSE_BUTTON_DOWN: +.byte 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ProDOS system call parameter blocks diff --git a/mousedemo.dsk b/mousedemo.dsk index 246e53edb732fc70d8c0b81deb006a2bec4a5f80..10fe999353202d4892982bab37efc3f781ab67e3 100644 GIT binary patch delta 494 zcmZp8z|ru4V?#Q(Kpzvs2RTuG28PEB2_VMia_&y=dX~5!taU%2V{d!X+M1-^x}>$W zNxk(+83Izhp$8fyP&F95nA4ur@VGbR0MIZEiG+j%26gWLj0~GY!y6bkMRGA~S0}CQ zOzQ1TQefEc*psACnUs;xrTOBtRZ8sQ0)pPQB#8!=Iju<+K=j}qxd6n!2^Xvd z39hY6GT?{EECk8?@2#6`9jj&61oEFlN79ApIW)fQ7$*xbX>W?;V%82!S{s+to0O!$u-`E;Nx?rUBcV?*aUH{vzQ`nw3I*Lnjf8bk zNo!(~av~?2#yAB=C#^id8=ce}mDH=0*u@0|y)j7=4J>n_lPrKPx#4juYLPI|H5)28 zD%Q#z@aPRW0CAWm%Y{s!@u*H+8<8~m{yYh$prpzDhvlpld=pmQP>@zkaEML15IrX-X-;s`obaSYk|4); zFA@b(E7=zb0jW6^tScFMD_B-CE)oZcGJvVI5tA3kYA^;)J`=0K9hel+a0TS{wSmq5 MW4Hg0Wn{br03vOv-v9sr