mirror of
https://github.com/A2osX/A2osX.git
synced 2024-06-11 12:29:35 +00:00
152 lines
3.2 KiB
Plaintext
152 lines
3.2 KiB
Plaintext
|
PR#3
|
|||
|
PREFIX /A2OSX.BUILD
|
|||
|
NEW
|
|||
|
INC 1
|
|||
|
AUTO 6
|
|||
|
.LIST OFF
|
|||
|
.OP 65C02
|
|||
|
.OR $2000
|
|||
|
.TF DRV/MOUSE.DRV
|
|||
|
*--------------------------------------
|
|||
|
.INB INC/MACROS.I
|
|||
|
.INB INC/A2OSX.I
|
|||
|
*--------------------------------------
|
|||
|
ZPGoMouse .EQ ZPDRV
|
|||
|
ZPTmpPtr1 .EQ ZPDRV+2
|
|||
|
*--------------------------------------
|
|||
|
SETMOUSE .EQ $12 Sets mouse mode
|
|||
|
SERVEMOUSE .EQ $13 Services mouse interrupt
|
|||
|
READMOUSE .EQ $14 Reads mouse position
|
|||
|
CLEARMOUSE .EQ $15 Clears mouse position to 0 (for delta mode)
|
|||
|
POSMOUSE .EQ $16 Sets mouse position to a user-defined pos
|
|||
|
CLAMPMOUSE .EQ $17 Sets mouse bounds in a window
|
|||
|
HOMEMOUSE .EQ $18 Sets mouse to upper-left corner of clamp win
|
|||
|
INITMOUSE .EQ $19 Resets mouse clamps to default values,sets mouse position to 0,0
|
|||
|
XCLAMPLO .EQ $0478 low byte of low clamp.
|
|||
|
XCLAMPHI .EQ $04F8 low byte of high clamp.
|
|||
|
YCLAMPLO .EQ $0578 high byte of low clamp.
|
|||
|
YCLAMPHI .EQ $05F8 high byte of high clamp.
|
|||
|
*--------------------------------------
|
|||
|
* Main DRV entry point
|
|||
|
* input :
|
|||
|
* X = CMD
|
|||
|
* 0 : OPEN
|
|||
|
* 2 : GETEVENT
|
|||
|
* 4 : OUT
|
|||
|
* 6 : CLOSE
|
|||
|
*--------------------------------------
|
|||
|
* CLD $D8
|
|||
|
* JMP (*,x) $7C
|
|||
|
* #JMPTABLE
|
|||
|
* /JMPTABLE
|
|||
|
*--------------------------------------
|
|||
|
CS.START cld
|
|||
|
jmp (.1,x)
|
|||
|
.1 .DA OPEN
|
|||
|
.DA GETEVENT
|
|||
|
.DA OUT
|
|||
|
.DA CLOSE
|
|||
|
.DA 0 end or relocation
|
|||
|
.DA CS.END-CS.START
|
|||
|
*--------------------------------------
|
|||
|
OPEN stz ZPTmpPtr1
|
|||
|
lda #$C1
|
|||
|
sta ZPTmpPtr1+1
|
|||
|
|
|||
|
.1 ldx #DEVSIG.Length-1
|
|||
|
|
|||
|
.2 ldy DEVSIG.Offset,x
|
|||
|
lda (ZPTmpPtr1),y
|
|||
|
cmp DEVSIG.Value,x
|
|||
|
beq .3
|
|||
|
|
|||
|
inc ZPTmpPtr1+1 no match, try next slot....
|
|||
|
lda ZPTmpPtr1+1
|
|||
|
cmp #$C8
|
|||
|
bne .1
|
|||
|
beq .99 Not Found in any slot, exiting
|
|||
|
|
|||
|
.3 dex
|
|||
|
bpl .2
|
|||
|
|
|||
|
lda ZPTmpPtr1+1
|
|||
|
and #$0F
|
|||
|
pha
|
|||
|
ora #$30
|
|||
|
sta DEVNAME+4
|
|||
|
pla
|
|||
|
ora #$C0
|
|||
|
sta DEVSLOTCn
|
|||
|
asl
|
|||
|
asl
|
|||
|
asl
|
|||
|
asl
|
|||
|
sta DEVSLOTn0
|
|||
|
|
|||
|
ldx #0
|
|||
|
ldy #S.DEV.NAME
|
|||
|
|
|||
|
.7 lda DEVNAME,x
|
|||
|
sta (pDevContext),y
|
|||
|
cpx DEVNAME
|
|||
|
beq .8
|
|||
|
inx
|
|||
|
iny
|
|||
|
bne .7
|
|||
|
|
|||
|
lda #1 Enable, Polling mode
|
|||
|
ldy #SETMOUSE
|
|||
|
jsr GOMOUSE
|
|||
|
|
|||
|
ldy #INITMOUSE Reset
|
|||
|
jsr GOMOUSE
|
|||
|
|
|||
|
* lda #0 set X
|
|||
|
* ldy #CLAMPMOUSE
|
|||
|
* jsr GOMOUSE
|
|||
|
|
|||
|
* lda #1 set Y
|
|||
|
* ldy #CLAMPMOUSE
|
|||
|
* jsr GOMOUSE
|
|||
|
|
|||
|
.8 lda #S.DEV.F.MOUSE+S.DEV.F.EVENT
|
|||
|
sta (pDevContext)
|
|||
|
clc
|
|||
|
rts
|
|||
|
|
|||
|
.99 lda #DEVMGR.ERRNOHW
|
|||
|
sec
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
GETEVENT >PULLW pEvent
|
|||
|
lda #0
|
|||
|
sec
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
OUT clc
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
CLOSE clc
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
GOMOUSE pha
|
|||
|
stz ZPGoMouse
|
|||
|
lda DEVSLOTCn
|
|||
|
sta ZPGoMouse+1
|
|||
|
lda (ZPGoMouse),y
|
|||
|
sta ZPGoMouse
|
|||
|
pla
|
|||
|
jmp (ZPGoMouse)
|
|||
|
*--------------------------------------
|
|||
|
CS.END
|
|||
|
DEVSIG.Offset .HS 05070B0CFB
|
|||
|
DEVSIG.Value .HS 38180120D6
|
|||
|
DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset
|
|||
|
DEVNAME >PSTRING "MOU0"
|
|||
|
DEVSLOTCn .BS 1
|
|||
|
DEVSLOTn0 .BS 1
|
|||
|
*--------------------------------------
|
|||
|
MAN
|
|||
|
SAVE DRV/MOUSE.DRV.S
|
|||
|
ASM
|