Some fine tuning of the mouse driver interface harmonization.

This commit is contained in:
Oliver Schmidt
2014-01-17 21:09:15 +01:00
parent 4065cb1983
commit 94eb2a2ed7
18 changed files with 94 additions and 134 deletions

View File

@@ -22,55 +22,41 @@ MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask
VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
.code
; --------------------------------------------------------------------------
; Hide the mouse pointer. Always called with interrupts disabled.
.proc hide
hide:
lda #MOUSE_SPR_NMASK
and VIC_SPR_ENA
sta VIC_SPR_ENA
rts
.endproc
; --------------------------------------------------------------------------
; Show the mouse pointer. Always called with interrupts disabled.
.proc show
show:
lda #MOUSE_SPR_MASK
ora VIC_SPR_ENA
sta VIC_SPR_ENA
rts
.endproc
; --------------------------------------------------------------------------
; Draw the mouse pointer. Always called with interrupts disabled.
.proc draw
rts
.endproc
; Fall through
; --------------------------------------------------------------------------
; Prepare to move the mouse pointer. Always called with interrupts disabled.
.proc move
prep:
; Fall through
; --------------------------------------------------------------------------
; Draw the mouse pointer. Always called with interrupts disabled.
draw:
rts
.endproc
; --------------------------------------------------------------------------
; Move the mouse pointer X position to the value in a/x. Always called with
; interrupts disabled.
.proc movex
movex:
; Add the X correction and set the low byte. This frees A.
@@ -92,27 +78,22 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
sta VIC_SPR_HI_X
rts
.endproc
; --------------------------------------------------------------------------
; Move the mouse pointer Y position to the value in a/x. Always called with
; interrupts disabled.
.proc movey
movey:
clc
ldx PALFLAG
bne @L1
bne @L2
adc #50 ; FIXME: Should be NTSC, is PAL value
sta VIC_SPR_Y ; Set Y position
rts
@L1: adc #50 ; Add PAL correction
@L2: adc #50 ; Add PAL correction
sta VIC_SPR_Y ; Set Y position
rts
.endproc
; --------------------------------------------------------------------------
; Callback structure
@@ -121,7 +102,7 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
_mouse_def_callbacks:
.addr hide
.addr show
.addr prep
.addr draw
.addr move
.addr movex
.addr movey

View File

@@ -50,8 +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
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
@@ -304,7 +304,7 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
; MUST return carry clear.
;
IRQ: jsr CMOVE
IRQ: jsr CPREP
lda SID_ADConv1 ; Get mouse X movement
ldy OldPotX
jsr MoveCheck ; Calculate movement vector

View File

@@ -49,8 +49,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
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.
@@ -345,7 +345,7 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
; MUST return carry clear.
;
IRQ: jsr CMOVE
IRQ: jsr CPREP
; Record the state of the buttons.
; Try to avoid crosstalk between the keyboard and the lightpen.

View File

@@ -49,8 +49,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
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
@@ -304,7 +304,7 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
; MUST return carry clear.
;
IRQ: jsr CMOVE
IRQ: jsr CPREP
lda #$7F
sta CIA1_PRA
lda CIA1_PRB ; Read joystick #0

View File

@@ -46,8 +46,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
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
@@ -299,7 +299,7 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
; (so be careful).
;
IRQ: jsr CMOVE
IRQ: jsr CPREP
lda #$7F
sta CIA1_PRA
lda CIA1_PRB ; Read port #1