2008-08-05 20:54:35 +00:00
|
|
|
;
|
2014-03-15 20:29:13 +00:00
|
|
|
; Driver for a potentiometer "mouse", e.g. Koala Pad
|
2008-08-05 20:54:35 +00:00
|
|
|
;
|
2014-03-15 20:29:13 +00:00
|
|
|
; 2006-08-20, Stefan Haubenthal
|
|
|
|
; 2009-09-26, Ullrich von Bassewitz
|
2014-05-05 09:30:31 +00:00
|
|
|
; 2014-04-26, Christian Groessler
|
2014-05-05 08:16:04 +00:00
|
|
|
; 2014-05-05, Greg King
|
2008-08-05 20:54:35 +00:00
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "zeropage.inc"
|
|
|
|
.include "mouse-kernel.inc"
|
|
|
|
.include "c128.inc"
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.macpack generic
|
2014-06-04 21:50:18 +00:00
|
|
|
.macpack module
|
|
|
|
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
; Header. Includes jump table
|
|
|
|
|
2014-06-04 21:50:18 +00:00
|
|
|
module_header _c128_pot_mou
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
HEADER:
|
|
|
|
|
|
|
|
; Driver signature
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.byte $6d, $6f, $75 ; "mou"
|
|
|
|
.byte MOUSE_API_VERSION ; Mouse driver API version number
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-31 22:53:17 +00:00
|
|
|
; Library reference
|
|
|
|
|
2014-05-05 09:30:31 +00:00
|
|
|
libref: .addr $0000
|
2013-05-31 22:53:17 +00:00
|
|
|
|
|
|
|
; Jump table
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.addr INSTALL
|
|
|
|
.addr UNINSTALL
|
|
|
|
.addr HIDE
|
|
|
|
.addr SHOW
|
|
|
|
.addr SETBOX
|
2009-09-26 11:35:32 +00:00
|
|
|
.addr GETBOX
|
2013-05-09 11:56:54 +00:00
|
|
|
.addr MOVE
|
|
|
|
.addr BUTTONS
|
|
|
|
.addr POS
|
|
|
|
.addr INFO
|
|
|
|
.addr IOCTL
|
|
|
|
.addr IRQ
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2014-05-05 08:16:04 +00:00
|
|
|
; Mouse driver flags
|
|
|
|
|
|
|
|
.byte MOUSE_FLAG_LATE_IRQ
|
|
|
|
|
2008-08-05 20:54:35 +00:00
|
|
|
; Callback table, set by the kernel before INSTALL is called
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
CHIDE: jmp $0000 ; Hide the cursor
|
|
|
|
CSHOW: jmp $0000 ; Show the cursor
|
2014-01-17 20:09:15 +00:00
|
|
|
CPREP: jmp $0000 ; Prepare to move the cursor
|
2014-01-15 21:47:59 +00:00
|
|
|
CDRAW: jmp $0000 ; Draw the cursor
|
2013-05-09 11:56:54 +00:00
|
|
|
CMOVEX: jmp $0000 ; Move the cursor to X coord
|
|
|
|
CMOVEY: jmp $0000 ; Move the cursor to Y coord
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; Constants
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
SCREEN_HEIGHT = 200
|
|
|
|
SCREEN_WIDTH = 320
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.enum JOY
|
|
|
|
UP = $01
|
|
|
|
DOWN = $02
|
|
|
|
LEFT = $04
|
|
|
|
RIGHT = $08
|
|
|
|
FIRE = $10
|
2008-08-05 20:54:35 +00:00
|
|
|
.endenum
|
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; Global variables. The bounding box values are sorted so that they can be
|
2009-09-26 11:35:32 +00:00
|
|
|
; written with the least effort in the SETBOX and GETBOX routines, so don't
|
|
|
|
; reorder them.
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
.bss
|
|
|
|
|
|
|
|
Vars:
|
2013-05-09 11:56:54 +00:00
|
|
|
YPos: .res 2 ; Current mouse position, Y
|
|
|
|
XPos: .res 2 ; Current mouse position, X
|
|
|
|
XMin: .res 2 ; X1 value of bounding box
|
|
|
|
YMin: .res 2 ; Y1 value of bounding box
|
|
|
|
XMax: .res 2 ; X2 value of bounding box
|
|
|
|
YMax: .res 2 ; Y2 value of bounding box
|
|
|
|
Buttons: .res 1 ; Button mask
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2014-03-15 20:29:13 +00:00
|
|
|
INIT_save: .res 1
|
|
|
|
|
2014-05-05 09:30:31 +00:00
|
|
|
; Keyboard buffer fill level at start of interrupt
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2014-05-05 09:30:31 +00:00
|
|
|
old_key_count: .res 1
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2014-05-05 09:30:31 +00:00
|
|
|
; Original IRQ vector
|
|
|
|
|
|
|
|
old_irq: .res 2
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
.rodata
|
|
|
|
|
2014-01-12 20:52:18 +00:00
|
|
|
; Default values for above variables
|
2014-01-11 22:35:21 +00:00
|
|
|
; (We use ".proc" because we want to define both a label and a scope.)
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc DefVars
|
|
|
|
.word SCREEN_HEIGHT/2 ; YPos
|
|
|
|
.word SCREEN_WIDTH/2 ; XPos
|
|
|
|
.word 0 ; XMin
|
|
|
|
.word 0 ; YMin
|
2014-03-18 06:41:57 +00:00
|
|
|
.word SCREEN_WIDTH - 1 ; XMax
|
|
|
|
.word SCREEN_HEIGHT - 1 ; YMax
|
2013-05-09 11:56:54 +00:00
|
|
|
.byte 0 ; Buttons
|
2008-08-05 20:54:35 +00:00
|
|
|
.endproc
|
|
|
|
|
|
|
|
.code
|
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; INSTALL routine. Is called after the driver is loaded into memory. If
|
|
|
|
; possible, check if the hardware is present.
|
|
|
|
; Must return an MOUSE_ERR_xx code in a/x.
|
|
|
|
|
|
|
|
INSTALL:
|
|
|
|
|
2014-03-15 20:29:13 +00:00
|
|
|
; Disable the BASIC interpreter's interrupt-driven sprite-motion code.
|
|
|
|
; That allows direct access to the VIC-IIe's sprite registers.
|
|
|
|
|
|
|
|
lda INIT_STATUS
|
|
|
|
sta INIT_save
|
|
|
|
lda #%11000000
|
|
|
|
sta INIT_STATUS
|
|
|
|
|
2008-08-05 20:54:35 +00:00
|
|
|
; Initialize variables. Just copy the default stuff over
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx #.sizeof(DefVars)-1
|
|
|
|
@L1: lda DefVars,x
|
|
|
|
sta Vars,x
|
|
|
|
dex
|
|
|
|
bpl @L1
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
; Be sure the mouse cursor is invisible and at the default location. We
|
|
|
|
; need to do that here, because our mouse interrupt handler doesn't set the
|
|
|
|
; mouse position if it hasn't changed.
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
sei
|
|
|
|
jsr CHIDE
|
|
|
|
lda XPos
|
|
|
|
ldx XPos+1
|
|
|
|
jsr CMOVEX
|
|
|
|
lda YPos
|
|
|
|
ldx YPos+1
|
|
|
|
jsr CMOVEY
|
2014-05-05 09:30:31 +00:00
|
|
|
|
|
|
|
; Initiate our IRQ magic.
|
|
|
|
|
|
|
|
; Remember the ROM IRQ continuation address.
|
|
|
|
ldx IRQInd+2
|
|
|
|
lda IRQInd+1
|
|
|
|
stx old_irq+1
|
|
|
|
sta old_irq
|
|
|
|
|
|
|
|
lda libref
|
|
|
|
ldx libref+1
|
|
|
|
sta ptr3
|
|
|
|
stx ptr3+1
|
|
|
|
|
|
|
|
; Set the ROM IRQ continuation address to point to the provided routine.
|
|
|
|
ldy #2
|
|
|
|
lda (ptr3),y
|
|
|
|
sta IRQInd+1
|
|
|
|
iny
|
|
|
|
lda (ptr3),y
|
|
|
|
sta IRQInd+2
|
|
|
|
|
|
|
|
; Set the address of our IRQ callback routine.
|
|
|
|
; Because it's called via "rts", we must use "address-1".
|
|
|
|
iny
|
|
|
|
lda #<(callback-1)
|
|
|
|
sta (ptr3),y
|
|
|
|
iny
|
|
|
|
lda #>(callback-1)
|
|
|
|
sta (ptr3),y
|
|
|
|
|
|
|
|
; Set the ROM entry-point vector.
|
|
|
|
; Because it's called via "rts", we must decrement it by one.
|
|
|
|
iny
|
|
|
|
lda old_irq
|
|
|
|
sub #<1
|
|
|
|
sta (ptr3),y
|
|
|
|
iny
|
|
|
|
lda old_irq+1
|
|
|
|
sbc #>1
|
|
|
|
sta (ptr3),y
|
2013-05-09 11:56:54 +00:00
|
|
|
cli
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
; Done, return zero (= MOUSE_ERR_OK)
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx #$00
|
|
|
|
txa
|
|
|
|
rts
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
|
|
|
; No return code required (the driver is removed from memory on return).
|
|
|
|
|
2014-03-15 20:29:13 +00:00
|
|
|
UNINSTALL:
|
2014-05-05 09:30:31 +00:00
|
|
|
lda old_irq
|
|
|
|
ldx old_irq+1
|
|
|
|
sei
|
|
|
|
sta IRQInd+1
|
|
|
|
stx IRQInd+2
|
2014-05-05 17:45:34 +00:00
|
|
|
;cli ; This will be done at end of HIDE
|
2014-05-05 09:30:31 +00:00
|
|
|
|
2014-03-15 20:29:13 +00:00
|
|
|
jsr HIDE ; Hide cursor on exit
|
|
|
|
lda INIT_save
|
|
|
|
sta INIT_STATUS
|
|
|
|
rts
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages
|
|
|
|
; a counter for calls to show/hide, and the driver entry point is only called
|
|
|
|
; if the mouse is currently visible and should get hidden. For most drivers,
|
|
|
|
; no special action is required besides hiding the mouse cursor.
|
|
|
|
; No return code required.
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
HIDE: sei
|
|
|
|
jsr CHIDE
|
|
|
|
cli
|
|
|
|
rts
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; SHOW routine. Is called to show the mouse pointer. The mouse kernel manages
|
|
|
|
; a counter for calls to show/hide, and the driver entry point is only called
|
|
|
|
; if the mouse is currently hidden and should become visible. For most drivers,
|
|
|
|
; no special action is required besides enabling the mouse cursor.
|
|
|
|
; No return code required.
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
SHOW: sei
|
|
|
|
jsr CSHOW
|
|
|
|
cli
|
|
|
|
rts
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
2009-09-26 11:35:32 +00:00
|
|
|
; SETBOX: Set the mouse bounding box. The parameters are passed as they come
|
|
|
|
; from the C program, that is, a pointer to a mouse_box struct in a/x.
|
2008-08-05 20:54:35 +00:00
|
|
|
; No checks are done if the mouse is currently inside the box, this is the job
|
|
|
|
; of the caller. It is not necessary to validate the parameters, trust the
|
|
|
|
; caller and save some code here. No return code required.
|
|
|
|
|
2009-09-26 11:35:32 +00:00
|
|
|
SETBOX: sta ptr1
|
|
|
|
stx ptr1+1 ; Save data pointer
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2009-09-26 11:35:32 +00:00
|
|
|
ldy #.sizeof (MOUSE_BOX)-1
|
|
|
|
sei
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2009-09-26 11:35:32 +00:00
|
|
|
@L1: lda (ptr1),y
|
|
|
|
sta XMin,y
|
|
|
|
dey
|
|
|
|
bpl @L1
|
|
|
|
|
|
|
|
cli
|
2013-05-09 11:56:54 +00:00
|
|
|
rts
|
2009-09-26 11:35:32 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; GETBOX: Return the mouse bounding box. The parameters are passed as they
|
|
|
|
; come from the C program, that is, a pointer to a mouse_box struct in a/x.
|
|
|
|
|
|
|
|
GETBOX: sta ptr1
|
|
|
|
stx ptr1+1 ; Save data pointer
|
|
|
|
|
|
|
|
ldy #.sizeof (MOUSE_BOX)-1
|
|
|
|
sei
|
|
|
|
|
|
|
|
@L1: lda XMin,y
|
|
|
|
sta (ptr1),y
|
|
|
|
dey
|
|
|
|
bpl @L1
|
|
|
|
|
|
|
|
cli
|
2013-05-09 11:56:54 +00:00
|
|
|
rts
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; MOVE: Move the mouse to a new position. The position is passed as it comes
|
|
|
|
; from the C program, that is: X on the stack and Y in a/x. The C wrapper will
|
|
|
|
; remove the parameter from the stack on return.
|
|
|
|
; No checks are done if the new position is valid (within the bounding box or
|
|
|
|
; the screen). No return code required.
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
MOVE: sei ; No interrupts
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
sta YPos
|
|
|
|
stx YPos+1 ; New Y position
|
|
|
|
jsr CMOVEY ; Set it
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #$01
|
|
|
|
lda (sp),y
|
|
|
|
sta XPos+1
|
|
|
|
tax
|
|
|
|
dey
|
|
|
|
lda (sp),y
|
|
|
|
sta XPos ; New X position
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr CMOVEX ; Move the cursor
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
cli ; Allow interrupts
|
|
|
|
rts
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; BUTTONS: Return the button mask in a/x.
|
|
|
|
|
|
|
|
BUTTONS:
|
2013-05-09 11:56:54 +00:00
|
|
|
lda Buttons
|
|
|
|
ldx #$00
|
2014-05-05 09:30:31 +00:00
|
|
|
|
|
|
|
; Make the buttons look like a 1351 mouse.
|
|
|
|
|
|
|
|
and #JOY::LEFT | JOY::RIGHT
|
|
|
|
lsr a
|
|
|
|
lsr a
|
2014-05-05 17:45:34 +00:00
|
|
|
;clc ; ("lsr" shifted zero into carry flag)
|
|
|
|
adc #%00001110 ; Shift bit 1 over to bit 4
|
2014-05-05 09:30:31 +00:00
|
|
|
and #MOUSE_BTN_LEFT | MOUSE_BTN_RIGHT
|
2013-05-09 11:56:54 +00:00
|
|
|
rts
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; POS: Return the mouse position in the MOUSE_POS struct pointed to by ptr1.
|
|
|
|
; No return code required.
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
POS: ldy #MOUSE_POS::XCOORD ; Structure offset
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
sei ; Disable interrupts
|
|
|
|
lda XPos ; Transfer the position
|
|
|
|
sta (ptr1),y
|
|
|
|
lda XPos+1
|
|
|
|
iny
|
|
|
|
sta (ptr1),y
|
|
|
|
lda YPos
|
|
|
|
iny
|
|
|
|
sta (ptr1),y
|
|
|
|
lda YPos+1
|
|
|
|
cli ; Enable interrupts
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
iny
|
|
|
|
sta (ptr1),y ; Store last byte
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
rts ; Done
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; INFO: Returns mouse position and current button mask in the MOUSE_INFO
|
|
|
|
; struct pointed to by ptr1. No return code required.
|
|
|
|
;
|
|
|
|
; We're cheating here to keep the code smaller: The first fields of the
|
|
|
|
; mouse_info struct are identical to the mouse_pos struct, so we will just
|
|
|
|
; call _mouse_pos to initialize the struct pointer and fill the position
|
|
|
|
; fields.
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
INFO: jsr POS
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
; Fill in the button state
|
|
|
|
|
2014-05-05 09:30:31 +00:00
|
|
|
jsr BUTTONS
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #MOUSE_INFO::BUTTONS
|
|
|
|
sta (ptr1),y
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
rts
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
|
|
|
|
; specific data in ptr1, and the ioctl code in A.
|
|
|
|
; Must return an error code in a/x.
|
|
|
|
;
|
|
|
|
|
2014-05-05 09:30:31 +00:00
|
|
|
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls for now
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx #>MOUSE_ERR_INV_IOCTL
|
|
|
|
rts
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; IRQ: Irq handler entry point. Called as a subroutine but in IRQ context
|
|
|
|
; (so be careful).
|
|
|
|
;
|
|
|
|
|
2014-01-17 20:09:15 +00:00
|
|
|
IRQ: jsr CPREP
|
2014-05-05 09:30:31 +00:00
|
|
|
lda KEY_COUNT
|
|
|
|
sta old_key_count
|
2014-01-15 21:47:59 +00:00
|
|
|
lda #$7F
|
2013-05-09 11:56:54 +00:00
|
|
|
sta CIA1_PRA
|
|
|
|
lda CIA1_PRB ; Read port #1
|
2014-05-05 09:30:31 +00:00
|
|
|
eor #%11111111 ; Make all bits active high
|
2013-05-09 11:56:54 +00:00
|
|
|
sta Buttons
|
2014-05-05 09:30:31 +00:00
|
|
|
|
|
|
|
ldx #%01000000 ; Read port 1 paddles
|
2013-05-09 11:56:54 +00:00
|
|
|
stx CIA1_PRA
|
2014-05-05 09:30:31 +00:00
|
|
|
ldy #<256
|
2013-05-09 11:56:54 +00:00
|
|
|
: dey
|
|
|
|
bne :-
|
|
|
|
ldx SID_ADConv1
|
|
|
|
stx XPos
|
|
|
|
ldx SID_ADConv2
|
|
|
|
stx YPos
|
|
|
|
|
|
|
|
lda #$FF
|
|
|
|
tax
|
|
|
|
bne @AddX ; Branch always
|
|
|
|
lda #$01
|
|
|
|
ldx #$00
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
; Calculate the new X coordinate (--> a/y)
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
@AddX: add XPos
|
|
|
|
tay ; Remember low byte
|
|
|
|
txa
|
|
|
|
adc XPos+1
|
|
|
|
tax
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
; Limit the X coordinate to the bounding box
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
cpy XMin
|
|
|
|
sbc XMin+1
|
|
|
|
bpl @L1
|
|
|
|
ldy XMin
|
|
|
|
ldx XMin+1
|
|
|
|
jmp @L2
|
|
|
|
@L1: txa
|
|
|
|
|
|
|
|
cpy XMax
|
|
|
|
sbc XMax+1
|
|
|
|
bmi @L2
|
|
|
|
ldy XMax
|
|
|
|
ldx XMax+1
|
|
|
|
@L2: sty XPos
|
|
|
|
stx XPos+1
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
; Move the mouse pointer to the new X pos
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
tya
|
|
|
|
jsr CMOVEX
|
2008-08-05 20:54:35 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
lda #$FF
|
|
|
|
tax
|
|
|
|
bne @AddY
|
|
|
|
@Down: lda #$01
|
|
|
|
ldx #$00
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
; Calculate the new Y coordinate (--> a/y)
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
@AddY: add YPos
|
|
|
|
tay ; Remember low byte
|
|
|
|
txa
|
|
|
|
adc YPos+1
|
|
|
|
tax
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
; Limit the Y coordinate to the bounding box
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
cpy YMin
|
|
|
|
sbc YMin+1
|
|
|
|
bpl @L3
|
|
|
|
ldy YMin
|
|
|
|
ldx YMin+1
|
|
|
|
jmp @L4
|
|
|
|
@L3: txa
|
|
|
|
|
|
|
|
cpy YMax
|
|
|
|
sbc YMax+1
|
|
|
|
bmi @L4
|
|
|
|
ldy YMax
|
|
|
|
ldx YMax+1
|
|
|
|
@L4: sty YPos
|
|
|
|
stx YPos+1
|
2008-08-05 20:54:35 +00:00
|
|
|
|
|
|
|
; Move the mouse pointer to the new X pos
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
tya
|
2014-01-15 21:47:59 +00:00
|
|
|
jsr CMOVEY
|
|
|
|
jsr CDRAW
|
|
|
|
clc ; Interrupt not "handled"
|
|
|
|
rts
|
2014-05-05 09:30:31 +00:00
|
|
|
|
|
|
|
.define OLD_BUTTONS Buttons ; Tells callback.inc where the old port status is stored
|
|
|
|
.include "callback.inc"
|