mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 19:29:37 +00:00
fix bug where the high byte of X and Y positions were destroyed of
the user had lifted the pen
This commit is contained in:
parent
ecd10e632a
commit
1fd7c2b318
@ -89,6 +89,8 @@ visible: .res 1
|
|||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
|
; (We use ".proc" because we want to define both a label and a scope.)
|
||||||
|
|
||||||
.proc DefVars
|
.proc DefVars
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
.word SCREEN_WIDTH/2 ; XPos
|
.word SCREEN_WIDTH/2 ; XPos
|
||||||
@ -328,14 +330,12 @@ IRQ:
|
|||||||
; Check for a pressed button and place the result into Buttons
|
; Check for a pressed button and place the result into Buttons
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
stx XPos+1
|
|
||||||
stx YPos+1
|
|
||||||
stx Buttons
|
stx Buttons
|
||||||
|
|
||||||
lda PORTA ; get other buttons
|
lda PORTA ; get other buttons
|
||||||
eor #255
|
eor #255
|
||||||
tax
|
tax
|
||||||
and #5 ; pen button and left button are mapped to left mouse button
|
and #5 ; pen button and left button are mapped to left mouse button
|
||||||
beq @L01
|
beq @L01
|
||||||
lda #MOUSE_BTN_LEFT
|
lda #MOUSE_BTN_LEFT
|
||||||
ora Buttons
|
ora Buttons
|
||||||
@ -350,18 +350,22 @@ IRQ:
|
|||||||
; If we read 228 for X or Y positions, we assume the user has lifted the pen
|
; If we read 228 for X or Y positions, we assume the user has lifted the pen
|
||||||
; and don't change the cursor position.
|
; and don't change the cursor position.
|
||||||
|
|
||||||
@L02: lda PADDL0
|
@L02: lda PADDL0
|
||||||
cmp #228
|
cmp #228
|
||||||
beq @Dont
|
beq @Dont
|
||||||
lda PADDL1
|
lda PADDL1
|
||||||
cmp #228
|
cmp #228
|
||||||
bne @Do
|
bne @Do
|
||||||
@Dont: jmp @Done
|
@Dont: jmp @Done
|
||||||
|
|
||||||
@Do: lda visible
|
@Do: lda visible
|
||||||
beq @L03
|
beq @L03
|
||||||
jsr CHIDE
|
jsr CHIDE
|
||||||
|
|
||||||
|
@L03: ldx #0
|
||||||
|
stx XPos+1
|
||||||
|
stx YPos+1
|
||||||
|
|
||||||
; Get cursor position
|
; Get cursor position
|
||||||
; -------------------
|
; -------------------
|
||||||
; The touch pad is read thru the paddle potentiometers. The possible
|
; The touch pad is read thru the paddle potentiometers. The possible
|
||||||
@ -378,7 +382,7 @@ IRQ:
|
|||||||
|
|
||||||
; X
|
; X
|
||||||
|
|
||||||
@L03: ldx PADDL0 ; get X postion
|
ldx PADDL0 ; get X postion
|
||||||
dex ; decrement, since it's 1-based
|
dex ; decrement, since it's 1-based
|
||||||
stx XPos
|
stx XPos
|
||||||
txa
|
txa
|
||||||
|
Loading…
Reference in New Issue
Block a user