2015-03-17 22:05:33 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-17 22:05:33 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.TF /A2OSX.BOOT/DRV/MOUSE.DRV
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-26 20:51:06 +00:00
|
|
|
|
.INB /A2OSX.DEV/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.DEV/INC/A2OSX.I
|
2017-02-28 16:58:36 +00:00
|
|
|
|
.INB /A2OSX.DEV/INC/MLI.ERR.I
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
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
|
2017-01-27 16:26:09 +00:00
|
|
|
|
* .EQ $0678
|
|
|
|
|
* .EQ $06F8
|
2015-03-23 07:28:03 +00:00
|
|
|
|
MOUSESTSx .EQ $0778
|
2017-01-27 16:26:09 +00:00
|
|
|
|
MOUSESTSx.DOWN .EQ %10000000
|
|
|
|
|
MOUSESTSx.LDOWN .EQ %01000000
|
|
|
|
|
MOUSESTSx.MOVED .EQ %00100000
|
|
|
|
|
MOUSESTSx.INTVBL .EQ %00001000
|
|
|
|
|
MOUSESTSx.INTBUT .EQ %00000100
|
|
|
|
|
MOUSESTSx.INTMOVE .EQ %00000010
|
|
|
|
|
MOUSEMODx .EQ $07F8
|
|
|
|
|
MOUSEMODx.INTVBL .EQ %00001000
|
|
|
|
|
MOUSEMODx.INTBUT .EQ %00000100
|
|
|
|
|
MOUSEMODx.INTMOVE .EQ %00000010
|
|
|
|
|
MOUSEMODx.ACTIVE .EQ %00000001
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* File Header (16 Bytes)
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jmp Dev.Detect cld,jmp abs=DRV
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 DRV Layout Version 1
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA CS.END-CS.START Code Length
|
|
|
|
|
.DA DEV.HEADER-CS.START Device Header Offset
|
|
|
|
|
.DA DRV.CS.START-CS.START Driver Code Offset
|
|
|
|
|
.DA DRV.CS.END-DRV.CS.START Drv Code Length
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
L.MSG.DETECT .DA MSG.DETECT
|
|
|
|
|
L.MSG.DETECT.OK .DA MSG.DETECT.OK
|
|
|
|
|
L.MSG.DETECT.KO .DA MSG.DETECT.KO
|
|
|
|
|
L.DEV.HEADER.NAME .DA DEV.HEADER.NAME
|
|
|
|
|
.DA 0 End Of Reloc Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Dev.Detect >LDYA L.MSG.DETECT
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
stz ZPTmpPtr1
|
2015-03-17 22:05:33 +00:00
|
|
|
|
lda #$C1
|
|
|
|
|
sta ZPTmpPtr1+1
|
|
|
|
|
|
2017-01-27 16:26:09 +00:00
|
|
|
|
.1 ldx #DEVSIG.Value-DEVSIG.Offset-1
|
2015-03-17 22:05:33 +00:00
|
|
|
|
|
|
|
|
|
.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
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bra .4
|
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-06-03 18:30:57 +00:00
|
|
|
|
>LDYA L.MSG.DETECT.KO
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-01-27 16:26:09 +00:00
|
|
|
|
lda #MLI.ERR.NODEV
|
2015-03-23 07:28:03 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.4 lda ZPTmpPtr1+1
|
|
|
|
|
sta DEVSLOTCn
|
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
|
|
|
|
ora #$30
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta DEV.HEADER.NAME+4
|
2015-03-17 22:05:33 +00:00
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
sta DEVSLOTn0
|
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>PUSHW L.DEV.HEADER.NAME
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>LDYA L.MSG.DETECT.OK
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2017-02-28 16:58:36 +00:00
|
|
|
|
MSG.DETECT >CSTR "Apple Mouse Card/IIc Mouse Driver.\r\n"
|
|
|
|
|
MSG.DETECT.OK >CSTR "Mouse Installed As Device : %S\r\n"
|
|
|
|
|
MSG.DETECT.KO >CSTR "No Mouse Found.\r\n"
|
2016-06-07 06:10:18 +00:00
|
|
|
|
DEVSIG.Offset .HS 05070B0CFB
|
|
|
|
|
DEVSIG.Value .HS 38180120D6
|
2015-06-03 18:30:57 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Device Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
2017-01-27 16:26:09 +00:00
|
|
|
|
DEV.HEADER .DA DRV.CS.START
|
|
|
|
|
.DA #0
|
|
|
|
|
DEV.HEADER.NAME >PSTR "MOUx"
|
2015-06-03 18:30:57 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Driver Code
|
|
|
|
|
*--------------------------------------
|
2017-01-27 16:26:09 +00:00
|
|
|
|
DRV.CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.1 .DA STATUS
|
|
|
|
|
.DA READBLOCK
|
|
|
|
|
.DA BADCALL
|
|
|
|
|
.DA BADCALL
|
|
|
|
|
.DA BADCALL
|
|
|
|
|
.DA BADCALL
|
|
|
|
|
.DA OPEN
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA CLOSE
|
2017-01-27 16:26:09 +00:00
|
|
|
|
.DA BADCALL
|
|
|
|
|
.DA BADCALL
|
|
|
|
|
L.DEVSTAT .DA DEVSTAT
|
|
|
|
|
L.READBLOCK.FLAGS .DA READBLOCK.FLAGS
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA 0 end or relocation
|
|
|
|
|
*--------------------------------------
|
2017-01-27 16:26:09 +00:00
|
|
|
|
BADCALL lda #MLI.ERR.BADCALL
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
STATUS >LDYA L.DEVSTAT
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-02-06 17:04:03 +00:00
|
|
|
|
OPEN php
|
2015-03-23 07:28:03 +00:00
|
|
|
|
sei
|
2017-02-06 17:04:03 +00:00
|
|
|
|
|
2017-01-27 16:26:09 +00:00
|
|
|
|
ldx DEVSLOT0n
|
|
|
|
|
lda MOUSEMODx,x keep if VBLInt already activated by kernel
|
|
|
|
|
and #MOUSEMODx.INTVBL
|
|
|
|
|
ora #MOUSEMODx.ACTIVE Enable, Polling mode
|
2015-03-17 22:05:33 +00:00
|
|
|
|
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
|
|
|
|
|
|
2015-11-23 14:54:30 +00:00
|
|
|
|
plp
|
2015-03-23 07:28:03 +00:00
|
|
|
|
|
2015-03-17 22:05:33 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-01-27 16:26:09 +00:00
|
|
|
|
READBLOCK php
|
2015-03-23 07:28:03 +00:00
|
|
|
|
sei
|
|
|
|
|
|
|
|
|
|
ldy #READMOUSE
|
|
|
|
|
jsr GOMOUSE
|
|
|
|
|
|
2017-01-27 16:26:09 +00:00
|
|
|
|
stz READBLOCK.FLAGS
|
|
|
|
|
|
2015-03-23 07:28:03 +00:00
|
|
|
|
ldx DEVSLOT0n
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2017-01-27 16:26:09 +00:00
|
|
|
|
.2 sta READBLOCK.FLAGS
|
2015-03-23 07:28:03 +00:00
|
|
|
|
|
|
|
|
|
.3 lda MOUSESTSx,x
|
|
|
|
|
and #MOUSESTSx.MOVED
|
|
|
|
|
beq .4
|
|
|
|
|
|
2017-01-27 16:26:09 +00:00
|
|
|
|
lda READBLOCK.FLAGS
|
2015-03-23 07:28:03 +00:00
|
|
|
|
ora #EVENT.MOUSEMOVE
|
2017-01-27 16:26:09 +00:00
|
|
|
|
sta READBLOCK.FLAGS
|
2015-03-23 07:28:03 +00:00
|
|
|
|
|
2017-01-27 16:26:09 +00:00
|
|
|
|
.4 lda MOUSEXLOx,x
|
|
|
|
|
sta READBLOCK.XY
|
2015-03-23 07:28:03 +00:00
|
|
|
|
lda MOUSEXHIx,x
|
2017-01-27 16:26:09 +00:00
|
|
|
|
sta READBLOCK.XY+1
|
2015-03-23 07:28:03 +00:00
|
|
|
|
lda MOUSEYLOx,x
|
2017-01-27 16:26:09 +00:00
|
|
|
|
sta READBLOCK.XY+2
|
2015-03-23 07:28:03 +00:00
|
|
|
|
lda MOUSEYHIx,x
|
2017-01-27 16:26:09 +00:00
|
|
|
|
sta READBLOCK.XY+3
|
|
|
|
|
|
2015-11-23 14:54:30 +00:00
|
|
|
|
plp
|
2017-01-27 16:26:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lda READBLOCK.FLAGS
|
2015-03-23 07:28:03 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2017-01-27 16:26:09 +00:00
|
|
|
|
.9 lda #MLI.ERR.EOF
|
2015-11-22 22:30:06 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-23 07:28:03 +00:00
|
|
|
|
CLOSE php
|
|
|
|
|
sei
|
2017-01-27 16:26:09 +00:00
|
|
|
|
ldx DEVSLOT0n
|
|
|
|
|
lda MOUSEMODx,x keep if VBLInt already activated by kernel
|
|
|
|
|
and #MOUSEMODx.INTVBL Disable ALL but VBLInt if previously active
|
2015-03-23 07:28:03 +00:00
|
|
|
|
ldy #SETMOUSE
|
|
|
|
|
jsr GOMOUSE
|
|
|
|
|
plp
|
|
|
|
|
clc
|
2015-03-17 22:05:33 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-01-27 16:26:09 +00:00
|
|
|
|
* PRIVATE
|
2015-06-03 18:30:57 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-17 22:05:33 +00:00
|
|
|
|
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)
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
DRV.CS.END
|
2015-03-23 07:28:03 +00:00
|
|
|
|
DEVSLOT0n .BS 1
|
2015-03-17 22:05:33 +00:00
|
|
|
|
DEVSLOTn0 .BS 1
|
2015-11-23 14:54:30 +00:00
|
|
|
|
DEVSLOTCn .BS 1
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-27 16:26:09 +00:00
|
|
|
|
DEVSTAT .DA #0
|
|
|
|
|
.DA #0,#0,#0 size
|
|
|
|
|
>PSTR "Apple II Mouse"
|
|
|
|
|
.BS 2
|
|
|
|
|
.DA #S.DEVSTAT.TYPE.XY
|
|
|
|
|
.DA #0
|
|
|
|
|
.DA $0900
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
READBLOCK.FLAGS .BS 1
|
|
|
|
|
READBLOCK.XY .BS 4
|
|
|
|
|
*--------------------------------------
|
2015-03-17 22:05:33 +00:00
|
|
|
|
MAN
|
|
|
|
|
SAVE DRV/MOUSE.DRV.S
|
|
|
|
|
ASM
|