1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-19 06:31:31 +00:00

Debugged the mouse routines

git-svn-id: svn://svn.cc65.org/cc65/trunk@342 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-09-26 19:44:44 +00:00
parent 9633ff1882
commit c15fb9b50f

View File

@ -16,6 +16,8 @@
.include "c64.inc"
.macpack generic
.code
; --------------------------------------------------------------------------
@ -43,17 +45,18 @@ _mouse_init:
stx OldPotX
stx OldPotY
stx XMin
stx XMin+1
stx YMin
stx YMin+1
stx YMax+1
stx XMin+1 ; XMin = 0
lda #29
sta YMin
stx YMin+1 ; YMin = 29
lda #250
sta YMax
stx YMax+1 ; YMax = 250
inx ; X = 1
stx Visible ; Mouse *not* visible
stx XMax+1 ; >320
ldx #<320
stx XMax
ldx #200
stx YMax
lda #<344
sta XMax
stx XMax+1 ; XMax = 344
; Remember the old IRQ vector
@ -239,8 +242,7 @@ MouseIRQ:
; Calculate the new X coordinate (--> a/y)
clc
adc XPos
add XPos
tay ; Remember low byte
txa
adc XPos+1
@ -273,11 +275,14 @@ MouseIRQ:
; Calculate the new Y coordinate (--> a/y)
clc
adc YPos
tay ; Remember low byte
txa
adc YPos+1
sta OldValue
lda YPos
sub OldValue
tay
stx OldValue
lda YPos+1
sbc OldValue
tax
cpy YMin
sbc YMin+1
@ -319,8 +324,7 @@ MoveCheck:
sta NewValue
ldx #$00
sec ; a = mod64 (new - old)
sbc OldValue
sub OldValue ; a = mod64 (new - old)
and #%01111111
cmp #%01000000 ; if (a > 0)
bcs @L1 ;
@ -334,11 +338,11 @@ MoveCheck:
beq @L2
sec
ror a ; a /= 2
ldx #$FF ; high byte = -1
dex ; high byte = -1 (X = $FF)
ldy NewValue
rts
@L2: lda #0
@L2: txa ; A = $00
rts
; --------------------------------------------------------------------------