mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
Merge branch 'master' of https://github.com/oliverschmidt/cc65 into cassette
This commit is contained in:
commit
f091d0b3cd
@ -78,6 +78,10 @@
|
||||
.byte
|
||||
CSHOW .addr
|
||||
.byte
|
||||
CPREP .addr
|
||||
.byte
|
||||
CDRAW .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
|
||||
PREP .addr ; Prepare to move the mouse cursor
|
||||
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
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; 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
|
||||
|
||||
|
||||
|
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. */
|
||||
|
||||
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);
|
||||
/* Move the mouse cursor to the new X coordinate. This function is called,
|
||||
|
@ -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 prep
|
||||
.addr draw
|
||||
.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.
|
||||
prep:
|
||||
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
|
||||
|
@ -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
|
||||
CPREP: jmp $0000 ; Prepare to move the cursor
|
||||
CDRAW: jmp $0000 ; Draw 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 CPREP
|
||||
|
||||
; 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
|
||||
|
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
|
||||
;
|
||||
@ -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_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
|
||||
; 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
|
||||
; interrupts disabled.
|
||||
|
||||
.proc movex
|
||||
movex:
|
||||
|
||||
; 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
|
||||
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
|
||||
|
||||
@ -103,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 movex
|
||||
.addr movey
|
||||
|
||||
|
||||
|
@ -50,6 +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
|
||||
CMOVEX: jmp $0000 ; Move the cursor to X 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
|
||||
NewValue: .res 1 ; Temp for MoveCheck routine
|
||||
|
||||
; Default values for above variables
|
||||
|
||||
.rodata
|
||||
|
||||
; Default values for above variables
|
||||
; (We use ".proc" because we want to define both a label and a scope.)
|
||||
|
||||
.proc DefVars
|
||||
.byte 0, 0 ; OldPotX/OldPotY
|
||||
.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.
|
||||
;
|
||||
|
||||
IRQ: lda SID_ADConv1 ; Get mouse X movement
|
||||
IRQ: jsr CPREP
|
||||
lda SID_ADConv1 ; Get mouse X movement
|
||||
ldy OldPotX
|
||||
jsr MoveCheck ; Calculate movement vector
|
||||
sty OldPotX
|
||||
@ -388,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
|
||||
CPREP: jmp $0000 ; Prepare to move the cursor
|
||||
CDRAW: jmp $0000 ; Draw 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 CPREP
|
||||
|
||||
; 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
|
||||
CPREP: jmp $0000 ; Prepare to move the cursor
|
||||
CDRAW: jmp $0000 ; Draw the cursor
|
||||
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
||||
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
||||
|
||||
@ -87,10 +89,11 @@ Buttons: .res 1 ; Button mask
|
||||
|
||||
Temp: .res 1
|
||||
|
||||
; Default values for above variables
|
||||
|
||||
.rodata
|
||||
|
||||
; Default values for above variables
|
||||
; (We use ".proc" because we want to define both a label and a scope.)
|
||||
|
||||
.proc DefVars
|
||||
.word SCREEN_HEIGHT/2 ; YPos
|
||||
.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.
|
||||
;
|
||||
|
||||
IRQ: lda #$7F
|
||||
IRQ: jsr CPREP
|
||||
lda #$7F
|
||||
sta CIA1_PRA
|
||||
lda CIA1_PRB ; Read joystick #0
|
||||
and #$1F
|
||||
@ -414,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
|
||||
CPREP: jmp $0000 ; Prepare to move the cursor
|
||||
CDRAW: jmp $0000 ; Draw the cursor
|
||||
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
||||
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
||||
|
||||
@ -84,10 +86,11 @@ Buttons: .res 1 ; Button mask
|
||||
|
||||
Temp: .res 1
|
||||
|
||||
; Default values for above variables
|
||||
|
||||
.rodata
|
||||
|
||||
; Default values for above variables
|
||||
; (We use ".proc" because we want to define both a label and a scope.)
|
||||
|
||||
.proc DefVars
|
||||
.word SCREEN_HEIGHT/2 ; YPos
|
||||
.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).
|
||||
;
|
||||
|
||||
IRQ: lda #$7F
|
||||
IRQ: jsr CPREP
|
||||
lda #$7F
|
||||
sta CIA1_PRA
|
||||
lda CIA1_PRB ; Read port #1
|
||||
and #%00001100
|
||||
@ -391,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
|
||||
|
@ -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_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
|
||||
; 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
|
||||
; interrupts disabled.
|
||||
|
||||
.proc movex
|
||||
movex:
|
||||
|
||||
; 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
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Move the mouse pointer Y position to the value in a/x. Always called with
|
||||
; interrupts disabled.
|
||||
|
||||
.proc movey
|
||||
|
||||
movey:
|
||||
add #50 ; Y correction (first visible line)
|
||||
sta VIC_SPR_Y ; Set Y position
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Callback structure
|
||||
|
||||
@ -96,7 +95,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 movex
|
||||
.addr movey
|
||||
|
||||
|
||||
|
@ -69,6 +69,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
|
||||
CMOVEX: jmp $0000 ; Move the cursor to X 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
|
||||
NewValue: .res 1 ; Temp for MoveCheck routine
|
||||
|
||||
; Default values for above variables
|
||||
|
||||
.rodata
|
||||
|
||||
; Default values for above variables
|
||||
; (We use ".proc" because we want to define both a label and a scope.)
|
||||
|
||||
.proc DefVars
|
||||
@ -315,7 +316,7 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
; MUST return carry clear.
|
||||
;
|
||||
|
||||
IRQ:
|
||||
IRQ: jsr CPREP
|
||||
|
||||
; Record the state of the buttons.
|
||||
; Avoid crosstalk between the keyboard and the mouse.
|
||||
@ -418,8 +419,9 @@ IRQ:
|
||||
|
||||
; Done
|
||||
|
||||
@SkipY: jsr CDRAW
|
||||
clc ; Interrupt not "handled"
|
||||
@SkipY: rts
|
||||
rts
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
;
|
||||
|
@ -49,6 +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
|
||||
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 CPREP
|
||||
|
||||
; 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.
|
||||
|
@ -68,6 +68,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
|
||||
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
||||
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
||||
|
||||
@ -106,10 +108,11 @@ Buttons: .res 1 ; Button mask
|
||||
|
||||
Temp: .res 1
|
||||
|
||||
; Default values for above variables
|
||||
|
||||
.rodata
|
||||
|
||||
; Default values for above variables
|
||||
; (We use ".proc" because we want to define both a label and a scope.)
|
||||
|
||||
.proc DefVars
|
||||
.word SCREEN_HEIGHT/2 ; YPos
|
||||
.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.
|
||||
;
|
||||
|
||||
IRQ: jsr CPREP
|
||||
|
||||
; 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
|
||||
@ -437,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
|
||||
|
||||
|
@ -46,6 +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
|
||||
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
||||
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
||||
|
||||
@ -84,10 +86,11 @@ Buttons: .res 1 ; Button mask
|
||||
|
||||
Temp: .res 1
|
||||
|
||||
; Default values for above variables
|
||||
|
||||
.rodata
|
||||
|
||||
; Default values for above variables
|
||||
; (We use ".proc" because we want to define both a label and a scope.)
|
||||
|
||||
.proc DefVars
|
||||
.word SCREEN_HEIGHT/2 ; YPos
|
||||
.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).
|
||||
;
|
||||
|
||||
IRQ: lda #$7F
|
||||
IRQ: jsr CPREP
|
||||
lda #$7F
|
||||
sta CIA1_PRA
|
||||
lda CIA1_PRB ; Read port #1
|
||||
and #%00001100
|
||||
@ -391,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
|
||||
|
@ -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.
|
||||
|
||||
.proc hide
|
||||
|
||||
hide:
|
||||
ldy #15
|
||||
sty IndReg
|
||||
|
||||
@ -41,13 +40,10 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||
sty IndReg
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Show the mouse pointer. Always called with interrupts disabled.
|
||||
|
||||
.proc show
|
||||
|
||||
show:
|
||||
ldy #15
|
||||
sty IndReg
|
||||
|
||||
@ -58,16 +54,25 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||
|
||||
ldy ExecReg
|
||||
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
|
||||
; interrupts disabled.
|
||||
|
||||
.proc movex
|
||||
|
||||
movex:
|
||||
ldy #15
|
||||
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
|
||||
ora #MOUSE_SPR_MASK ; Set high bit for sprite
|
||||
sta (vic),y
|
||||
bnz @L0 ; branch always
|
||||
|
||||
.endproc
|
||||
bnz @L0 ; Branch always
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Move the mouse pointer y position to the value in .XA. Always called with
|
||||
; interrupts disabled.
|
||||
|
||||
.proc movey
|
||||
|
||||
movey:
|
||||
ldy #15
|
||||
sty IndReg
|
||||
|
||||
@ -115,8 +117,6 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||
sty IndReg
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Callback structure
|
||||
|
||||
@ -125,7 +125,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 movex
|
||||
.addr movey
|
||||
|
||||
|
||||
|
@ -53,6 +53,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
|
||||
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 CPREP
|
||||
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.
|
||||
|
@ -52,6 +52,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
|
||||
CMOVEX: jmp $0000 ; Move the cursor to x 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
|
||||
|
||||
; Default values for above variables
|
||||
|
||||
.rodata
|
||||
|
||||
; Default values for above variables
|
||||
; (We use ".proc" because we want to define both a label and a scope.)
|
||||
|
||||
.proc DefVars
|
||||
.word SCREEN_HEIGHT / 2 ; YPos
|
||||
.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.
|
||||
;
|
||||
|
||||
IRQ: ldy #15 ; Switch to the system bank
|
||||
IRQ: jsr CPREP
|
||||
ldy #15 ; Switch to the system bank
|
||||
sty IndReg
|
||||
|
||||
; Get the direction bits.
|
||||
@ -429,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.
|
||||
|
@ -32,26 +32,32 @@ hide := MouseOff
|
||||
|
||||
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
|
||||
; interrupts disabled.
|
||||
|
||||
.proc movex
|
||||
|
||||
rts
|
||||
|
||||
.endproc
|
||||
movex:
|
||||
; Fall through
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Move the mouse pointer Y position to the value in .XA. Always called with
|
||||
; interrupts disabled.
|
||||
|
||||
.proc movey
|
||||
|
||||
movey:
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Callback structure
|
||||
|
||||
@ -60,7 +66,7 @@ show := MouseUp
|
||||
_mouse_def_callbacks:
|
||||
.addr hide
|
||||
.addr show
|
||||
.addr prep
|
||||
.addr draw
|
||||
.addr movex
|
||||
.addr movey
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user