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:
@@ -1,5 +1,5 @@
|
||||
;
|
||||
; Default mouse callbacks for the C64
|
||||
; Default mouse callbacks for the C128
|
||||
;
|
||||
; Ullrich von Bassewitz, 2004-03-20
|
||||
;
|
||||
@@ -48,6 +48,24 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||
|
||||
.endproc
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Draw the mouse pointer. Always called with interrupts disabled.
|
||||
|
||||
.proc draw
|
||||
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Prepare to move the mouse pointer. Always called with interrupts disabled.
|
||||
|
||||
.proc move
|
||||
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Move the mouse pointer X position to the value in a/x. Always called with
|
||||
; interrupts disabled.
|
||||
@@ -103,7 +121,7 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||
_mouse_def_callbacks:
|
||||
.addr hide
|
||||
.addr show
|
||||
.addr draw
|
||||
.addr move
|
||||
.addr movex
|
||||
.addr movey
|
||||
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ HEADER:
|
||||
|
||||
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
|
||||
|
||||
@@ -302,7 +304,8 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
; MUST return carry clear.
|
||||
;
|
||||
|
||||
IRQ: lda SID_ADConv1 ; Get mouse X movement
|
||||
IRQ: jsr CMOVE
|
||||
lda SID_ADConv1 ; Get mouse X movement
|
||||
ldy OldPotX
|
||||
jsr MoveCheck ; Calculate movement vector
|
||||
sty OldPotX
|
||||
@@ -389,8 +392,9 @@ IRQ: lda SID_ADConv1 ; Get mouse X movement
|
||||
|
||||
; Done
|
||||
|
||||
clc ; Interrupt not "handled"
|
||||
@SkipY: rts
|
||||
@SkipY: jsr CDRAW
|
||||
clc ; Interrupt not "handled"
|
||||
rts
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
;
|
||||
|
||||
@@ -49,6 +49,8 @@ LIBREF: .addr $0000
|
||||
|
||||
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 co-ord.
|
||||
CMOVEY: jmp $0000 ; Move the cursor to Y co-ord.
|
||||
|
||||
@@ -343,7 +345,7 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
|
||||
; MUST return carry clear.
|
||||
;
|
||||
|
||||
IRQ:
|
||||
IRQ: jsr CMOVE
|
||||
|
||||
; Record the state of the buttons.
|
||||
; Try to avoid crosstalk between the keyboard and the lightpen.
|
||||
@@ -441,7 +443,8 @@ IRQ:
|
||||
|
||||
; Done
|
||||
|
||||
@SkipX: clc ; Interrupt not "handled"
|
||||
@SkipX: jsr CDRAW
|
||||
clc ; Interrupt not "handled"
|
||||
rts
|
||||
|
||||
; Move the lightpen pointer to the new Y pos.
|
||||
|
||||
@@ -49,6 +49,8 @@ HEADER:
|
||||
|
||||
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
|
||||
|
||||
@@ -302,7 +304,8 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
; MUST return carry clear.
|
||||
;
|
||||
|
||||
IRQ: lda #$7F
|
||||
IRQ: jsr CMOVE
|
||||
lda #$7F
|
||||
sta CIA1_PRA
|
||||
lda CIA1_PRB ; Read joystick #0
|
||||
and #$1F
|
||||
@@ -415,6 +418,6 @@ IRQ: lda #$7F
|
||||
|
||||
; Done
|
||||
|
||||
@SkipY: clc ; Interrupt not "handled"
|
||||
@SkipY: jsr CDRAW
|
||||
clc ; Interrupt not "handled"
|
||||
rts
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ HEADER:
|
||||
|
||||
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
|
||||
|
||||
@@ -297,7 +299,8 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
; (so be careful).
|
||||
;
|
||||
|
||||
IRQ: lda #$7F
|
||||
IRQ: jsr CMOVE
|
||||
lda #$7F
|
||||
sta CIA1_PRA
|
||||
lda CIA1_PRB ; Read port #1
|
||||
and #%00001100
|
||||
@@ -392,4 +395,7 @@ IRQ: lda #$7F
|
||||
; Move the mouse pointer to the new X pos
|
||||
|
||||
tya
|
||||
jmp CMOVEY
|
||||
jsr CMOVEY
|
||||
jsr CDRAW
|
||||
clc ; Interrupt not "handled"
|
||||
rts
|
||||
|
||||
Reference in New Issue
Block a user