2015-03-17 22:05:33 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.BUILD
|
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
|
|
|
|
.TF DRV/MOUSE.DRV
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB INC/MACROS.I
|
2015-03-23 07:28:03 +00:00
|
|
|
|
.INB INC/IO.I
|
2015-03-17 22:05:33 +00:00
|
|
|
|
.INB INC/A2OSX.I
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPGoMouse .EQ ZPDRV
|
|
|
|
|
ZPTmpPtr1 .EQ ZPDRV+2
|
|
|
|
|
*--------------------------------------
|
2015-03-23 07:28:03 +00:00
|
|
|
|
EVENT.MOUSEUP .EQ %00000001
|
|
|
|
|
EVENT.MOUSEDOWN .EQ %00000010
|
|
|
|
|
EVENT.MOUSEMOVE .EQ %00000100
|
|
|
|
|
EVENT.MOUSEDRAG .EQ %00001000
|
|
|
|
|
EVENT.MOUSECLK .EQ %00010000
|
|
|
|
|
EVENT.MOUSEDCLK .EQ %00100000
|
|
|
|
|
*--------------------------------------
|
2015-03-17 22:05:33 +00:00
|
|
|
|
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
|
2015-03-23 07:28:03 +00:00
|
|
|
|
LOCLAMPLO .EQ $0478 low byte of low clamp.
|
|
|
|
|
HICLAMPLO .EQ $04F8 low byte of high clamp.
|
|
|
|
|
LOCLAMPHI .EQ $0578 high byte of low clamp.
|
|
|
|
|
HICLAMPHI .EQ $05F8 high byte of high clamp.
|
|
|
|
|
MOUSEXLOx .EQ $0478
|
|
|
|
|
MOUSEYLOx .EQ $04F8
|
|
|
|
|
MOUSEXHIx .EQ $0578
|
|
|
|
|
MOUSEYHIx .EQ $05F8
|
|
|
|
|
MOUSESTSx .EQ $0778
|
|
|
|
|
MOUSESTSx.DOWN .EQ %10000000
|
|
|
|
|
MOUSESTSx.LDOWN .EQ %01000000
|
|
|
|
|
MOUSESTSx.MOVED .EQ %00100000
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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
|
2015-03-23 07:28:03 +00:00
|
|
|
|
bne .3
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
bra .10
|
2015-03-17 22:05:33 +00:00
|
|
|
|
|
2015-03-23 07:28:03 +00:00
|
|
|
|
.3 inc ZPTmpPtr1+1 no match, try next slot....
|
2015-03-17 22:05:33 +00:00
|
|
|
|
lda ZPTmpPtr1+1
|
|
|
|
|
cmp #$C8
|
|
|
|
|
bne .1
|
|
|
|
|
|
2015-03-23 07:28:03 +00:00
|
|
|
|
lda #DEVMGR.ERRNOHW Not Found in any slot, exiting
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.10 lda ZPTmpPtr1+1
|
2015-03-17 22:05:33 +00:00
|
|
|
|
and #$0F
|
2015-03-23 07:28:03 +00:00
|
|
|
|
sta DEVSLOT0n
|
2015-03-17 22:05:33 +00:00
|
|
|
|
pha
|
|
|
|
|
ora #$30
|
|
|
|
|
sta DEVNAME+4
|
|
|
|
|
pla
|
|
|
|
|
ora #$C0
|
|
|
|
|
sta DEVSLOTCn
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
sta DEVSLOTn0
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
ldy #S.DEV.NAME
|
|
|
|
|
|
2015-03-23 07:28:03 +00:00
|
|
|
|
.4 lda DEVNAME,x
|
2015-03-17 22:05:33 +00:00
|
|
|
|
sta (pDevContext),y
|
|
|
|
|
cpx DEVNAME
|
2015-03-23 07:28:03 +00:00
|
|
|
|
beq .5
|
2015-03-17 22:05:33 +00:00
|
|
|
|
inx
|
|
|
|
|
iny
|
2015-03-23 07:28:03 +00:00
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
.5 bit RROMBNK2 Renable ROM to allow MOUSE II firmware
|
|
|
|
|
|
|
|
|
|
php to read IIe ROM ID bytes
|
|
|
|
|
sei
|
|
|
|
|
|
|
|
|
|
lda RD80STORE
|
|
|
|
|
pha
|
|
|
|
|
sta CLR80STORE
|
2015-03-17 22:05:33 +00:00
|
|
|
|
|
|
|
|
|
lda #1 Enable, Polling mode
|
|
|
|
|
ldy #SETMOUSE
|
|
|
|
|
jsr GOMOUSE
|
|
|
|
|
|
|
|
|
|
ldy #INITMOUSE Reset
|
|
|
|
|
jsr GOMOUSE
|
2015-03-23 07:28:03 +00:00
|
|
|
|
|
|
|
|
|
stz LOCLAMPLO
|
|
|
|
|
stz LOCLAMPHI
|
|
|
|
|
lda #559
|
|
|
|
|
sta HICLAMPLO
|
|
|
|
|
lda /559
|
|
|
|
|
sta HICLAMPHI
|
2015-03-17 22:05:33 +00:00
|
|
|
|
|
2015-03-23 07:28:03 +00:00
|
|
|
|
lda #0 set X
|
|
|
|
|
ldy #CLAMPMOUSE
|
|
|
|
|
jsr GOMOUSE
|
2015-03-17 22:05:33 +00:00
|
|
|
|
|
2015-03-23 07:28:03 +00:00
|
|
|
|
stz LOCLAMPLO
|
|
|
|
|
stz LOCLAMPHI
|
|
|
|
|
lda #191
|
|
|
|
|
sta HICLAMPLO
|
|
|
|
|
lda /191
|
|
|
|
|
sta HICLAMPHI
|
2015-03-17 22:05:33 +00:00
|
|
|
|
|
2015-03-23 07:28:03 +00:00
|
|
|
|
lda #1 set Y
|
|
|
|
|
ldy #CLAMPMOUSE
|
|
|
|
|
jsr GOMOUSE
|
|
|
|
|
|
|
|
|
|
ldy #HOMEMOUSE
|
|
|
|
|
jsr GOMOUSE
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
bpl .6
|
|
|
|
|
sta SET80STORE
|
|
|
|
|
|
|
|
|
|
.6 plp
|
|
|
|
|
|
|
|
|
|
lda #S.DEV.F.MOUSE+S.DEV.F.EVENT
|
2015-03-17 22:05:33 +00:00
|
|
|
|
sta (pDevContext)
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
GETEVENT >PULLW pEvent
|
2015-03-23 07:28:03 +00:00
|
|
|
|
|
|
|
|
|
php
|
|
|
|
|
sei
|
|
|
|
|
|
|
|
|
|
lda RD80STORE
|
|
|
|
|
pha
|
|
|
|
|
sta CLR80STORE
|
|
|
|
|
|
|
|
|
|
ldy #READMOUSE
|
|
|
|
|
jsr GOMOUSE
|
|
|
|
|
|
|
|
|
|
ldx DEVSLOT0n
|
|
|
|
|
ldy #S.EVT.DATALO
|
|
|
|
|
|
|
|
|
|
lda MOUSESTSx,x
|
|
|
|
|
and #MOUSESTSx.DOWN+MOUSESTSx.LDOWN
|
|
|
|
|
beq .3 no button state change:up & previously up
|
|
|
|
|
cmp #MOUSESTSx.DOWN+MOUSESTSx.LDOWN
|
|
|
|
|
beq .3 no button state change:down & previously down
|
|
|
|
|
|
|
|
|
|
asl if CS, down & previoulsy up
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
lda #EVENT.MOUSEUP
|
|
|
|
|
bra .2
|
|
|
|
|
|
|
|
|
|
.1 lda #EVENT.MOUSEDOWN
|
|
|
|
|
|
|
|
|
|
.2 sta (pEvent),y
|
|
|
|
|
|
|
|
|
|
.3 lda MOUSESTSx,x
|
|
|
|
|
and #MOUSESTSx.MOVED
|
|
|
|
|
beq .4
|
|
|
|
|
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
ora #EVENT.MOUSEMOVE
|
|
|
|
|
sta (pEvent),y
|
|
|
|
|
|
|
|
|
|
ldy #S.EVT.DATAW1
|
|
|
|
|
lda MOUSEXLOx,x
|
|
|
|
|
sta (pEvent),y
|
|
|
|
|
iny
|
|
|
|
|
lda MOUSEXHIx,x
|
|
|
|
|
sta (pEvent),y
|
|
|
|
|
iny
|
|
|
|
|
lda MOUSEYLOx,x
|
|
|
|
|
sta (pEvent),y
|
|
|
|
|
iny
|
|
|
|
|
lda MOUSEYHIx,x
|
|
|
|
|
sta (pEvent),y
|
|
|
|
|
|
|
|
|
|
.4 pla
|
|
|
|
|
bpl .5
|
|
|
|
|
sta SET80STORE
|
|
|
|
|
|
|
|
|
|
.5 plp
|
|
|
|
|
ldy #S.EVT.DATALO
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
lda #S.EVT.F.MOUSE
|
|
|
|
|
sta (pEvent)
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec A=0 : no event
|
2015-03-17 22:05:33 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
OUT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-03-23 07:28:03 +00:00
|
|
|
|
CLOSE php
|
|
|
|
|
sei
|
|
|
|
|
lda #0 Disable
|
|
|
|
|
ldy #SETMOUSE
|
|
|
|
|
jsr GOMOUSE
|
|
|
|
|
plp
|
|
|
|
|
clc
|
2015-03-17 22:05:33 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
GOMOUSE pha
|
|
|
|
|
stz ZPGoMouse
|
2015-03-23 07:28:03 +00:00
|
|
|
|
ldx DEVSLOTCn
|
|
|
|
|
stx ZPGoMouse+1
|
2015-03-17 22:05:33 +00:00
|
|
|
|
lda (ZPGoMouse),y
|
|
|
|
|
sta ZPGoMouse
|
2015-03-23 07:28:03 +00:00
|
|
|
|
ldy DEVSLOTn0
|
2015-03-17 22:05:33 +00:00
|
|
|
|
pla
|
|
|
|
|
jmp (ZPGoMouse)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
DEVSIG.Offset .HS 05070B0CFB
|
|
|
|
|
DEVSIG.Value .HS 38180120D6
|
|
|
|
|
DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset
|
|
|
|
|
DEVNAME >PSTRING "MOU0"
|
2015-03-23 07:28:03 +00:00
|
|
|
|
DEVSLOT0n .BS 1
|
2015-03-17 22:05:33 +00:00
|
|
|
|
DEVSLOTCn .BS 1
|
|
|
|
|
DEVSLOTn0 .BS 1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE DRV/MOUSE.DRV.S
|
|
|
|
|
ASM
|