1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-26 20:29:34 +00:00

Merge remote-tracking branch 'upstream/master' into something_to_pull

This commit is contained in:
Christian Groessler 2014-01-16 23:34:56 +01:00
commit 6ab07261bc
16 changed files with 158 additions and 46 deletions

View File

@ -78,6 +78,10 @@
.byte
CSHOW .addr
.byte
CDRAW .addr
.byte
CMOVE .addr
.byte
CMOVEX .addr
.byte
CMOVEY .addr
@ -90,14 +94,16 @@
.struct MOUSE_CALLBACKS
HIDE .addr ; Hide the mouse cursor
SHOW .addr ; Show the mouse cursor
MOVEX .addr ; Move the mouse cursor
MOVEY .addr ; Dito for Y
DRAW .addr ; Draw the mouse cursor
MOVE .addr ; Prepare to move the mouse cursor
MOVEX .addr ; Move the mouse cursor to X coord
MOVEY .addr ; Move the mouse cursor to Y coord
.endstruct
;------------------------------------------------------------------------------
; The mouse API version, stored in MOUSE_HDR::VERSION
MOUSE_API_VERSION = $04
MOUSE_API_VERSION = $05
;------------------------------------------------------------------------------
; Bitmapped mouse driver flags, stored in MOUSE_HDR::FLAGS.
@ -169,12 +175,10 @@ MOUSE_BTN_RIGHT = $01
.global mouse_uninstall
.global mouse_hide
.global mouse_show
.global mouse_setbox
.global mouse_setbox
.global mouse_getbox
.global mouse_move
.global mouse_buttons
.global mouse_pos
.global mouse_info
.global mouse_ioctl

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

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

View File

@ -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

View File

@ -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
; --------------------------------------------------------------------------
;

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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.
@ -96,7 +114,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

View File

@ -69,6 +69,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
@ -314,7 +316,7 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
; MUST return carry clear.
;
IRQ:
IRQ: jsr CMOVE
; Record the state of the buttons.
; Avoid crosstalk between the keyboard and the mouse.
@ -417,8 +419,9 @@ IRQ:
; Done
@SkipY: jsr CDRAW
clc ; Interrupt not "handled"
@SkipY: rts
rts
; --------------------------------------------------------------------------
;

View File

@ -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.
@ -324,7 +326,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.
@ -422,7 +424,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.

View File

@ -68,6 +68,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
@ -319,9 +321,11 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
; MUST return carry clear.
;
IRQ: jsr CMOVE
; Avoid crosstalk between the keyboard and a joystick.
IRQ: ldy #%00000000 ; Set ports A and B to input
ldy #%00000000 ; Set ports A and B to input
sty CIA1_DDRB
sty CIA1_DDRA ; Keyboard won't look like joystick
lda CIA1_PRB ; Read Control-Port 1
@ -438,6 +442,7 @@ IRQ: ldy #%00000000 ; Set ports A and B to input
; Done
@SkipY: clc ; Interrupt not handled
@SkipY: jsr CDRAW
clc ; Interrupt not "handled"
rts

View File

@ -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

View File

@ -62,6 +62,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 .XA. Always called with
; interrupts disabled.
@ -125,7 +143,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

View File

@ -53,6 +53,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.
@ -336,7 +338,8 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
; MUST return carry clear.
;
IRQ: ldx #15 ; To system bank
IRQ: jsr CMOVE
ldx #15 ; To system bank
stx IndReg
; Read the VIC-II lightpen registers.
@ -428,7 +431,8 @@ IRQ: ldx #15 ; To system bank
; Done
@SkipX: clc ; Interrupt not "handled"
@SkipX: jsr CDRAW
clc ; Interrupt not "handled"
rts
; Move the lightpen pointer to the new Y pos.

View File

@ -52,6 +52,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 co-ord.
CMOVEY: jmp $0000 ; Move the cursor to y co-ord.
@ -323,7 +325,8 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
; Reads joystick 2.
;
IRQ: ldy #15 ; Switch to the system bank
IRQ: jsr CMOVE
ldy #15 ; Switch to the system bank
sty IndReg
; Get the direction bits.
@ -430,7 +433,8 @@ IRQ: ldy #15 ; Switch to the system bank
; Done
@SkipY: clc ; Interrupt not handled
@SkipY: jsr CDRAW
clc ; Interrupt not "handled"
rts
; Move the mouse pointer to the new x pos.