Merge branch 'master' of https://github.com/oliverschmidt/cc65 into cassette
This commit is contained in:
commit
f091d0b3cd
22 changed files with 300 additions and 125 deletions
|
@ -78,6 +78,10 @@
|
||||||
.byte
|
.byte
|
||||||
CSHOW .addr
|
CSHOW .addr
|
||||||
.byte
|
.byte
|
||||||
|
CPREP .addr
|
||||||
|
.byte
|
||||||
|
CDRAW .addr
|
||||||
|
.byte
|
||||||
CMOVEX .addr
|
CMOVEX .addr
|
||||||
.byte
|
.byte
|
||||||
CMOVEY .addr
|
CMOVEY .addr
|
||||||
|
@ -90,14 +94,16 @@
|
||||||
.struct MOUSE_CALLBACKS
|
.struct MOUSE_CALLBACKS
|
||||||
HIDE .addr ; Hide the mouse cursor
|
HIDE .addr ; Hide the mouse cursor
|
||||||
SHOW .addr ; Show the mouse cursor
|
SHOW .addr ; Show the mouse cursor
|
||||||
MOVEX .addr ; Move the mouse cursor
|
PREP .addr ; Prepare to move the mouse cursor
|
||||||
MOVEY .addr ; Dito for Y
|
DRAW .addr ; Draw the mouse cursor
|
||||||
|
MOVEX .addr ; Move the mouse cursor to X coord
|
||||||
|
MOVEY .addr ; Move the mouse cursor to Y coord
|
||||||
.endstruct
|
.endstruct
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; The mouse API version, stored in MOUSE_HDR::VERSION
|
; 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.
|
; Bitmapped mouse driver flags, stored in MOUSE_HDR::FLAGS.
|
||||||
|
@ -169,12 +175,10 @@ MOUSE_BTN_RIGHT = $01
|
||||||
.global mouse_uninstall
|
.global mouse_uninstall
|
||||||
.global mouse_hide
|
.global mouse_hide
|
||||||
.global mouse_show
|
.global mouse_show
|
||||||
.global mouse_setbox
|
.global mouse_setbox
|
||||||
.global mouse_getbox
|
.global mouse_getbox
|
||||||
.global mouse_move
|
.global mouse_move
|
||||||
.global mouse_buttons
|
.global mouse_buttons
|
||||||
.global mouse_pos
|
.global mouse_pos
|
||||||
.global mouse_info
|
.global mouse_info
|
||||||
.global mouse_ioctl
|
.global mouse_ioctl
|
||||||
|
|
||||||
|
|
||||||
|
|
44
cfg/atari-cart.cfg
Normal file
44
cfg/atari-cart.cfg
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
FEATURES {
|
||||||
|
STARTADDRESS: default = $2000;
|
||||||
|
}
|
||||||
|
SYMBOLS {
|
||||||
|
__CARTSIZE__: type = weak, value = $2000; # possible values: $2000 and $4000
|
||||||
|
__CART_HEADER__: type = import;
|
||||||
|
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||||
|
__STARTADDRESS__: type = export, value = %S;
|
||||||
|
__RESERVED_MEMORY__: type = export, value = $0000;
|
||||||
|
__CARTFLAGS__: type = weak, value = $01; # see documentation for other possible values
|
||||||
|
}
|
||||||
|
MEMORY {
|
||||||
|
ZP: file = "", define = yes, start = $0082, size = $007E;
|
||||||
|
RAM: file = "", define = yes, start = %S, size = __CARTSIZE__;
|
||||||
|
ROM: file = %O, define = yes, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - 6, fill = yes, fillval = $FF;
|
||||||
|
CARTID: file = %O, start = $BFFA, size = $0006;
|
||||||
|
}
|
||||||
|
SEGMENTS {
|
||||||
|
STARTUP: load = ROM, type = ro, define = yes, optional = yes;
|
||||||
|
LOWCODE: load = ROM, type = ro, define = yes, optional = yes;
|
||||||
|
INIT: load = ROM, type = ro, optional = yes;
|
||||||
|
CODE: load = ROM, type = ro, define = yes;
|
||||||
|
RODATA: load = ROM, type = ro, optional = yes;
|
||||||
|
DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes;
|
||||||
|
BSS: load = RAM, type = bss, define = yes, optional = yes;
|
||||||
|
CARTHDR: load = CARTID, type = ro;
|
||||||
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
|
EXTZP: load = ZP, type = zp, optional = yes;
|
||||||
|
}
|
||||||
|
FEATURES {
|
||||||
|
CONDES: type = constructor,
|
||||||
|
label = __CONSTRUCTOR_TABLE__,
|
||||||
|
count = __CONSTRUCTOR_COUNT__,
|
||||||
|
segment = INIT;
|
||||||
|
CONDES: type = destructor,
|
||||||
|
label = __DESTRUCTOR_TABLE__,
|
||||||
|
count = __DESTRUCTOR_COUNT__,
|
||||||
|
segment = RODATA;
|
||||||
|
CONDES: type = interruptor,
|
||||||
|
label = __INTERRUPTOR_TABLE__,
|
||||||
|
count = __INTERRUPTOR_COUNT__,
|
||||||
|
segment = RODATA,
|
||||||
|
import = __CALLIRQ__;
|
||||||
|
}
|
|
@ -88,7 +88,17 @@ struct mouse_callbacks {
|
||||||
/* Hide the mouse cursor. */
|
/* Hide the mouse cursor. */
|
||||||
|
|
||||||
void (*show) (void);
|
void (*show) (void);
|
||||||
/* Show the mouse cursor */
|
/* Show the mouse cursor. */
|
||||||
|
|
||||||
|
void (*prep) (void);
|
||||||
|
/* Prepare to move the mouse cursor. This function is called,
|
||||||
|
* even when the cursor is currently invisible.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void (*draw) (void);
|
||||||
|
/* Draw the mouse cursor. This function is called,
|
||||||
|
* even when the cursor is currently invisible.
|
||||||
|
*/
|
||||||
|
|
||||||
void __fastcall__ (*movex) (int x);
|
void __fastcall__ (*movex) (int x);
|
||||||
/* Move the mouse cursor to the new X coordinate. This function is called,
|
/* Move the mouse cursor to the new X coordinate. This function is called,
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
backup: .res 1
|
backup: .res 1
|
||||||
|
visible:.res 1
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -25,6 +26,8 @@ backup: .res 1
|
||||||
_mouse_def_callbacks:
|
_mouse_def_callbacks:
|
||||||
.addr hide
|
.addr hide
|
||||||
.addr show
|
.addr show
|
||||||
|
.addr prep
|
||||||
|
.addr draw
|
||||||
.addr movex
|
.addr movex
|
||||||
.addr movey
|
.addr movey
|
||||||
|
|
||||||
|
@ -65,10 +68,15 @@ done:
|
||||||
.ifdef __APPLE2ENH__
|
.ifdef __APPLE2ENH__
|
||||||
bit LOWSCR ; Doesn't hurt in 40 column mode
|
bit LOWSCR ; Doesn't hurt in 40 column mode
|
||||||
.endif
|
.endif
|
||||||
rts
|
return: rts
|
||||||
|
|
||||||
; Hide the mouse cursor.
|
; Hide the mouse cursor.
|
||||||
hide:
|
hide:
|
||||||
|
dec visible
|
||||||
|
; Fall through
|
||||||
|
|
||||||
|
; Prepare to move the mouse cursor.
|
||||||
|
prep:
|
||||||
jsr getcursor ; Cursor visible at current position?
|
jsr getcursor ; Cursor visible at current position?
|
||||||
bne done ; No, we're done
|
bne done ; No, we're done
|
||||||
lda backup ; Get character at cursor position
|
lda backup ; Get character at cursor position
|
||||||
|
@ -76,6 +84,13 @@ hide:
|
||||||
|
|
||||||
; Show the mouse cursor.
|
; Show the mouse cursor.
|
||||||
show:
|
show:
|
||||||
|
inc visible
|
||||||
|
; Fall through
|
||||||
|
|
||||||
|
; Draw the mouse cursor.
|
||||||
|
draw:
|
||||||
|
lda visible
|
||||||
|
beq return
|
||||||
jsr getcursor ; Cursor visible at current position?
|
jsr getcursor ; Cursor visible at current position?
|
||||||
beq done ; Yes, we're done
|
beq done ; Yes, we're done
|
||||||
sta backup ; Save character at cursor position
|
sta backup ; Save character at cursor position
|
||||||
|
|
|
@ -57,6 +57,8 @@ status := $0778
|
||||||
; Callback table, set by the kernel before INSTALL is called
|
; Callback table, set by the kernel before INSTALL is called
|
||||||
CHIDE: jmp $0000 ; Hide the cursor
|
CHIDE: jmp $0000 ; Hide the cursor
|
||||||
CSHOW: jmp $0000 ; Show 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
|
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
||||||
CMOVEY: jmp $0000 ; Move the cursor to Y 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
|
box: .tag MOUSE_BOX
|
||||||
info: .tag MOUSE_INFO
|
info: .tag MOUSE_INFO
|
||||||
slot: .res 1
|
slot: .res 1
|
||||||
visible:.res 1
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -321,7 +322,6 @@ MOVE:
|
||||||
; no special action is required besides hiding the mouse cursor.
|
; no special action is required besides hiding the mouse cursor.
|
||||||
; No return code required.
|
; No return code required.
|
||||||
HIDE:
|
HIDE:
|
||||||
dec visible
|
|
||||||
sei
|
sei
|
||||||
jsr CHIDE
|
jsr CHIDE
|
||||||
cli
|
cli
|
||||||
|
@ -333,7 +333,9 @@ HIDE:
|
||||||
; no special action is required besides enabling the mouse cursor.
|
; no special action is required besides enabling the mouse cursor.
|
||||||
; No return code required.
|
; No return code required.
|
||||||
SHOW:
|
SHOW:
|
||||||
inc visible
|
sei
|
||||||
|
jsr CSHOW
|
||||||
|
cli
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; BUTTONS: Return the button mask in A/X.
|
; BUTTONS: Return the button mask in A/X.
|
||||||
|
@ -409,7 +411,7 @@ done: rts
|
||||||
beq :+
|
beq :+
|
||||||
|
|
||||||
; Remove the cursor at the old position
|
; Remove the cursor at the old position
|
||||||
update: jsr CHIDE
|
update: jsr CPREP
|
||||||
|
|
||||||
; Get and set the new X position
|
; Get and set the new X position
|
||||||
ldy slot
|
ldy slot
|
||||||
|
@ -427,11 +429,7 @@ update: jsr CHIDE
|
||||||
stx info + MOUSE_POS::YCOORD+1
|
stx info + MOUSE_POS::YCOORD+1
|
||||||
jsr CMOVEY
|
jsr CMOVEY
|
||||||
|
|
||||||
; Check for visibility
|
|
||||||
: lda visible
|
|
||||||
beq :+
|
|
||||||
|
|
||||||
; Draw the cursor at the new position
|
; Draw the cursor at the new position
|
||||||
jsr CSHOW
|
: jsr CDRAW
|
||||||
: sec ; Interrupt handled
|
sec ; Interrupt handled
|
||||||
rts
|
rts
|
||||||
|
|
23
libsrc/atari/carthdr.s
Normal file
23
libsrc/atari/carthdr.s
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
; Cartridge "header"
|
||||||
|
; (In fact, it's at the end of the cartridge, so more a "trailer".)
|
||||||
|
;
|
||||||
|
; Christian Groessler, 06-Jan-2014
|
||||||
|
|
||||||
|
.ifndef __ATARIXL__
|
||||||
|
|
||||||
|
.export __CART_HEADER__: absolute = 1
|
||||||
|
|
||||||
|
.import __CARTSIZE__, __CARTFLAGS__, cartinit, cartstart
|
||||||
|
|
||||||
|
.include "atari.inc"
|
||||||
|
|
||||||
|
.segment "CARTHDR"
|
||||||
|
|
||||||
|
.word cartstart ; start routine
|
||||||
|
.byte 0 ; must be zero
|
||||||
|
.byte <__CARTFLAGS__
|
||||||
|
.word cartinit ; init routine
|
||||||
|
|
||||||
|
.assert (__CARTSIZE__ = $2000 || __CARTSIZE__ = $4000), error, "Cartridge size must either be $2000 or $4000"
|
||||||
|
|
||||||
|
.endif ; .ifndef __ATARIXL__
|
11
libsrc/atari/cartinit.s
Normal file
11
libsrc/atari/cartinit.s
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
; Cartridge init routine
|
||||||
|
;
|
||||||
|
; Christian Groessler, 06-Jan-2014
|
||||||
|
|
||||||
|
.ifndef __ATARIXL__
|
||||||
|
|
||||||
|
.export cartinit
|
||||||
|
|
||||||
|
cartinit: rts
|
||||||
|
|
||||||
|
.endif ; .ifndef __ATARIXL__
|
20
libsrc/atari/cartstart.s
Normal file
20
libsrc/atari/cartstart.s
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
; Cartridge start routine
|
||||||
|
;
|
||||||
|
; Christian Groessler, 06-Jan-2014
|
||||||
|
|
||||||
|
.ifndef __ATARIXL__
|
||||||
|
|
||||||
|
.export cartstart
|
||||||
|
|
||||||
|
.import start, copydata
|
||||||
|
|
||||||
|
.include "atari.inc"
|
||||||
|
|
||||||
|
; start routine of cartridge
|
||||||
|
; copy data segment to RAM and chain to entry point of crt0.s
|
||||||
|
|
||||||
|
cartstart: jsr copydata
|
||||||
|
jsr start ; run program
|
||||||
|
jmp (DOSVEC) ; return to DOS
|
||||||
|
|
||||||
|
.endif ; .ifndef __ATARIXL__
|
|
@ -1,5 +1,5 @@
|
||||||
;
|
;
|
||||||
; Default mouse callbacks for the C64
|
; Default mouse callbacks for the C128
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 2004-03-20
|
; Ullrich von Bassewitz, 2004-03-20
|
||||||
;
|
;
|
||||||
|
@ -22,37 +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_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
|
||||||
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
|
|
||||||
.code
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Hide the mouse pointer. Always called with interrupts disabled.
|
; Hide the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
.proc hide
|
hide:
|
||||||
|
|
||||||
lda #MOUSE_SPR_NMASK
|
lda #MOUSE_SPR_NMASK
|
||||||
and VIC_SPR_ENA
|
and VIC_SPR_ENA
|
||||||
sta VIC_SPR_ENA
|
sta VIC_SPR_ENA
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Show the mouse pointer. Always called with interrupts disabled.
|
; Show the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
.proc show
|
show:
|
||||||
|
|
||||||
lda #MOUSE_SPR_MASK
|
lda #MOUSE_SPR_MASK
|
||||||
ora VIC_SPR_ENA
|
ora VIC_SPR_ENA
|
||||||
sta VIC_SPR_ENA
|
sta VIC_SPR_ENA
|
||||||
rts
|
; Fall through
|
||||||
|
|
||||||
.endproc
|
; --------------------------------------------------------------------------
|
||||||
|
; Prepare to move the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
|
prep:
|
||||||
|
; Fall through
|
||||||
|
|
||||||
|
; --------------------------------------------------------------------------
|
||||||
|
; Draw the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
|
draw:
|
||||||
|
rts
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Move the mouse pointer X position to the value in a/x. Always called with
|
; Move the mouse pointer X position to the value in a/x. Always called with
|
||||||
; interrupts disabled.
|
; interrupts disabled.
|
||||||
|
|
||||||
.proc movex
|
movex:
|
||||||
|
|
||||||
; Add the X correction and set the low byte. This frees A.
|
; Add the X correction and set the low byte. This frees A.
|
||||||
|
|
||||||
|
@ -74,27 +78,22 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
sta VIC_SPR_HI_X
|
sta VIC_SPR_HI_X
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Move the mouse pointer Y position to the value in a/x. Always called with
|
; Move the mouse pointer Y position to the value in a/x. Always called with
|
||||||
; interrupts disabled.
|
; interrupts disabled.
|
||||||
|
|
||||||
.proc movey
|
movey:
|
||||||
|
|
||||||
clc
|
clc
|
||||||
ldx PALFLAG
|
ldx PALFLAG
|
||||||
bne @L1
|
bne @L2
|
||||||
adc #50 ; FIXME: Should be NTSC, is PAL value
|
adc #50 ; FIXME: Should be NTSC, is PAL value
|
||||||
sta VIC_SPR_Y ; Set Y position
|
sta VIC_SPR_Y ; Set Y position
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@L1: adc #50 ; Add PAL correction
|
@L2: adc #50 ; Add PAL correction
|
||||||
sta VIC_SPR_Y ; Set Y position
|
sta VIC_SPR_Y ; Set Y position
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Callback structure
|
; Callback structure
|
||||||
|
|
||||||
|
@ -103,7 +102,7 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
_mouse_def_callbacks:
|
_mouse_def_callbacks:
|
||||||
.addr hide
|
.addr hide
|
||||||
.addr show
|
.addr show
|
||||||
|
.addr prep
|
||||||
|
.addr draw
|
||||||
.addr movex
|
.addr movex
|
||||||
.addr movey
|
.addr movey
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@ HEADER:
|
||||||
|
|
||||||
CHIDE: jmp $0000 ; Hide the cursor
|
CHIDE: jmp $0000 ; Hide the cursor
|
||||||
CSHOW: jmp $0000 ; Show 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
|
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
||||||
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
||||||
|
|
||||||
|
@ -81,10 +83,11 @@ YMax: .res 2 ; Y2 value of bounding box
|
||||||
OldValue: .res 1 ; Temp for MoveCheck routine
|
OldValue: .res 1 ; Temp for MoveCheck routine
|
||||||
NewValue: .res 1 ; Temp for MoveCheck routine
|
NewValue: .res 1 ; Temp for MoveCheck routine
|
||||||
|
|
||||||
; Default values for above variables
|
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
|
; Default values for above variables
|
||||||
|
; (We use ".proc" because we want to define both a label and a scope.)
|
||||||
|
|
||||||
.proc DefVars
|
.proc DefVars
|
||||||
.byte 0, 0 ; OldPotX/OldPotY
|
.byte 0, 0 ; OldPotX/OldPotY
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
|
@ -301,7 +304,8 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||||
; MUST return carry clear.
|
; MUST return carry clear.
|
||||||
;
|
;
|
||||||
|
|
||||||
IRQ: lda SID_ADConv1 ; Get mouse X movement
|
IRQ: jsr CPREP
|
||||||
|
lda SID_ADConv1 ; Get mouse X movement
|
||||||
ldy OldPotX
|
ldy OldPotX
|
||||||
jsr MoveCheck ; Calculate movement vector
|
jsr MoveCheck ; Calculate movement vector
|
||||||
sty OldPotX
|
sty OldPotX
|
||||||
|
@ -388,8 +392,9 @@ IRQ: lda SID_ADConv1 ; Get mouse X movement
|
||||||
|
|
||||||
; Done
|
; Done
|
||||||
|
|
||||||
clc ; Interrupt not "handled"
|
@SkipY: jsr CDRAW
|
||||||
@SkipY: rts
|
clc ; Interrupt not "handled"
|
||||||
|
rts
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
|
|
|
@ -49,6 +49,8 @@ LIBREF: .addr $0000
|
||||||
|
|
||||||
CHIDE: jmp $0000 ; Hide the cursor
|
CHIDE: jmp $0000 ; Hide the cursor
|
||||||
CSHOW: jmp $0000 ; Show 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 co-ord.
|
CMOVEX: jmp $0000 ; Move the cursor to X co-ord.
|
||||||
CMOVEY: jmp $0000 ; Move the cursor to Y 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.
|
; MUST return carry clear.
|
||||||
;
|
;
|
||||||
|
|
||||||
IRQ:
|
IRQ: jsr CPREP
|
||||||
|
|
||||||
; Record the state of the buttons.
|
; Record the state of the buttons.
|
||||||
; Try to avoid crosstalk between the keyboard and the lightpen.
|
; Try to avoid crosstalk between the keyboard and the lightpen.
|
||||||
|
@ -441,7 +443,8 @@ IRQ:
|
||||||
|
|
||||||
; Done
|
; Done
|
||||||
|
|
||||||
@SkipX: clc ; Interrupt not "handled"
|
@SkipX: jsr CDRAW
|
||||||
|
clc ; Interrupt not "handled"
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Move the lightpen pointer to the new Y pos.
|
; Move the lightpen pointer to the new Y pos.
|
||||||
|
|
|
@ -49,6 +49,8 @@ HEADER:
|
||||||
|
|
||||||
CHIDE: jmp $0000 ; Hide the cursor
|
CHIDE: jmp $0000 ; Hide the cursor
|
||||||
CSHOW: jmp $0000 ; Show 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
|
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
||||||
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
||||||
|
|
||||||
|
@ -87,10 +89,11 @@ Buttons: .res 1 ; Button mask
|
||||||
|
|
||||||
Temp: .res 1
|
Temp: .res 1
|
||||||
|
|
||||||
; Default values for above variables
|
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
|
; Default values for above variables
|
||||||
|
; (We use ".proc" because we want to define both a label and a scope.)
|
||||||
|
|
||||||
.proc DefVars
|
.proc DefVars
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
.word SCREEN_WIDTH/2 ; XPos
|
.word SCREEN_WIDTH/2 ; XPos
|
||||||
|
@ -301,7 +304,8 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||||
; MUST return carry clear.
|
; MUST return carry clear.
|
||||||
;
|
;
|
||||||
|
|
||||||
IRQ: lda #$7F
|
IRQ: jsr CPREP
|
||||||
|
lda #$7F
|
||||||
sta CIA1_PRA
|
sta CIA1_PRA
|
||||||
lda CIA1_PRB ; Read joystick #0
|
lda CIA1_PRB ; Read joystick #0
|
||||||
and #$1F
|
and #$1F
|
||||||
|
@ -414,6 +418,6 @@ IRQ: lda #$7F
|
||||||
|
|
||||||
; Done
|
; Done
|
||||||
|
|
||||||
@SkipY: clc ; Interrupt not "handled"
|
@SkipY: jsr CDRAW
|
||||||
|
clc ; Interrupt not "handled"
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,8 @@ HEADER:
|
||||||
|
|
||||||
CHIDE: jmp $0000 ; Hide the cursor
|
CHIDE: jmp $0000 ; Hide the cursor
|
||||||
CSHOW: jmp $0000 ; Show 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
|
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
||||||
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
||||||
|
|
||||||
|
@ -84,10 +86,11 @@ Buttons: .res 1 ; Button mask
|
||||||
|
|
||||||
Temp: .res 1
|
Temp: .res 1
|
||||||
|
|
||||||
; Default values for above variables
|
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
|
; Default values for above variables
|
||||||
|
; (We use ".proc" because we want to define both a label and a scope.)
|
||||||
|
|
||||||
.proc DefVars
|
.proc DefVars
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
.word SCREEN_WIDTH/2 ; XPos
|
.word SCREEN_WIDTH/2 ; XPos
|
||||||
|
@ -296,7 +299,8 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||||
; (so be careful).
|
; (so be careful).
|
||||||
;
|
;
|
||||||
|
|
||||||
IRQ: lda #$7F
|
IRQ: jsr CPREP
|
||||||
|
lda #$7F
|
||||||
sta CIA1_PRA
|
sta CIA1_PRA
|
||||||
lda CIA1_PRB ; Read port #1
|
lda CIA1_PRB ; Read port #1
|
||||||
and #%00001100
|
and #%00001100
|
||||||
|
@ -391,4 +395,7 @@ IRQ: lda #$7F
|
||||||
; Move the mouse pointer to the new X pos
|
; Move the mouse pointer to the new X pos
|
||||||
|
|
||||||
tya
|
tya
|
||||||
jmp CMOVEY
|
jsr CMOVEY
|
||||||
|
jsr CDRAW
|
||||||
|
clc ; Interrupt not "handled"
|
||||||
|
rts
|
||||||
|
|
|
@ -22,37 +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_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
|
||||||
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
|
|
||||||
.code
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Hide the mouse pointer. Always called with interrupts disabled.
|
; Hide the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
.proc hide
|
hide:
|
||||||
|
|
||||||
lda #MOUSE_SPR_NMASK
|
lda #MOUSE_SPR_NMASK
|
||||||
and VIC_SPR_ENA
|
and VIC_SPR_ENA
|
||||||
sta VIC_SPR_ENA
|
sta VIC_SPR_ENA
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Show the mouse pointer. Always called with interrupts disabled.
|
; Show the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
.proc show
|
show:
|
||||||
|
|
||||||
lda #MOUSE_SPR_MASK
|
lda #MOUSE_SPR_MASK
|
||||||
ora VIC_SPR_ENA
|
ora VIC_SPR_ENA
|
||||||
sta VIC_SPR_ENA
|
sta VIC_SPR_ENA
|
||||||
rts
|
; Fall through
|
||||||
|
|
||||||
.endproc
|
; --------------------------------------------------------------------------
|
||||||
|
; Prepare to move the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
|
prep:
|
||||||
|
; Fall through
|
||||||
|
|
||||||
|
; --------------------------------------------------------------------------
|
||||||
|
; Draw the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
|
draw:
|
||||||
|
rts
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Move the mouse pointer X position to the value in a/x. Always called with
|
; Move the mouse pointer X position to the value in a/x. Always called with
|
||||||
; interrupts disabled.
|
; interrupts disabled.
|
||||||
|
|
||||||
.proc movex
|
movex:
|
||||||
|
|
||||||
; Add the X correction and set the low byte. This frees A.
|
; Add the X correction and set the low byte. This frees A.
|
||||||
|
|
||||||
|
@ -74,20 +78,15 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
sta VIC_SPR_HI_X
|
sta VIC_SPR_HI_X
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Move the mouse pointer Y position to the value in a/x. Always called with
|
; Move the mouse pointer Y position to the value in a/x. Always called with
|
||||||
; interrupts disabled.
|
; interrupts disabled.
|
||||||
|
|
||||||
.proc movey
|
movey:
|
||||||
|
|
||||||
add #50 ; Y correction (first visible line)
|
add #50 ; Y correction (first visible line)
|
||||||
sta VIC_SPR_Y ; Set Y position
|
sta VIC_SPR_Y ; Set Y position
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Callback structure
|
; Callback structure
|
||||||
|
|
||||||
|
@ -96,7 +95,7 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
_mouse_def_callbacks:
|
_mouse_def_callbacks:
|
||||||
.addr hide
|
.addr hide
|
||||||
.addr show
|
.addr show
|
||||||
|
.addr prep
|
||||||
|
.addr draw
|
||||||
.addr movex
|
.addr movex
|
||||||
.addr movey
|
.addr movey
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,8 @@ HEADER:
|
||||||
|
|
||||||
CHIDE: jmp $0000 ; Hide the cursor
|
CHIDE: jmp $0000 ; Hide the cursor
|
||||||
CSHOW: jmp $0000 ; Show 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
|
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
||||||
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
||||||
|
|
||||||
|
@ -101,10 +103,9 @@ Buttons: .res 1 ; button status bits
|
||||||
OldValue: .res 1 ; Temp for MoveCheck routine
|
OldValue: .res 1 ; Temp for MoveCheck routine
|
||||||
NewValue: .res 1 ; Temp for MoveCheck routine
|
NewValue: .res 1 ; Temp for MoveCheck routine
|
||||||
|
|
||||||
; Default values for above variables
|
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
|
; Default values for above variables
|
||||||
; (We use ".proc" because we want to define both a label and a scope.)
|
; (We use ".proc" because we want to define both a label and a scope.)
|
||||||
|
|
||||||
.proc DefVars
|
.proc DefVars
|
||||||
|
@ -315,7 +316,7 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||||
; MUST return carry clear.
|
; MUST return carry clear.
|
||||||
;
|
;
|
||||||
|
|
||||||
IRQ:
|
IRQ: jsr CPREP
|
||||||
|
|
||||||
; Record the state of the buttons.
|
; Record the state of the buttons.
|
||||||
; Avoid crosstalk between the keyboard and the mouse.
|
; Avoid crosstalk between the keyboard and the mouse.
|
||||||
|
@ -418,8 +419,9 @@ IRQ:
|
||||||
|
|
||||||
; Done
|
; Done
|
||||||
|
|
||||||
|
@SkipY: jsr CDRAW
|
||||||
clc ; Interrupt not "handled"
|
clc ; Interrupt not "handled"
|
||||||
@SkipY: rts
|
rts
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
|
|
|
@ -49,6 +49,8 @@ LIBREF: .addr $0000
|
||||||
|
|
||||||
CHIDE: jmp $0000 ; Hide the cursor
|
CHIDE: jmp $0000 ; Hide the cursor
|
||||||
CSHOW: jmp $0000 ; Show 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 co-ord.
|
CMOVEX: jmp $0000 ; Move the cursor to X co-ord.
|
||||||
CMOVEY: jmp $0000 ; Move the cursor to Y 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.
|
; MUST return carry clear.
|
||||||
;
|
;
|
||||||
|
|
||||||
IRQ:
|
IRQ: jsr CPREP
|
||||||
|
|
||||||
; Record the state of the buttons.
|
; Record the state of the buttons.
|
||||||
; Try to avoid crosstalk between the keyboard and the lightpen.
|
; Try to avoid crosstalk between the keyboard and the lightpen.
|
||||||
|
@ -422,7 +424,8 @@ IRQ:
|
||||||
|
|
||||||
; Done
|
; Done
|
||||||
|
|
||||||
@SkipX: clc ; Interrupt not "handled"
|
@SkipX: jsr CDRAW
|
||||||
|
clc ; Interrupt not "handled"
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Move the lightpen pointer to the new Y pos.
|
; Move the lightpen pointer to the new Y pos.
|
||||||
|
|
|
@ -68,6 +68,8 @@ HEADER:
|
||||||
|
|
||||||
CHIDE: jmp $0000 ; Hide the cursor
|
CHIDE: jmp $0000 ; Hide the cursor
|
||||||
CSHOW: jmp $0000 ; Show 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
|
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
||||||
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
||||||
|
|
||||||
|
@ -106,10 +108,11 @@ Buttons: .res 1 ; Button mask
|
||||||
|
|
||||||
Temp: .res 1
|
Temp: .res 1
|
||||||
|
|
||||||
; Default values for above variables
|
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
|
; Default values for above variables
|
||||||
|
; (We use ".proc" because we want to define both a label and a scope.)
|
||||||
|
|
||||||
.proc DefVars
|
.proc DefVars
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
.word SCREEN_WIDTH/2 ; XPos
|
.word SCREEN_WIDTH/2 ; XPos
|
||||||
|
@ -318,9 +321,11 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||||
; MUST return carry clear.
|
; MUST return carry clear.
|
||||||
;
|
;
|
||||||
|
|
||||||
|
IRQ: jsr CPREP
|
||||||
|
|
||||||
; Avoid crosstalk between the keyboard and a joystick.
|
; 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_DDRB
|
||||||
sty CIA1_DDRA ; Keyboard won't look like joystick
|
sty CIA1_DDRA ; Keyboard won't look like joystick
|
||||||
lda CIA1_PRB ; Read Control-Port 1
|
lda CIA1_PRB ; Read Control-Port 1
|
||||||
|
@ -437,6 +442,7 @@ IRQ: ldy #%00000000 ; Set ports A and B to input
|
||||||
|
|
||||||
; Done
|
; Done
|
||||||
|
|
||||||
@SkipY: clc ; Interrupt not handled
|
@SkipY: jsr CDRAW
|
||||||
|
clc ; Interrupt not "handled"
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,8 @@ HEADER:
|
||||||
|
|
||||||
CHIDE: jmp $0000 ; Hide the cursor
|
CHIDE: jmp $0000 ; Hide the cursor
|
||||||
CSHOW: jmp $0000 ; Show 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
|
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
||||||
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
||||||
|
|
||||||
|
@ -84,10 +86,11 @@ Buttons: .res 1 ; Button mask
|
||||||
|
|
||||||
Temp: .res 1
|
Temp: .res 1
|
||||||
|
|
||||||
; Default values for above variables
|
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
|
; Default values for above variables
|
||||||
|
; (We use ".proc" because we want to define both a label and a scope.)
|
||||||
|
|
||||||
.proc DefVars
|
.proc DefVars
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
.word SCREEN_WIDTH/2 ; XPos
|
.word SCREEN_WIDTH/2 ; XPos
|
||||||
|
@ -296,7 +299,8 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||||
; (so be careful).
|
; (so be careful).
|
||||||
;
|
;
|
||||||
|
|
||||||
IRQ: lda #$7F
|
IRQ: jsr CPREP
|
||||||
|
lda #$7F
|
||||||
sta CIA1_PRA
|
sta CIA1_PRA
|
||||||
lda CIA1_PRB ; Read port #1
|
lda CIA1_PRB ; Read port #1
|
||||||
and #%00001100
|
and #%00001100
|
||||||
|
@ -391,4 +395,7 @@ IRQ: lda #$7F
|
||||||
; Move the mouse pointer to the new X pos
|
; Move the mouse pointer to the new X pos
|
||||||
|
|
||||||
tya
|
tya
|
||||||
jmp CMOVEY
|
jsr CMOVEY
|
||||||
|
jsr CDRAW
|
||||||
|
clc ; Interrupt not "handled"
|
||||||
|
rts
|
||||||
|
|
|
@ -27,8 +27,7 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Hide the mouse pointer. Always called with interrupts disabled.
|
; Hide the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
.proc hide
|
hide:
|
||||||
|
|
||||||
ldy #15
|
ldy #15
|
||||||
sty IndReg
|
sty IndReg
|
||||||
|
|
||||||
|
@ -41,13 +40,10 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
sty IndReg
|
sty IndReg
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Show the mouse pointer. Always called with interrupts disabled.
|
; Show the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
.proc show
|
show:
|
||||||
|
|
||||||
ldy #15
|
ldy #15
|
||||||
sty IndReg
|
sty IndReg
|
||||||
|
|
||||||
|
@ -58,16 +54,25 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
|
|
||||||
ldy ExecReg
|
ldy ExecReg
|
||||||
sty IndReg
|
sty IndReg
|
||||||
rts
|
; Fall through
|
||||||
|
|
||||||
.endproc
|
; --------------------------------------------------------------------------
|
||||||
|
; Prepare to move the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
|
prep:
|
||||||
|
; Fall through
|
||||||
|
|
||||||
|
; --------------------------------------------------------------------------
|
||||||
|
; Draw the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
|
draw:
|
||||||
|
rts
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Move the mouse pointer x position to the value in .XA. Always called with
|
; Move the mouse pointer x position to the value in .XA. Always called with
|
||||||
; interrupts disabled.
|
; interrupts disabled.
|
||||||
|
|
||||||
.proc movex
|
movex:
|
||||||
|
|
||||||
ldy #15
|
ldy #15
|
||||||
sty IndReg
|
sty IndReg
|
||||||
|
|
||||||
|
@ -94,16 +99,13 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
@L1: lda (vic),y ; Get high x bits of all sprites
|
@L1: lda (vic),y ; Get high x bits of all sprites
|
||||||
ora #MOUSE_SPR_MASK ; Set high bit for sprite
|
ora #MOUSE_SPR_MASK ; Set high bit for sprite
|
||||||
sta (vic),y
|
sta (vic),y
|
||||||
bnz @L0 ; branch always
|
bnz @L0 ; Branch always
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Move the mouse pointer y position to the value in .XA. Always called with
|
; Move the mouse pointer y position to the value in .XA. Always called with
|
||||||
; interrupts disabled.
|
; interrupts disabled.
|
||||||
|
|
||||||
.proc movey
|
movey:
|
||||||
|
|
||||||
ldy #15
|
ldy #15
|
||||||
sty IndReg
|
sty IndReg
|
||||||
|
|
||||||
|
@ -115,8 +117,6 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
sty IndReg
|
sty IndReg
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Callback structure
|
; Callback structure
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||||
_mouse_def_callbacks:
|
_mouse_def_callbacks:
|
||||||
.addr hide
|
.addr hide
|
||||||
.addr show
|
.addr show
|
||||||
|
.addr prep
|
||||||
|
.addr draw
|
||||||
.addr movex
|
.addr movex
|
||||||
.addr movey
|
.addr movey
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ LIBREF: .addr $0000
|
||||||
|
|
||||||
CHIDE: jmp $0000 ; Hide the cursor
|
CHIDE: jmp $0000 ; Hide the cursor
|
||||||
CSHOW: jmp $0000 ; Show 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 co-ord.
|
CMOVEX: jmp $0000 ; Move the cursor to X co-ord.
|
||||||
CMOVEY: jmp $0000 ; Move the cursor to Y 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.
|
; MUST return carry clear.
|
||||||
;
|
;
|
||||||
|
|
||||||
IRQ: ldx #15 ; To system bank
|
IRQ: jsr CPREP
|
||||||
|
ldx #15 ; To system bank
|
||||||
stx IndReg
|
stx IndReg
|
||||||
|
|
||||||
; Read the VIC-II lightpen registers.
|
; Read the VIC-II lightpen registers.
|
||||||
|
@ -428,7 +431,8 @@ IRQ: ldx #15 ; To system bank
|
||||||
|
|
||||||
; Done
|
; Done
|
||||||
|
|
||||||
@SkipX: clc ; Interrupt not "handled"
|
@SkipX: jsr CDRAW
|
||||||
|
clc ; Interrupt not "handled"
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Move the lightpen pointer to the new Y pos.
|
; Move the lightpen pointer to the new Y pos.
|
||||||
|
|
|
@ -52,6 +52,8 @@ HEADER:
|
||||||
|
|
||||||
CHIDE: jmp $0000 ; Hide the cursor
|
CHIDE: jmp $0000 ; Hide the cursor
|
||||||
CSHOW: jmp $0000 ; Show 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 co-ord.
|
CMOVEX: jmp $0000 ; Move the cursor to x co-ord.
|
||||||
CMOVEY: jmp $0000 ; Move the cursor to y co-ord.
|
CMOVEY: jmp $0000 ; Move the cursor to y co-ord.
|
||||||
|
|
||||||
|
@ -89,10 +91,11 @@ YMax: .res 2 ; Y2 value of bounding box
|
||||||
|
|
||||||
Temp: .res 1
|
Temp: .res 1
|
||||||
|
|
||||||
; Default values for above variables
|
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
|
; Default values for above variables
|
||||||
|
; (We use ".proc" because we want to define both a label and a scope.)
|
||||||
|
|
||||||
.proc DefVars
|
.proc DefVars
|
||||||
.word SCREEN_HEIGHT / 2 ; YPos
|
.word SCREEN_HEIGHT / 2 ; YPos
|
||||||
.word SCREEN_WIDTH / 2 ; XPos
|
.word SCREEN_WIDTH / 2 ; XPos
|
||||||
|
@ -322,7 +325,8 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
|
||||||
; Reads joystick 2.
|
; Reads joystick 2.
|
||||||
;
|
;
|
||||||
|
|
||||||
IRQ: ldy #15 ; Switch to the system bank
|
IRQ: jsr CPREP
|
||||||
|
ldy #15 ; Switch to the system bank
|
||||||
sty IndReg
|
sty IndReg
|
||||||
|
|
||||||
; Get the direction bits.
|
; Get the direction bits.
|
||||||
|
@ -429,7 +433,8 @@ IRQ: ldy #15 ; Switch to the system bank
|
||||||
|
|
||||||
; Done
|
; Done
|
||||||
|
|
||||||
@SkipY: clc ; Interrupt not handled
|
@SkipY: jsr CDRAW
|
||||||
|
clc ; Interrupt not "handled"
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Move the mouse pointer to the new x pos.
|
; Move the mouse pointer to the new x pos.
|
||||||
|
|
|
@ -32,26 +32,32 @@ hide := MouseOff
|
||||||
|
|
||||||
show := MouseUp
|
show := MouseUp
|
||||||
|
|
||||||
|
; --------------------------------------------------------------------------
|
||||||
|
; Prepare to move the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
|
prep:
|
||||||
|
; Fall through
|
||||||
|
|
||||||
|
; --------------------------------------------------------------------------
|
||||||
|
; Draw the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
|
draw:
|
||||||
|
; Fall through
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Move the mouse pointer X position to the value in .XA. Always called with
|
; Move the mouse pointer X position to the value in .XA. Always called with
|
||||||
; interrupts disabled.
|
; interrupts disabled.
|
||||||
|
|
||||||
.proc movex
|
movex:
|
||||||
|
; Fall through
|
||||||
rts
|
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Move the mouse pointer Y position to the value in .XA. Always called with
|
; Move the mouse pointer Y position to the value in .XA. Always called with
|
||||||
; interrupts disabled.
|
; interrupts disabled.
|
||||||
|
|
||||||
.proc movey
|
movey:
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Callback structure
|
; Callback structure
|
||||||
|
|
||||||
|
@ -60,7 +66,7 @@ show := MouseUp
|
||||||
_mouse_def_callbacks:
|
_mouse_def_callbacks:
|
||||||
.addr hide
|
.addr hide
|
||||||
.addr show
|
.addr show
|
||||||
|
.addr prep
|
||||||
|
.addr draw
|
||||||
.addr movex
|
.addr movex
|
||||||
.addr movey
|
.addr movey
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue