mirror of
https://github.com/cc65/cc65.git
synced 2025-02-21 20:29:17 +00:00
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
@ -122,7 +122,7 @@ setup: tax
|
|||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
lda #1
|
lda #1
|
||||||
stx mouse_on
|
sta mouse_off
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;--------------------------------------------------------------------
|
;--------------------------------------------------------------------
|
||||||
@ -150,10 +150,11 @@ _mouse_done:
|
|||||||
ldx vbi_jmp+2
|
ldx vbi_jmp+2
|
||||||
jsr SETVBV
|
jsr SETVBV
|
||||||
|
|
||||||
lda #0
|
ldx #0
|
||||||
sta GRACTL
|
stx GRACTL
|
||||||
sta HPOSP0
|
stx HPOSP0
|
||||||
sta mouse_on
|
inx
|
||||||
|
stx mouse_off
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;--------------------------------------------------------------------
|
;--------------------------------------------------------------------
|
||||||
@ -185,18 +186,18 @@ _mouse_move:
|
|||||||
; void mouse_show(void)
|
; void mouse_show(void)
|
||||||
|
|
||||||
_mouse_show:
|
_mouse_show:
|
||||||
inc mouse_on
|
lda mouse_off ; Already on?
|
||||||
rts
|
beq @L1
|
||||||
|
dec mouse_off
|
||||||
|
@L1: rts
|
||||||
|
|
||||||
;--------------------------------------------------------------------
|
;--------------------------------------------------------------------
|
||||||
; Hide mouse arrow
|
; Hide mouse arrow
|
||||||
; void mouse_hide(void)
|
; void mouse_hide(void)
|
||||||
|
|
||||||
_mouse_hide:
|
_mouse_hide:
|
||||||
lda mouse_on
|
inc mouse_off
|
||||||
beq @L1
|
rts
|
||||||
dec mouse_on
|
|
||||||
@L1: rts
|
|
||||||
|
|
||||||
;--------------------------------------------------------------------
|
;--------------------------------------------------------------------
|
||||||
; Ask mouse button
|
; Ask mouse button
|
||||||
@ -441,8 +442,8 @@ ok3: lda ymax
|
|||||||
|
|
||||||
ok4: jsr clrpm
|
ok4: jsr clrpm
|
||||||
|
|
||||||
lda mouse_on
|
lda mouse_off
|
||||||
bne mon
|
beq mon
|
||||||
lda #0
|
lda #0
|
||||||
sta HPOSP0
|
sta HPOSP0
|
||||||
beq moff
|
beq moff
|
||||||
@ -590,7 +591,7 @@ dumx: .res 1
|
|||||||
dumy: .res 1
|
dumy: .res 1
|
||||||
omy: .res 1 ; old y pos
|
omy: .res 1 ; old y pos
|
||||||
|
|
||||||
mouse_on:
|
mouse_off:
|
||||||
.res 1
|
.res 1
|
||||||
port_nr:
|
port_nr:
|
||||||
.res 1
|
.res 1
|
||||||
|
@ -57,7 +57,7 @@ _mouse_init:
|
|||||||
sta YMax
|
sta YMax
|
||||||
stx YMax+1 ; YMax = 250
|
stx YMax+1 ; YMax = 250
|
||||||
inx ; X = 1
|
inx ; X = 1
|
||||||
stx Visible ; Mouse *not* visible
|
stx Invisible ; Mouse *not* visible
|
||||||
lda #<344
|
lda #<344
|
||||||
sta XMax
|
sta XMax
|
||||||
stx XMax+1 ; XMax = 344
|
stx XMax+1 ; XMax = 344
|
||||||
@ -105,7 +105,7 @@ Done: rts
|
|||||||
;
|
;
|
||||||
|
|
||||||
_mouse_hide:
|
_mouse_hide:
|
||||||
lda Visible ; Get the flag
|
lda Invisible ; Get the flag
|
||||||
bne @L1 ; Jump if already invisible
|
bne @L1 ; Jump if already invisible
|
||||||
ldx MouseSprite ; Sprite defined?
|
ldx MouseSprite ; Sprite defined?
|
||||||
beq @L1 ; Jump if no
|
beq @L1 ; Jump if no
|
||||||
@ -117,7 +117,7 @@ _mouse_hide:
|
|||||||
sta VIC_SPR_ENA ; Disable sprite
|
sta VIC_SPR_ENA ; Disable sprite
|
||||||
cli ; Enable interrupts
|
cli ; Enable interrupts
|
||||||
|
|
||||||
@L1: inc Visible ; Set the flag to invisible
|
@L1: inc Invisible ; Set the flag to invisible
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
@ -126,9 +126,9 @@ _mouse_hide:
|
|||||||
;
|
;
|
||||||
|
|
||||||
_mouse_show:
|
_mouse_show:
|
||||||
lda Visible ; Mouse already visible?
|
lda Invisible ; Mouse invisible?
|
||||||
beq @L1 ; Jump if yes
|
beq @L1 ; Jump if no
|
||||||
dec Visible ; Get the flag
|
dec Invisible ; Set the flag
|
||||||
bne @L1 ; Jump if still invisible
|
bne @L1 ; Jump if still invisible
|
||||||
ldx MouseSprite ; Sprite defined?
|
ldx MouseSprite ; Sprite defined?
|
||||||
beq @L1 ; Jump if no
|
beq @L1 ; Jump if no
|
||||||
@ -392,7 +392,7 @@ MoveCheck:
|
|||||||
|
|
||||||
MoveSprite:
|
MoveSprite:
|
||||||
|
|
||||||
lda Visible ; Mouse visible?
|
lda Invisible ; Mouse visible?
|
||||||
bne MoveSpriteDone ; Jump if no
|
bne MoveSpriteDone ; Jump if no
|
||||||
ldx MouseSprite ; Sprite defined?
|
ldx MouseSprite ; Sprite defined?
|
||||||
beq MoveSpriteDone ; Jump if no
|
beq MoveSpriteDone ; Jump if no
|
||||||
@ -438,7 +438,7 @@ MouseSprite: .res 1 ; Number of sprite to control
|
|||||||
OldValue: .res 1 ; Temp for MoveCheck routine
|
OldValue: .res 1 ; Temp for MoveCheck routine
|
||||||
NewValue: .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
|
OldPotX: .res 1 ; Old hw counter values
|
||||||
OldPotY: .res 1
|
OldPotY: .res 1
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ _mouse_init:
|
|||||||
sta YMax
|
sta YMax
|
||||||
stx YMax+1 ; YMax = 250
|
stx YMax+1 ; YMax = 250
|
||||||
inx ; X = 1
|
inx ; X = 1
|
||||||
stx Visible ; Mouse *not* visible
|
stx Invisible ; Mouse *not* visible
|
||||||
lda #<344
|
lda #<344
|
||||||
sta XMax
|
sta XMax
|
||||||
stx XMax+1 ; XMax = 344
|
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:
|
; 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,
|
; 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
|
; 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
|
ldx #<MouseIRQ
|
||||||
lda #>MouseIRQ
|
lda #>MouseIRQ
|
||||||
@ -105,7 +105,7 @@ Done: rts
|
|||||||
;
|
;
|
||||||
|
|
||||||
_mouse_hide:
|
_mouse_hide:
|
||||||
lda Visible ; Get the flag
|
lda Invisible ; Get the flag
|
||||||
bne @L1 ; Jump if already invisible
|
bne @L1 ; Jump if already invisible
|
||||||
ldx MouseSprite ; Sprite defined?
|
ldx MouseSprite ; Sprite defined?
|
||||||
beq @L1 ; Jump if no
|
beq @L1 ; Jump if no
|
||||||
@ -117,7 +117,7 @@ _mouse_hide:
|
|||||||
sta VIC_SPR_ENA ; Disable sprite
|
sta VIC_SPR_ENA ; Disable sprite
|
||||||
cli ; Enable interrupts
|
cli ; Enable interrupts
|
||||||
|
|
||||||
@L1: inc Visible ; Set the flag to invisible
|
@L1: inc Invisible ; Set the flag to invisible
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
@ -126,9 +126,9 @@ _mouse_hide:
|
|||||||
;
|
;
|
||||||
|
|
||||||
_mouse_show:
|
_mouse_show:
|
||||||
lda Visible ; Mouse already visible?
|
lda Invisible ; Mouse invisible?
|
||||||
beq @L1 ; Jump if yes
|
beq @L1 ; Jump if no
|
||||||
dec Visible ; Get the flag
|
dec Invisible ; Set the flag
|
||||||
bne @L1 ; Jump if still invisible
|
bne @L1 ; Jump if still invisible
|
||||||
ldx MouseSprite ; Sprite defined?
|
ldx MouseSprite ; Sprite defined?
|
||||||
beq @L1 ; Jump if no
|
beq @L1 ; Jump if no
|
||||||
@ -392,7 +392,7 @@ MoveCheck:
|
|||||||
|
|
||||||
MoveSprite:
|
MoveSprite:
|
||||||
|
|
||||||
lda Visible ; Mouse visible?
|
lda Invisible ; Mouse visible?
|
||||||
bne MoveSpriteDone ; Jump if no
|
bne MoveSpriteDone ; Jump if no
|
||||||
ldx MouseSprite ; Sprite defined?
|
ldx MouseSprite ; Sprite defined?
|
||||||
beq MoveSpriteDone ; Jump if no
|
beq MoveSpriteDone ; Jump if no
|
||||||
@ -438,7 +438,7 @@ MouseSprite: .res 1 ; Number of sprite to control
|
|||||||
OldValue: .res 1 ; Temp for MoveCheck routine
|
OldValue: .res 1 ; Temp for MoveCheck routine
|
||||||
NewValue: .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
|
OldPotX: .res 1 ; Old hw counter values
|
||||||
OldPotY: .res 1
|
OldPotY: .res 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user