Changed the existing Commodore mouse drivers for the new API. UNTESTED!
git-svn-id: svn://svn.cc65.org/cc65/trunk@4232 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
; Driver for the 1351 proportional mouse. Parts of the code are from
|
; Driver for the 1351 proportional mouse. Parts of the code are from
|
||||||
; the Commodore 1351 mouse users guide.
|
; the Commodore 1351 mouse users guide.
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 2003-12-29
|
; Ullrich von Bassewitz, 2003-12-29, 2009-09-26
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
@@ -29,7 +29,8 @@ HEADER:
|
|||||||
.addr UNINSTALL
|
.addr UNINSTALL
|
||||||
.addr HIDE
|
.addr HIDE
|
||||||
.addr SHOW
|
.addr SHOW
|
||||||
.addr BOX
|
.addr SETBOX
|
||||||
|
.addr GETBOX
|
||||||
.addr MOVE
|
.addr MOVE
|
||||||
.addr BUTTONS
|
.addr BUTTONS
|
||||||
.addr POS
|
.addr POS
|
||||||
@@ -57,7 +58,8 @@ SCREEN_WIDTH = 320
|
|||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; Global variables. The bounding box values are sorted so that they can be
|
; Global variables. The bounding box values are sorted so that they can be
|
||||||
; written with the least effort in the BOX routine, so don't reorder them.
|
; written with the least effort in the SETBOX and GETBOX routines, so don't
|
||||||
|
; reorder them.
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
@@ -67,10 +69,10 @@ OldPotY: .res 1
|
|||||||
|
|
||||||
YPos: .res 2 ; Current mouse position, Y
|
YPos: .res 2 ; Current mouse position, Y
|
||||||
XPos: .res 2 ; Current mouse position, X
|
XPos: .res 2 ; Current mouse position, X
|
||||||
YMax: .res 2 ; Y2 value of bounding box
|
|
||||||
XMax: .res 2 ; X2 value of bounding box
|
|
||||||
YMin: .res 2 ; Y1 value of bounding box
|
|
||||||
XMin: .res 2 ; X1 value of bounding box
|
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
|
||||||
|
|
||||||
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
|
||||||
@@ -83,10 +85,10 @@ NewValue: .res 1 ; Temp for MoveCheck routine
|
|||||||
.byte 0, 0 ; OldPotX/OldPotY
|
.byte 0, 0 ; OldPotX/OldPotY
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
.word SCREEN_WIDTH/2 ; XPos
|
.word SCREEN_WIDTH/2 ; XPos
|
||||||
.word SCREEN_HEIGHT ; YMax
|
|
||||||
.word SCREEN_WIDTH ; XMax
|
|
||||||
.word 0 ; YMin
|
|
||||||
.word 0 ; XMin
|
.word 0 ; XMin
|
||||||
|
.word 0 ; YMin
|
||||||
|
.word SCREEN_WIDTH ; XMax
|
||||||
|
.word SCREEN_HEIGHT ; YMax
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.code
|
.code
|
||||||
@@ -157,21 +159,38 @@ SHOW: sei
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; BOX: Set the mouse bounding box. The parameters are passed as they come from
|
; SETBOX: Set the mouse bounding box. The parameters are passed as they come
|
||||||
; the C program, that is, maxy in a/x and the other parameters on the stack.
|
; from the C program, that is, a pointer to a mouse_box struct in a/x.
|
||||||
; The C wrapper will remove the parameters from the stack when the driver
|
|
||||||
; routine returns.
|
|
||||||
; No checks are done if the mouse is currently inside the box, this is the job
|
; 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
|
; of the caller. It is not necessary to validate the parameters, trust the
|
||||||
; caller and save some code here. No return code required.
|
; caller and save some code here. No return code required.
|
||||||
|
|
||||||
BOX: ldy #5
|
SETBOX: sta ptr1
|
||||||
sei
|
stx ptr1+1 ; Save data pointer
|
||||||
sta YMax
|
|
||||||
stx YMax+1
|
|
||||||
|
|
||||||
@L1: lda (sp),y
|
ldy #.sizeof (MOUSE_BOX)-1
|
||||||
sta XMax,y
|
sei
|
||||||
|
|
||||||
|
@L1: lda (ptr1),y
|
||||||
|
sta XMin,y
|
||||||
|
dey
|
||||||
|
bpl @L1
|
||||||
|
|
||||||
|
cli
|
||||||
|
rts
|
||||||
|
|
||||||
|
;----------------------------------------------------------------------------
|
||||||
|
; 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
|
dey
|
||||||
bpl @L1
|
bpl @L1
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
;
|
;
|
||||||
; Driver for a "joystick mouse".
|
; Driver for a "joystick mouse".
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 2004-04-05
|
; Ullrich von Bassewitz, 2004-04-05, 2009-09-26
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
@@ -28,7 +28,8 @@ HEADER:
|
|||||||
.addr UNINSTALL
|
.addr UNINSTALL
|
||||||
.addr HIDE
|
.addr HIDE
|
||||||
.addr SHOW
|
.addr SHOW
|
||||||
.addr BOX
|
.addr SETBOX
|
||||||
|
.addr GETBOX
|
||||||
.addr MOVE
|
.addr MOVE
|
||||||
.addr BUTTONS
|
.addr BUTTONS
|
||||||
.addr POS
|
.addr POS
|
||||||
@@ -64,17 +65,18 @@ SCREEN_WIDTH = 320
|
|||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; Global variables. The bounding box values are sorted so that they can be
|
; Global variables. The bounding box values are sorted so that they can be
|
||||||
; written with the least effort in the BOX routine, so don't reorder them.
|
; written with the least effort in the SETBOX and GETBOX routines, so don't
|
||||||
|
; reorder them.
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
Vars:
|
Vars:
|
||||||
YPos: .res 2 ; Current mouse position, Y
|
YPos: .res 2 ; Current mouse position, Y
|
||||||
XPos: .res 2 ; Current mouse position, X
|
XPos: .res 2 ; Current mouse position, X
|
||||||
YMax: .res 2 ; Y2 value of bounding box
|
|
||||||
XMax: .res 2 ; X2 value of bounding box
|
|
||||||
YMin: .res 2 ; Y1 value of bounding box
|
|
||||||
XMin: .res 2 ; X1 value of bounding box
|
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
|
Buttons: .res 1 ; Button mask
|
||||||
|
|
||||||
; Temporary value used in the int handler
|
; Temporary value used in the int handler
|
||||||
@@ -88,10 +90,10 @@ Temp: .res 1
|
|||||||
.proc DefVars
|
.proc DefVars
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
.word SCREEN_WIDTH/2 ; XPos
|
.word SCREEN_WIDTH/2 ; XPos
|
||||||
.word SCREEN_HEIGHT ; YMax
|
|
||||||
.word SCREEN_WIDTH ; XMax
|
|
||||||
.word 0 ; YMin
|
|
||||||
.word 0 ; XMin
|
.word 0 ; XMin
|
||||||
|
.word 0 ; YMin
|
||||||
|
.word SCREEN_WIDTH ; XMax
|
||||||
|
.word SCREEN_HEIGHT ; YMax
|
||||||
.byte 0 ; Buttons
|
.byte 0 ; Buttons
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
@@ -163,21 +165,38 @@ SHOW: sei
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; BOX: Set the mouse bounding box. The parameters are passed as they come from
|
; SETBOX: Set the mouse bounding box. The parameters are passed as they come
|
||||||
; the C program, that is, maxy in a/x and the other parameters on the stack.
|
; from the C program, that is, a pointer to a mouse_box struct in a/x.
|
||||||
; The C wrapper will remove the parameters from the stack when the driver
|
|
||||||
; routine returns.
|
|
||||||
; No checks are done if the mouse is currently inside the box, this is the job
|
; 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
|
; of the caller. It is not necessary to validate the parameters, trust the
|
||||||
; caller and save some code here. No return code required.
|
; caller and save some code here. No return code required.
|
||||||
|
|
||||||
BOX: ldy #5
|
SETBOX: sta ptr1
|
||||||
sei
|
stx ptr1+1 ; Save data pointer
|
||||||
sta YMax
|
|
||||||
stx YMax+1
|
|
||||||
|
|
||||||
@L1: lda (sp),y
|
ldy #.sizeof (MOUSE_BOX)-1
|
||||||
sta XMax,y
|
sei
|
||||||
|
|
||||||
|
@L1: lda (ptr1),y
|
||||||
|
sta XMin,y
|
||||||
|
dey
|
||||||
|
bpl @L1
|
||||||
|
|
||||||
|
cli
|
||||||
|
rts
|
||||||
|
|
||||||
|
;----------------------------------------------------------------------------
|
||||||
|
; 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
|
dey
|
||||||
bpl @L1
|
bpl @L1
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
;
|
;
|
||||||
; Driver for a potentiometer "mouse" e.g. Koala Pad
|
; Driver for a potentiometer "mouse" e.g. Koala Pad
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 2004-03-29
|
; Ullrich von Bassewitz, 2004-03-29, 2009-09-26
|
||||||
; Stefan Haubenthal, 2006-08-20
|
; Stefan Haubenthal, 2006-08-20
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -29,7 +29,8 @@ HEADER:
|
|||||||
.addr UNINSTALL
|
.addr UNINSTALL
|
||||||
.addr HIDE
|
.addr HIDE
|
||||||
.addr SHOW
|
.addr SHOW
|
||||||
.addr BOX
|
.addr SETBOX
|
||||||
|
.addr GETBOX
|
||||||
.addr MOVE
|
.addr MOVE
|
||||||
.addr BUTTONS
|
.addr BUTTONS
|
||||||
.addr POS
|
.addr POS
|
||||||
@@ -61,17 +62,18 @@ SCREEN_WIDTH = 320
|
|||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; Global variables. The bounding box values are sorted so that they can be
|
; Global variables. The bounding box values are sorted so that they can be
|
||||||
; written with the least effort in the BOX routine, so don't reorder them.
|
; written with the least effort in the SETBOX and GETBOX routines, so don't
|
||||||
|
; reorder them.
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
Vars:
|
Vars:
|
||||||
YPos: .res 2 ; Current mouse position, Y
|
YPos: .res 2 ; Current mouse position, Y
|
||||||
XPos: .res 2 ; Current mouse position, X
|
XPos: .res 2 ; Current mouse position, X
|
||||||
YMax: .res 2 ; Y2 value of bounding box
|
|
||||||
XMax: .res 2 ; X2 value of bounding box
|
|
||||||
YMin: .res 2 ; Y1 value of bounding box
|
|
||||||
XMin: .res 2 ; X1 value of bounding box
|
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
|
Buttons: .res 1 ; Button mask
|
||||||
|
|
||||||
; Temporary value used in the int handler
|
; Temporary value used in the int handler
|
||||||
@@ -85,10 +87,10 @@ Temp: .res 1
|
|||||||
.proc DefVars
|
.proc DefVars
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
.word SCREEN_WIDTH/2 ; XPos
|
.word SCREEN_WIDTH/2 ; XPos
|
||||||
.word SCREEN_HEIGHT ; YMax
|
|
||||||
.word SCREEN_WIDTH ; XMax
|
|
||||||
.word 0 ; YMin
|
|
||||||
.word 0 ; XMin
|
.word 0 ; XMin
|
||||||
|
.word 0 ; YMin
|
||||||
|
.word SCREEN_WIDTH ; XMax
|
||||||
|
.word SCREEN_HEIGHT ; YMax
|
||||||
.byte 0 ; Buttons
|
.byte 0 ; Buttons
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
@@ -160,21 +162,38 @@ SHOW: sei
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; BOX: Set the mouse bounding box. The parameters are passed as they come from
|
; SETBOX: Set the mouse bounding box. The parameters are passed as they come
|
||||||
; the C program, that is, maxy in a/x and the other parameters on the stack.
|
; from the C program, that is, a pointer to a mouse_box struct in a/x.
|
||||||
; The C wrapper will remove the parameters from the stack when the driver
|
|
||||||
; routine returns.
|
|
||||||
; No checks are done if the mouse is currently inside the box, this is the job
|
; 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
|
; of the caller. It is not necessary to validate the parameters, trust the
|
||||||
; caller and save some code here. No return code required.
|
; caller and save some code here. No return code required.
|
||||||
|
|
||||||
BOX: ldy #5
|
SETBOX: sta ptr1
|
||||||
sei
|
stx ptr1+1 ; Save data pointer
|
||||||
sta YMax
|
|
||||||
stx YMax+1
|
|
||||||
|
|
||||||
@L1: lda (sp),y
|
ldy #.sizeof (MOUSE_BOX)-1
|
||||||
sta XMax,y
|
sei
|
||||||
|
|
||||||
|
@L1: lda (ptr1),y
|
||||||
|
sta XMin,y
|
||||||
|
dey
|
||||||
|
bpl @L1
|
||||||
|
|
||||||
|
cli
|
||||||
|
rts
|
||||||
|
|
||||||
|
;----------------------------------------------------------------------------
|
||||||
|
; 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
|
dey
|
||||||
bpl @L1
|
bpl @L1
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
; Driver for the 1351 proportional mouse. Parts of the code are from
|
; Driver for the 1351 proportional mouse. Parts of the code are from
|
||||||
; the Commodore 1351 mouse users guide.
|
; the Commodore 1351 mouse users guide.
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 2003-12-29
|
; Ullrich von Bassewitz, 2003-12-29, 2009-09-26
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
@@ -29,7 +29,8 @@ HEADER:
|
|||||||
.addr UNINSTALL
|
.addr UNINSTALL
|
||||||
.addr HIDE
|
.addr HIDE
|
||||||
.addr SHOW
|
.addr SHOW
|
||||||
.addr BOX
|
.addr SETBOX
|
||||||
|
.addr GETBOX
|
||||||
.addr MOVE
|
.addr MOVE
|
||||||
.addr BUTTONS
|
.addr BUTTONS
|
||||||
.addr POS
|
.addr POS
|
||||||
@@ -57,7 +58,8 @@ SCREEN_WIDTH = 320
|
|||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; Global variables. The bounding box values are sorted so that they can be
|
; Global variables. The bounding box values are sorted so that they can be
|
||||||
; written with the least effort in the BOX routine, so don't reorder them.
|
; written with the least effort in the SETBOX and GETBOX routines, so don't
|
||||||
|
; reorder them.
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
@@ -67,10 +69,10 @@ OldPotY: .res 1
|
|||||||
|
|
||||||
YPos: .res 2 ; Current mouse position, Y
|
YPos: .res 2 ; Current mouse position, Y
|
||||||
XPos: .res 2 ; Current mouse position, X
|
XPos: .res 2 ; Current mouse position, X
|
||||||
YMax: .res 2 ; Y2 value of bounding box
|
|
||||||
XMax: .res 2 ; X2 value of bounding box
|
|
||||||
YMin: .res 2 ; Y1 value of bounding box
|
|
||||||
XMin: .res 2 ; X1 value of bounding box
|
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
|
||||||
|
|
||||||
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
|
||||||
@@ -83,10 +85,10 @@ NewValue: .res 1 ; Temp for MoveCheck routine
|
|||||||
.byte 0, 0 ; OldPotX/OldPotY
|
.byte 0, 0 ; OldPotX/OldPotY
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
.word SCREEN_WIDTH/2 ; XPos
|
.word SCREEN_WIDTH/2 ; XPos
|
||||||
.word SCREEN_HEIGHT ; YMax
|
|
||||||
.word SCREEN_WIDTH ; XMax
|
|
||||||
.word 0 ; YMin
|
|
||||||
.word 0 ; XMin
|
.word 0 ; XMin
|
||||||
|
.word 0 ; YMin
|
||||||
|
.word SCREEN_WIDTH ; XMax
|
||||||
|
.word SCREEN_HEIGHT ; YMax
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.code
|
.code
|
||||||
@@ -157,21 +159,38 @@ SHOW: sei
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; BOX: Set the mouse bounding box. The parameters are passed as they come from
|
; SETBOX: Set the mouse bounding box. The parameters are passed as they come
|
||||||
; the C program, that is, maxy in a/x and the other parameters on the stack.
|
; from the C program, that is, a pointer to a mouse_box struct in a/x.
|
||||||
; The C wrapper will remove the parameters from the stack when the driver
|
|
||||||
; routine returns.
|
|
||||||
; No checks are done if the mouse is currently inside the box, this is the job
|
; 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
|
; of the caller. It is not necessary to validate the parameters, trust the
|
||||||
; caller and save some code here. No return code required.
|
; caller and save some code here. No return code required.
|
||||||
|
|
||||||
BOX: ldy #5
|
SETBOX: sta ptr1
|
||||||
sei
|
stx ptr1+1 ; Save data pointer
|
||||||
sta YMax
|
|
||||||
stx YMax+1
|
|
||||||
|
|
||||||
@L1: lda (sp),y
|
ldy #.sizeof (MOUSE_BOX)-1
|
||||||
sta XMax,y
|
sei
|
||||||
|
|
||||||
|
@L1: lda (ptr1),y
|
||||||
|
sta XMin,y
|
||||||
|
dey
|
||||||
|
bpl @L1
|
||||||
|
|
||||||
|
cli
|
||||||
|
rts
|
||||||
|
|
||||||
|
;----------------------------------------------------------------------------
|
||||||
|
; 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
|
dey
|
||||||
bpl @L1
|
bpl @L1
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
;
|
;
|
||||||
; Driver for a "joystick mouse".
|
; Driver for a "joystick mouse".
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 2004-03-29
|
; Ullrich von Bassewitz, 2004-03-29, 2009-09-26
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
@@ -28,7 +28,8 @@ HEADER:
|
|||||||
.addr UNINSTALL
|
.addr UNINSTALL
|
||||||
.addr HIDE
|
.addr HIDE
|
||||||
.addr SHOW
|
.addr SHOW
|
||||||
.addr BOX
|
.addr SETBOX
|
||||||
|
.addr GETBOX
|
||||||
.addr MOVE
|
.addr MOVE
|
||||||
.addr BUTTONS
|
.addr BUTTONS
|
||||||
.addr POS
|
.addr POS
|
||||||
@@ -64,17 +65,18 @@ SCREEN_WIDTH = 320
|
|||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; Global variables. The bounding box values are sorted so that they can be
|
; Global variables. The bounding box values are sorted so that they can be
|
||||||
; written with the least effort in the BOX routine, so don't reorder them.
|
; written with the least effort in the SETBOX and GETBOX routines, so don't
|
||||||
|
; reorder them.
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
Vars:
|
Vars:
|
||||||
YPos: .res 2 ; Current mouse position, Y
|
YPos: .res 2 ; Current mouse position, Y
|
||||||
XPos: .res 2 ; Current mouse position, X
|
XPos: .res 2 ; Current mouse position, X
|
||||||
YMax: .res 2 ; Y2 value of bounding box
|
|
||||||
XMax: .res 2 ; X2 value of bounding box
|
|
||||||
YMin: .res 2 ; Y1 value of bounding box
|
|
||||||
XMin: .res 2 ; X1 value of bounding box
|
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
|
Buttons: .res 1 ; Button mask
|
||||||
|
|
||||||
; Temporary value used in the int handler
|
; Temporary value used in the int handler
|
||||||
@@ -88,10 +90,10 @@ Temp: .res 1
|
|||||||
.proc DefVars
|
.proc DefVars
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
.word SCREEN_WIDTH/2 ; XPos
|
.word SCREEN_WIDTH/2 ; XPos
|
||||||
.word SCREEN_HEIGHT ; YMax
|
|
||||||
.word SCREEN_WIDTH ; XMax
|
|
||||||
.word 0 ; YMin
|
|
||||||
.word 0 ; XMin
|
.word 0 ; XMin
|
||||||
|
.word 0 ; YMin
|
||||||
|
.word SCREEN_WIDTH ; XMax
|
||||||
|
.word SCREEN_HEIGHT ; YMax
|
||||||
.byte 0 ; Buttons
|
.byte 0 ; Buttons
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
@@ -163,21 +165,38 @@ SHOW: sei
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; BOX: Set the mouse bounding box. The parameters are passed as they come from
|
; SETBOX: Set the mouse bounding box. The parameters are passed as they come
|
||||||
; the C program, that is, maxy in a/x and the other parameters on the stack.
|
; from the C program, that is, a pointer to a mouse_box struct in a/x.
|
||||||
; The C wrapper will remove the parameters from the stack when the driver
|
|
||||||
; routine returns.
|
|
||||||
; No checks are done if the mouse is currently inside the box, this is the job
|
; 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
|
; of the caller. It is not necessary to validate the parameters, trust the
|
||||||
; caller and save some code here. No return code required.
|
; caller and save some code here. No return code required.
|
||||||
|
|
||||||
BOX: ldy #5
|
SETBOX: sta ptr1
|
||||||
sei
|
stx ptr1+1 ; Save data pointer
|
||||||
sta YMax
|
|
||||||
stx YMax+1
|
|
||||||
|
|
||||||
@L1: lda (sp),y
|
ldy #.sizeof (MOUSE_BOX)-1
|
||||||
sta XMax,y
|
sei
|
||||||
|
|
||||||
|
@L1: lda (ptr1),y
|
||||||
|
sta XMin,y
|
||||||
|
dey
|
||||||
|
bpl @L1
|
||||||
|
|
||||||
|
cli
|
||||||
|
rts
|
||||||
|
|
||||||
|
;----------------------------------------------------------------------------
|
||||||
|
; 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
|
dey
|
||||||
bpl @L1
|
bpl @L1
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
;
|
;
|
||||||
; Driver for a potentiometer "mouse" e.g. Koala Pad
|
; Driver for a potentiometer "mouse" e.g. Koala Pad
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 2004-03-29
|
; Ullrich von Bassewitz, 2004-03-29, 2009-09-26
|
||||||
; Stefan Haubenthal, 2006-08-20
|
; Stefan Haubenthal, 2006-08-20
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -29,7 +29,8 @@ HEADER:
|
|||||||
.addr UNINSTALL
|
.addr UNINSTALL
|
||||||
.addr HIDE
|
.addr HIDE
|
||||||
.addr SHOW
|
.addr SHOW
|
||||||
.addr BOX
|
.addr SETBOX
|
||||||
|
.addr GETBOX
|
||||||
.addr MOVE
|
.addr MOVE
|
||||||
.addr BUTTONS
|
.addr BUTTONS
|
||||||
.addr POS
|
.addr POS
|
||||||
@@ -61,17 +62,18 @@ SCREEN_WIDTH = 320
|
|||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; Global variables. The bounding box values are sorted so that they can be
|
; Global variables. The bounding box values are sorted so that they can be
|
||||||
; written with the least effort in the BOX routine, so don't reorder them.
|
; written with the least effort in the SETBOX and GETBOX routines, so don't
|
||||||
|
; reorder them.
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
Vars:
|
Vars:
|
||||||
YPos: .res 2 ; Current mouse position, Y
|
YPos: .res 2 ; Current mouse position, Y
|
||||||
XPos: .res 2 ; Current mouse position, X
|
XPos: .res 2 ; Current mouse position, X
|
||||||
YMax: .res 2 ; Y2 value of bounding box
|
|
||||||
XMax: .res 2 ; X2 value of bounding box
|
|
||||||
YMin: .res 2 ; Y1 value of bounding box
|
|
||||||
XMin: .res 2 ; X1 value of bounding box
|
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
|
Buttons: .res 1 ; Button mask
|
||||||
|
|
||||||
; Temporary value used in the int handler
|
; Temporary value used in the int handler
|
||||||
@@ -85,10 +87,10 @@ Temp: .res 1
|
|||||||
.proc DefVars
|
.proc DefVars
|
||||||
.word SCREEN_HEIGHT/2 ; YPos
|
.word SCREEN_HEIGHT/2 ; YPos
|
||||||
.word SCREEN_WIDTH/2 ; XPos
|
.word SCREEN_WIDTH/2 ; XPos
|
||||||
.word SCREEN_HEIGHT ; YMax
|
|
||||||
.word SCREEN_WIDTH ; XMax
|
|
||||||
.word 0 ; YMin
|
|
||||||
.word 0 ; XMin
|
.word 0 ; XMin
|
||||||
|
.word 0 ; YMin
|
||||||
|
.word SCREEN_WIDTH ; XMax
|
||||||
|
.word SCREEN_HEIGHT ; YMax
|
||||||
.byte 0 ; Buttons
|
.byte 0 ; Buttons
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
@@ -160,21 +162,38 @@ SHOW: sei
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; BOX: Set the mouse bounding box. The parameters are passed as they come from
|
; SETBOX: Set the mouse bounding box. The parameters are passed as they come
|
||||||
; the C program, that is, maxy in a/x and the other parameters on the stack.
|
; from the C program, that is, a pointer to a mouse_box struct in a/x.
|
||||||
; The C wrapper will remove the parameters from the stack when the driver
|
|
||||||
; routine returns.
|
|
||||||
; No checks are done if the mouse is currently inside the box, this is the job
|
; 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
|
; of the caller. It is not necessary to validate the parameters, trust the
|
||||||
; caller and save some code here. No return code required.
|
; caller and save some code here. No return code required.
|
||||||
|
|
||||||
BOX: ldy #5
|
SETBOX: sta ptr1
|
||||||
sei
|
stx ptr1+1 ; Save data pointer
|
||||||
sta YMax
|
|
||||||
stx YMax+1
|
|
||||||
|
|
||||||
@L1: lda (sp),y
|
ldy #.sizeof (MOUSE_BOX)-1
|
||||||
sta XMax,y
|
sei
|
||||||
|
|
||||||
|
@L1: lda (ptr1),y
|
||||||
|
sta XMin,y
|
||||||
|
dey
|
||||||
|
bpl @L1
|
||||||
|
|
||||||
|
cli
|
||||||
|
rts
|
||||||
|
|
||||||
|
;----------------------------------------------------------------------------
|
||||||
|
; 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
|
dey
|
||||||
bpl @L1
|
bpl @L1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user