Polishing the mouse stuff
git-svn-id: svn://svn.cc65.org/cc65/trunk@871 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
e401636c28
commit
2760787727
3 changed files with 34 additions and 33 deletions
|
@ -122,7 +122,7 @@ setup: tax
|
|||
|
||||
ldx #0
|
||||
lda #1
|
||||
stx mouse_on
|
||||
sta mouse_off
|
||||
rts
|
||||
|
||||
;--------------------------------------------------------------------
|
||||
|
@ -150,10 +150,11 @@ _mouse_done:
|
|||
ldx vbi_jmp+2
|
||||
jsr SETVBV
|
||||
|
||||
lda #0
|
||||
sta GRACTL
|
||||
sta HPOSP0
|
||||
sta mouse_on
|
||||
ldx #0
|
||||
stx GRACTL
|
||||
stx HPOSP0
|
||||
inx
|
||||
stx mouse_off
|
||||
rts
|
||||
|
||||
;--------------------------------------------------------------------
|
||||
|
@ -185,18 +186,18 @@ _mouse_move:
|
|||
; void mouse_show(void)
|
||||
|
||||
_mouse_show:
|
||||
inc mouse_on
|
||||
rts
|
||||
lda mouse_off ; Already on?
|
||||
beq @L1
|
||||
dec mouse_off
|
||||
@L1: rts
|
||||
|
||||
;--------------------------------------------------------------------
|
||||
; Hide mouse arrow
|
||||
; void mouse_hide(void)
|
||||
|
||||
_mouse_hide:
|
||||
lda mouse_on
|
||||
beq @L1
|
||||
dec mouse_on
|
||||
@L1: rts
|
||||
inc mouse_off
|
||||
rts
|
||||
|
||||
;--------------------------------------------------------------------
|
||||
; Ask mouse button
|
||||
|
@ -441,8 +442,8 @@ ok3: lda ymax
|
|||
|
||||
ok4: jsr clrpm
|
||||
|
||||
lda mouse_on
|
||||
bne mon
|
||||
lda mouse_off
|
||||
beq mon
|
||||
lda #0
|
||||
sta HPOSP0
|
||||
beq moff
|
||||
|
@ -590,7 +591,7 @@ dumx: .res 1
|
|||
dumy: .res 1
|
||||
omy: .res 1 ; old y pos
|
||||
|
||||
mouse_on:
|
||||
mouse_off:
|
||||
.res 1
|
||||
port_nr:
|
||||
.res 1
|
||||
|
|
|
@ -57,7 +57,7 @@ _mouse_init:
|
|||
sta YMax
|
||||
stx YMax+1 ; YMax = 250
|
||||
inx ; X = 1
|
||||
stx Visible ; Mouse *not* visible
|
||||
stx Invisible ; Mouse *not* visible
|
||||
lda #<344
|
||||
sta XMax
|
||||
stx XMax+1 ; XMax = 344
|
||||
|
@ -105,7 +105,7 @@ Done: rts
|
|||
;
|
||||
|
||||
_mouse_hide:
|
||||
lda Visible ; Get the flag
|
||||
lda Invisible ; Get the flag
|
||||
bne @L1 ; Jump if already invisible
|
||||
ldx MouseSprite ; Sprite defined?
|
||||
beq @L1 ; Jump if no
|
||||
|
@ -117,7 +117,7 @@ _mouse_hide:
|
|||
sta VIC_SPR_ENA ; Disable sprite
|
||||
cli ; Enable interrupts
|
||||
|
||||
@L1: inc Visible ; Set the flag to invisible
|
||||
@L1: inc Invisible ; Set the flag to invisible
|
||||
rts
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
|
@ -126,10 +126,10 @@ _mouse_hide:
|
|||
;
|
||||
|
||||
_mouse_show:
|
||||
lda Visible ; Mouse already visible?
|
||||
beq @L1 ; Jump if yes
|
||||
dec Visible ; Get the flag
|
||||
bne @L1 ; Jump if still invisible
|
||||
lda Invisible ; Mouse invisible?
|
||||
beq @L1 ; Jump if no
|
||||
dec Invisible ; Set the flag
|
||||
bne @L1 ; Jump if still invisible
|
||||
ldx MouseSprite ; Sprite defined?
|
||||
beq @L1 ; Jump if no
|
||||
|
||||
|
@ -392,7 +392,7 @@ MoveCheck:
|
|||
|
||||
MoveSprite:
|
||||
|
||||
lda Visible ; Mouse visible?
|
||||
lda Invisible ; Mouse visible?
|
||||
bne MoveSpriteDone ; Jump if no
|
||||
ldx MouseSprite ; Sprite defined?
|
||||
beq MoveSpriteDone ; Jump if no
|
||||
|
@ -438,7 +438,7 @@ MouseSprite: .res 1 ; Number of sprite to control
|
|||
OldValue: .res 1 ; Temp for MoveCheck routine
|
||||
NewValue: .res 1 ; Temp for MoveCheck routine
|
||||
|
||||
Visible: .res 1 ; Is the mouse visible?
|
||||
Invisible: .res 1 ; Is the mouse invisible?
|
||||
OldPotX: .res 1 ; Old hw counter values
|
||||
OldPotY: .res 1
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ _mouse_init:
|
|||
sta YMax
|
||||
stx YMax+1 ; YMax = 250
|
||||
inx ; X = 1
|
||||
stx Visible ; Mouse *not* visible
|
||||
stx Invisible ; Mouse *not* visible
|
||||
lda #<344
|
||||
sta XMax
|
||||
stx XMax+1 ; XMax = 344
|
||||
|
@ -72,7 +72,7 @@ _mouse_init:
|
|||
; Set our own IRQ vector. We cheat here to save a few bytes of code:
|
||||
; The function is expected to return a value not equal to zero on success,
|
||||
; and since we know that the high byte of the IRQ handler address is never
|
||||
; zweo, we will return just this byte.
|
||||
; zero, we will return just this byte.
|
||||
|
||||
ldx #<MouseIRQ
|
||||
lda #>MouseIRQ
|
||||
|
@ -105,7 +105,7 @@ Done: rts
|
|||
;
|
||||
|
||||
_mouse_hide:
|
||||
lda Visible ; Get the flag
|
||||
lda Invisible ; Get the flag
|
||||
bne @L1 ; Jump if already invisible
|
||||
ldx MouseSprite ; Sprite defined?
|
||||
beq @L1 ; Jump if no
|
||||
|
@ -117,7 +117,7 @@ _mouse_hide:
|
|||
sta VIC_SPR_ENA ; Disable sprite
|
||||
cli ; Enable interrupts
|
||||
|
||||
@L1: inc Visible ; Set the flag to invisible
|
||||
@L1: inc Invisible ; Set the flag to invisible
|
||||
rts
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
|
@ -126,10 +126,10 @@ _mouse_hide:
|
|||
;
|
||||
|
||||
_mouse_show:
|
||||
lda Visible ; Mouse already visible?
|
||||
beq @L1 ; Jump if yes
|
||||
dec Visible ; Get the flag
|
||||
bne @L1 ; Jump if still invisible
|
||||
lda Invisible ; Mouse invisible?
|
||||
beq @L1 ; Jump if no
|
||||
dec Invisible ; Set the flag
|
||||
bne @L1 ; Jump if still invisible
|
||||
ldx MouseSprite ; Sprite defined?
|
||||
beq @L1 ; Jump if no
|
||||
|
||||
|
@ -392,7 +392,7 @@ MoveCheck:
|
|||
|
||||
MoveSprite:
|
||||
|
||||
lda Visible ; Mouse visible?
|
||||
lda Invisible ; Mouse visible?
|
||||
bne MoveSpriteDone ; Jump if no
|
||||
ldx MouseSprite ; Sprite defined?
|
||||
beq MoveSpriteDone ; Jump if no
|
||||
|
@ -438,7 +438,7 @@ MouseSprite: .res 1 ; Number of sprite to control
|
|||
OldValue: .res 1 ; Temp for MoveCheck routine
|
||||
NewValue: .res 1 ; Temp for MoveCheck routine
|
||||
|
||||
Visible: .res 1 ; Is the mouse visible?
|
||||
Invisible: .res 1 ; Is the mouse invisible?
|
||||
OldPotX: .res 1 ; Old hw counter values
|
||||
OldPotY: .res 1
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue