From: Christian Groessler Date: Fri, 17 Jan 2014 23:02:29 +0000 (+0100) Subject: Adapt to new mouse driver interface ('prep' and 'draw') X-Git-Tag: V2.15~196^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=refs%2Fpull%2F69%2Fhead;p=cc65 Adapt to new mouse driver interface ('prep' and 'draw') --- diff --git a/libsrc/atari/mcbdefault.s b/libsrc/atari/mcbdefault.s index 11b7e07be..ac5056cf9 100644 --- a/libsrc/atari/mcbdefault.s +++ b/libsrc/atari/mcbdefault.s @@ -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 diff --git a/libsrc/atari/mou/atrjoy.s b/libsrc/atari/mou/atrjoy.s index 2c2d2c178..aa61615ad 100644 --- a/libsrc/atari/mou/atrjoy.s +++ b/libsrc/atari/mou/atrjoy.s @@ -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 diff --git a/libsrc/atari/mou/atrst.s b/libsrc/atari/mou/atrst.s index 03f9f0b53..116cecee2 100644 --- a/libsrc/atari/mou/atrst.s +++ b/libsrc/atari/mou/atrst.s @@ -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 ;