From: cuz Date: Sat, 8 Sep 2001 15:35:13 +0000 (+0000) Subject: Polishing the mouse stuff X-Git-Tag: V2.12.0~2708 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2760787727e27c8d943cb4fba9efb7eff48ca96e;p=cc65 Polishing the mouse stuff git-svn-id: svn://svn.cc65.org/cc65/trunk@871 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/atari/mouse.s b/libsrc/atari/mouse.s index bf108ce6d..307548fc4 100644 --- a/libsrc/atari/mouse.s +++ b/libsrc/atari/mouse.s @@ -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 diff --git a/libsrc/c128/mouse.s b/libsrc/c128/mouse.s index 921461bae..bef73a6f2 100644 --- a/libsrc/c128/mouse.s +++ b/libsrc/c128/mouse.s @@ -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 diff --git a/libsrc/c64/mouse.s b/libsrc/c64/mouse.s index 81ffa04ff..aeed9b911 100644 --- a/libsrc/c64/mouse.s +++ b/libsrc/c64/mouse.s @@ -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 @@ -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