1
0
mirror of https://github.com/cc65/cc65.git synced 2026-04-21 09:17:52 +00:00

Harmonized interface between mouse drivers and callbacks.

The Apple2 doesn't have sprites so the Apple2 mouse callbacks place a special character on the text screen to indicate the mouse position. In order to support the necessary character removing and redrawing the Apple2 mouse driver called the Apple2 mouse callbacks in an "unusual way". So far so (sort of) good.

However the upcoming Atari mouse driver aims to support both "sprite-type" mouse callbacks as well as "text-char-type" mouse callbacks. Therefore the interface between mouse drivers and callbacks needs to be extended to allow the mouse callbacks to hide their different types from the mouse driver.

The nature of this change can be seen best by looking at the Apple2 file modifications. The CBM drivers and callbacks (at least the current ones) don't benefit from this change.
This commit is contained in:
Oliver Schmidt
2014-01-15 22:47:59 +01:00
parent b1c8f8e714
commit 4065cb1983
16 changed files with 158 additions and 46 deletions
+16 -1
View File
@@ -16,6 +16,7 @@
.bss
backup: .res 1
visible:.res 1
; ------------------------------------------------------------------------
@@ -25,6 +26,8 @@ backup: .res 1
_mouse_def_callbacks:
.addr hide
.addr show
.addr draw
.addr move
.addr movex
.addr movey
@@ -65,10 +68,15 @@ done:
.ifdef __APPLE2ENH__
bit LOWSCR ; Doesn't hurt in 40 column mode
.endif
rts
return: rts
; Hide the mouse cursor.
hide:
dec visible
; Fall through
; Prepare to move the mouse cursor.
move:
jsr getcursor ; Cursor visible at current position?
bne done ; No, we're done
lda backup ; Get character at cursor position
@@ -76,6 +84,13 @@ hide:
; Show the mouse cursor.
show:
inc visible
; Fall through
; Draw the mouse cursor.
draw:
lda visible
beq return
jsr getcursor ; Cursor visible at current position?
beq done ; Yes, we're done
sta backup ; Save character at cursor position
+8 -10
View File
@@ -57,6 +57,8 @@ status := $0778
; Callback table, set by the kernel before INSTALL is called
CHIDE: jmp $0000 ; Hide the cursor
CSHOW: jmp $0000 ; Show the cursor
CDRAW: jmp $0000 ; Draw the cursor
CMOVE: jmp $0000 ; Prepare to move the cursor
CMOVEX: jmp $0000 ; Move the cursor to X coord
CMOVEY: jmp $0000 ; Move the cursor to Y coord
@@ -67,7 +69,6 @@ CMOVEY: jmp $0000 ; Move the cursor to Y coord
box: .tag MOUSE_BOX
info: .tag MOUSE_INFO
slot: .res 1
visible:.res 1
; ------------------------------------------------------------------------
@@ -321,7 +322,6 @@ MOVE:
; no special action is required besides hiding the mouse cursor.
; No return code required.
HIDE:
dec visible
sei
jsr CHIDE
cli
@@ -333,7 +333,9 @@ HIDE:
; no special action is required besides enabling the mouse cursor.
; No return code required.
SHOW:
inc visible
sei
jsr CSHOW
cli
rts
; BUTTONS: Return the button mask in A/X.
@@ -409,7 +411,7 @@ done: rts
beq :+
; Remove the cursor at the old position
update: jsr CHIDE
update: jsr CMOVE
; Get and set the new X position
ldy slot
@@ -427,11 +429,7 @@ update: jsr CHIDE
stx info + MOUSE_POS::YCOORD+1
jsr CMOVEY
; Check for visibility
: lda visible
beq :+
; Draw the cursor at the new position
jsr CSHOW
: sec ; Interrupt handled
: jsr CDRAW
sec ; Interrupt handled
rts