]> git.sur5r.net Git - cc65/commitdiff
Adapt to new mouse driver interface ('prep' and 'draw')
authorChristian Groessler <chris@groessler.org>
Fri, 17 Jan 2014 23:02:29 +0000 (00:02 +0100)
committerChristian Groessler <chris@groessler.org>
Mon, 20 Jan 2014 22:04:30 +0000 (23:04 +0100)
libsrc/atari/mcbdefault.s
libsrc/atari/mou/atrjoy.s
libsrc/atari/mou/atrst.s

index 11b7e07beac0fb3233ffd51c3ef7ac95d17bd4ea..ac5056cf90f0f42840fe75e3c67680e0953ae278 100644 (file)
@@ -21,6 +21,7 @@
         .bss
 
 backup: .res    1
+visible:.res    1
 
 ; ------------------------------------------------------------------------
 
@@ -36,6 +37,8 @@ scrptr: .res    2
 _mouse_def_callbacks:
         .addr   hide
         .addr   show
+        .addr   prep
+        .addr   draw
         .addr   movex
         .addr   movey
 
@@ -66,6 +69,9 @@ done:
 
 ; Hide the mouse cursor.
 hide:
+        dec     visible
+
+prep:
         jsr     getcursor       ; Get character at cursor position
         cmp     #cursor         ; "mouse" character
         bne     overwr          ; no, probably program has overwritten it
@@ -76,6 +82,11 @@ overwr: sta     backup
 
 ; Show the mouse cursor.
 show:
+        inc     visible
+
+draw:
+        lda     visible
+        beq     done
         jsr     getcursor       ; Cursor visible at current position?
         sta     backup          ; Save character at cursor position
         lda     #cursor
index 2c2d2c17834d5bbc8ca361561952f692bc447525..aa61615ada8e1c747611a1b9b2d1fc4cb58be237 100644 (file)
@@ -50,6 +50,8 @@ HEADER:
 
 CHIDE:  jmp     $0000                   ; Hide the cursor
 CSHOW:  jmp     $0000                   ; Show the cursor
+CPREP:  jmp     $0000                   ; Prepare to move the cursor
+CDRAW:  jmp     $0000                   ; Draw the cursor
 CMOVEX: jmp     $0000                   ; Move the cursor to X coord
 CMOVEY: jmp     $0000                   ; Move the cursor to Y coord
 
@@ -85,7 +87,6 @@ Buttons:        .res    1               ; Button mask
 
 
 Temp:           .res    1               ; Temporary value used in the int handler
-visible:        .res    1
 
 ; Default values for above variables
 
@@ -120,9 +121,8 @@ INSTALL:
         dex
         bpl     @L1
 
-; Be sure the mouse cursor is invisible and at the default location.
+; Make sure the mouse cursor is at the default location.
 
-        jsr     CHIDE
         lda     XPos
         ldx     XPos+1
         jsr     CMOVEX
@@ -149,8 +149,7 @@ UNINSTALL       = HIDE                  ; Hide cursor on exit
 ; no special action is required besides hiding the mouse cursor.
 ; No return code required.
 
-HIDE:   dec     visible
-        php
+HIDE:   php
         sei
         jsr     CHIDE
         plp
@@ -163,8 +162,7 @@ HIDE:   dec     visible
 ; no special action is required besides enabling the mouse cursor.
 ; No return code required.
 
-SHOW:   inc     visible
-        php
+SHOW:   php
         sei
         jsr     CSHOW
         plp
@@ -225,7 +223,7 @@ MOVE:   php
         pha
         txa
         pha
-        jsr     CHIDE
+        jsr     CPREP
         pla
         tax
         pla
@@ -241,15 +239,11 @@ MOVE:   php
         dey
         lda     (sp),y
         sta     XPos                    ; New X position
-
         jsr     CMOVEX                  ; Move the cursor
 
-        lda     visible
-        beq     @Ret
-        
-        jsr     CSHOW
+        jsr     CDRAW
 
-@Ret:   plp                             ; Restore interrupt flag
+        plp                             ; Restore interrupt flag
         rts
 
 ;----------------------------------------------------------------------------
@@ -335,7 +329,7 @@ IRQ:
         eor     #15
         sta     Temp
 
-        jsr     CHIDE
+        jsr     CPREP
 
 ; Check left/right
 
@@ -435,11 +429,7 @@ IRQ:
 
 ; Done
 
-@SkipY: lda     visible
-        beq     @Done
-
-        jsr     CSHOW
-
-@Done:  clc                             ; Interrupt not "handled"
+@SkipY: jsr     CDRAW
+        clc                             ; Interrupt not "handled"
         rts
 
index 03f9f0b53ab9e3ebbdedae5684fc53ada67a6f5c..116cecee2f4a573829569bae93305466d00e63c7 100644 (file)
@@ -60,6 +60,8 @@ libref: .addr   $0000
 
 CHIDE:  jmp     $0000                   ; Hide the cursor
 CSHOW:  jmp     $0000                   ; Show the cursor
+CPREP:  jmp     $0000                   ; Prepare to move the cursor
+CDRAW:  jmp     $0000                   ; Draw the cursor
 CMOVEX: jmp     $0000                   ; Move the cursor to X coord
 CMOVEY: jmp     $0000                   ; Move the cursor to Y coord
 
@@ -96,8 +98,6 @@ Buttons:        .res    1               ; Button mask
 XPosWrk:        .res    2
 YPosWrk:        .res    2
 
-visible:        .res    1
-
 .if .defined (AMIGA_MOUSE) .or .defined (ST_MOUSE)
 dumx:           .res    1
 dumy:           .res    1
@@ -170,9 +170,8 @@ INSTALL:
         dex
         bpl     @L1
 
-; Be sure the mouse cursor is invisible and at the default location.
+; Make sure the mouse cursor is at the default location.
 
-        jsr     CHIDE
         lda     XPos
         sta     XPosWrk
         ldx     XPos+1
@@ -276,8 +275,7 @@ UNINSTALL:
 ; no special action is required besides hiding the mouse cursor.
 ; No return code required.
 
-HIDE:   dec     visible
-        php
+HIDE:   php
         sei
         jsr     CHIDE
         plp
@@ -290,8 +288,7 @@ HIDE:   dec     visible
 ; no special action is required besides enabling the mouse cursor.
 ; No return code required.
 
-SHOW:   inc     visible
-        php
+SHOW:   php
         sei
         jsr     CSHOW
         plp
@@ -352,13 +349,8 @@ MOVE:   php
         pha
         txa
         pha
-
-        lda     visible
-        beq     @L01
-
-        jsr     CHIDE
-
-@L01:   pla
+        jsr     CPREP
+        pla
         tax
         pla
 
@@ -377,15 +369,11 @@ MOVE:   php
         lda     (sp),y
         sta     XPos                    ; New X position
         sta     XPosWrk
-
         jsr     CMOVEX                  ; Move the cursor
 
-        lda     visible
-        beq     @Ret
-
-        jsr     CSHOW
+        jsr     CDRAW
 
-@Ret:   plp                             ; Restore interrupt flag
+        plp                             ; Restore interrupt flag
         rts
 
 ;----------------------------------------------------------------------------
@@ -466,13 +454,11 @@ IRQ:
         ldx     #MOUSE_BTN_LEFT
 @L0:    stx     Buttons
 
-        ldx     visible
-        beq     @L1
-        jsr     CHIDE
+        jsr     CPREP
 
 ; Limit the X coordinate to the bounding box
 
-@L1:    lda     XPosWrk+1
+        lda     XPosWrk+1
         ldy     XPosWrk
         tax
         cpy     XMin
@@ -518,14 +504,12 @@ IRQ:
         tya
         jsr     CMOVEY
 
-        ldx     visible
-        beq     @Done
+        jsr     CDRAW
 
-        jsr     CSHOW
-
-@Done:  clc
+        clc
         rts
 
+
 ;----------------------------------------------------------------------------
 ; T1Han: Local IRQ routine to poll mouse
 ;