2015-03-17 22:05:33 +00:00
|
|
|
|
NEW
|
2017-12-22 21:24:30 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
|
|
|
|
AUTO 4,1
|
2015-03-17 22:05:33 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.TF DRV/MOUSE.DRV
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
|
|
|
|
.INB INC/MLI.ERR.I
|
|
|
|
|
.INB INC/XY.MOUSE.I
|
|
|
|
|
.INB INC/LIBGUI.I
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
2018-05-07 06:13:07 +00:00
|
|
|
|
ZPTmpPtr1 .EQ ZPDRV
|
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
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
stz ZPTmpPtr1
|
2015-03-17 22:05:33 +00:00
|
|
|
|
lda #$C1
|
2018-05-07 06:13:07 +00:00
|
|
|
|
.1 sta ZPTmpPtr1+1
|
2015-03-17 22:05:33 +00:00
|
|
|
|
|
2018-05-07 06:13:07 +00:00
|
|
|
|
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-03-17 22:05:33 +00:00
|
|
|
|
|
|
|
|
|
lda ZPTmpPtr1+1
|
2018-05-07 06:13:07 +00:00
|
|
|
|
sta GOMOUSE+2
|
|
|
|
|
sta GOMOUSE.Cn+1
|
|
|
|
|
sta GOMOUSE.JMP+2
|
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
|
2017-11-15 16:29:23 +00:00
|
|
|
|
sta DEV.HEADER.NAME+3
|
2015-03-17 22:05:33 +00:00
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
2018-05-07 06:13:07 +00:00
|
|
|
|
sta GOMOUSE.n0+1
|
2015-03-17 22:05:33 +00:00
|
|
|
|
|
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
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2015-06-03 18:30:57 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-11-17 07:09:39 +00:00
|
|
|
|
|
2018-05-07 06:13:07 +00:00
|
|
|
|
.3 lda ZPTmpPtr1+1 no match, try next slot....
|
|
|
|
|
inc
|
2017-11-17 07:09:39 +00:00
|
|
|
|
cmp #$C8
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.DETECT.KO
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2017-11-17 07:09:39 +00:00
|
|
|
|
|
|
|
|
|
lda #MLI.E.NODEV
|
|
|
|
|
sec
|
2018-05-07 06:13:07 +00:00
|
|
|
|
rts
|
2015-06-03 18:30:57 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2018-04-11 15:35:51 +00:00
|
|
|
|
MSG.DETECT .AZ "Apple Mouse Driver.\r\n"
|
|
|
|
|
MSG.DETECT.OK .AZ "Mouse Installed As Device : %s\r\n"
|
|
|
|
|
MSG.DETECT.KO .AZ "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-06-02 15:14:42 +00:00
|
|
|
|
DEV.HEADER cld
|
|
|
|
|
jmp (DRV.CS.START,x)
|
2017-01-27 16:26:09 +00:00
|
|
|
|
.DA #0
|
2017-06-02 15:14:42 +00:00
|
|
|
|
.BS 6
|
2018-04-11 15:35:51 +00:00
|
|
|
|
DEV.HEADER.NAME .AZ "MOUX"
|
2015-06-03 18:30:57 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Driver Code
|
|
|
|
|
*--------------------------------------
|
2017-06-02 15:14:42 +00:00
|
|
|
|
DRV.CS.START .DA STATUS
|
2017-01-27 16:26:09 +00:00
|
|
|
|
.DA READBLOCK
|
2017-07-01 13:45:53 +00:00
|
|
|
|
.DA A2osX.BADCALL
|
|
|
|
|
.DA A2osX.BADCALL
|
2017-06-02 15:14:42 +00:00
|
|
|
|
.DA CONTROL
|
2017-07-01 13:45:53 +00:00
|
|
|
|
.DA A2osX.BADCALL
|
2017-01-27 16:26:09 +00:00
|
|
|
|
.DA OPEN
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA CLOSE
|
2017-07-01 13:45:53 +00:00
|
|
|
|
.DA A2osX.BADCALL
|
|
|
|
|
.DA A2osX.BADCALL
|
2017-01-27 16:26:09 +00:00
|
|
|
|
L.DEVSTAT .DA DEVSTAT
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA 0 end or relocation
|
|
|
|
|
*--------------------------------------
|
2017-01-27 16:26:09 +00:00
|
|
|
|
STATUS >LDYA L.DEVSTAT
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-06-02 15:14:42 +00:00
|
|
|
|
READBLOCK >STYA ZPTmpPtr1
|
2017-02-06 17:04:03 +00:00
|
|
|
|
|
2018-05-07 06:13:07 +00:00
|
|
|
|
stz READBLOCK.S+1 Reset Flags
|
2015-03-23 07:28:03 +00:00
|
|
|
|
|
2017-06-02 15:14:42 +00:00
|
|
|
|
php
|
2015-03-23 07:28:03 +00:00
|
|
|
|
sei
|
|
|
|
|
|
2017-06-02 15:14:42 +00:00
|
|
|
|
* ldy #READMOUSE DONE BY IRQ MANAGER
|
|
|
|
|
* jsr GOMOUSE
|
2017-01-27 16:26:09 +00:00
|
|
|
|
|
2015-03-23 07:28:03 +00:00
|
|
|
|
ldx DEVSLOT0n
|
|
|
|
|
|
|
|
|
|
lda MOUSESTSx,x
|
|
|
|
|
and #MOUSESTSx.MOVED
|
2017-11-28 16:32:38 +00:00
|
|
|
|
beq .1
|
2015-03-23 07:28:03 +00:00
|
|
|
|
|
2017-11-28 16:32:38 +00:00
|
|
|
|
ldy #S.MOUSE.X1
|
2017-06-02 15:14:42 +00:00
|
|
|
|
|
|
|
|
|
lda MOUSEXLOx,x
|
|
|
|
|
sta (ZPTmpPtr1),y
|
|
|
|
|
|
|
|
|
|
iny
|
2015-03-23 07:28:03 +00:00
|
|
|
|
lda MOUSEXHIx,x
|
2017-06-02 15:14:42 +00:00
|
|
|
|
sta (ZPTmpPtr1),y
|
|
|
|
|
|
|
|
|
|
iny
|
2015-03-23 07:28:03 +00:00
|
|
|
|
lda MOUSEYLOx,x
|
2017-11-17 07:09:39 +00:00
|
|
|
|
sta (ZPTmpPtr1),y
|
2017-06-02 15:14:42 +00:00
|
|
|
|
|
|
|
|
|
iny
|
2015-03-23 07:28:03 +00:00
|
|
|
|
lda MOUSEYHIx,x
|
2017-06-02 15:14:42 +00:00
|
|
|
|
sta (ZPTmpPtr1),y
|
2017-12-01 15:53:29 +00:00
|
|
|
|
|
|
|
|
|
lda #S.MOUSE.S.MOVE
|
2018-05-07 06:13:07 +00:00
|
|
|
|
tsb READBLOCK.S+1
|
2017-01-27 16:26:09 +00:00
|
|
|
|
|
2017-11-28 16:32:38 +00:00
|
|
|
|
stz bDblClick Reset DblClick flag
|
|
|
|
|
|
|
|
|
|
.1 lda MOUSESTSx,x
|
|
|
|
|
and #MOUSESTSx.DOWN+MOUSESTSx.LDOWN
|
|
|
|
|
beq .8 no button state change:up & previously up
|
|
|
|
|
|
|
|
|
|
cmp #MOUSESTSx.DOWN+MOUSESTSx.LDOWN
|
|
|
|
|
beq .8 no button state change:down & previously down
|
|
|
|
|
|
|
|
|
|
asl if CS, down & previously up
|
|
|
|
|
bcc .2
|
|
|
|
|
|
|
|
|
|
lda #S.MOUSE.S.DOWN
|
2018-05-07 06:13:07 +00:00
|
|
|
|
tsb READBLOCK.S+1 button has been pressed, start drag...
|
2017-11-28 16:32:38 +00:00
|
|
|
|
|
|
|
|
|
lda MOUSEXLOx,x
|
|
|
|
|
sta SrcDrag
|
|
|
|
|
|
|
|
|
|
lda MOUSEXHIx,x
|
|
|
|
|
sta SrcDrag+1
|
2017-01-27 16:26:09 +00:00
|
|
|
|
|
2017-11-28 16:32:38 +00:00
|
|
|
|
lda MOUSEYLOx,x
|
|
|
|
|
sta SrcDrag+2
|
|
|
|
|
|
|
|
|
|
lda MOUSEYHIx,x
|
|
|
|
|
sta SrcDrag+3
|
|
|
|
|
|
|
|
|
|
bra .8
|
|
|
|
|
|
2018-05-07 06:13:07 +00:00
|
|
|
|
.2 lda READBLOCK.S+1
|
2017-12-01 15:53:29 +00:00
|
|
|
|
|
|
|
|
|
pha save move state
|
|
|
|
|
|
|
|
|
|
ora #S.MOUSE.S.UP
|
2018-05-07 06:13:07 +00:00
|
|
|
|
sta READBLOCK.S+1
|
2017-12-01 15:53:29 +00:00
|
|
|
|
|
|
|
|
|
pla get back move state
|
2017-11-28 16:32:38 +00:00
|
|
|
|
|
|
|
|
|
bne .4 no move...click!
|
2017-12-01 15:53:29 +00:00
|
|
|
|
|
2017-11-28 16:32:38 +00:00
|
|
|
|
lda #S.MOUSE.S.CLK
|
|
|
|
|
bit bDblClick
|
2017-12-01 15:53:29 +00:00
|
|
|
|
bpl .3
|
2017-11-28 16:32:38 +00:00
|
|
|
|
|
|
|
|
|
lda #S.MOUSE.S.DCLK
|
2017-12-01 15:53:29 +00:00
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
sty bDblClick
|
2017-11-28 16:32:38 +00:00
|
|
|
|
|
|
|
|
|
.3 dec bDblClick
|
2017-12-01 15:53:29 +00:00
|
|
|
|
|
2018-05-07 06:13:07 +00:00
|
|
|
|
tsb READBLOCK.S+1
|
2017-11-28 16:32:38 +00:00
|
|
|
|
bra .8
|
|
|
|
|
|
2017-12-01 15:53:29 +00:00
|
|
|
|
.4 lda #S.MOUSE.S.DRAG
|
2018-05-07 06:13:07 +00:00
|
|
|
|
tsb READBLOCK.S+1
|
2017-11-28 16:32:38 +00:00
|
|
|
|
|
2017-12-01 15:53:29 +00:00
|
|
|
|
ldy #S.MOUSE.X2+3
|
2017-11-28 16:32:38 +00:00
|
|
|
|
|
|
|
|
|
.5 lda SrcDrag-S.MOUSE.X2,y
|
|
|
|
|
sta (ZPTmpPtr1),y
|
2017-12-01 15:53:29 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .5
|
2017-11-28 16:32:38 +00:00
|
|
|
|
|
|
|
|
|
.8 plp
|
|
|
|
|
|
2018-05-07 06:13:07 +00:00
|
|
|
|
READBLOCK.S lda #$ff SELF MODIFIED
|
2015-03-23 07:28:03 +00:00
|
|
|
|
beq .9
|
2018-05-07 06:13:07 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.MOUSE.S
|
|
|
|
|
sta (ZPTmpPtr1),y
|
2015-03-23 07:28:03 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
.9 lda #MLI.E.EOF
|
2015-11-22 22:30:06 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
2017-06-02 15:14:42 +00:00
|
|
|
|
CONTROL >STYA ZPTmpPtr1
|
|
|
|
|
|
|
|
|
|
php
|
|
|
|
|
sei
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
ldx #0 set X
|
2018-05-07 06:13:07 +00:00
|
|
|
|
jsr SETCLAMP
|
2017-06-02 15:14:42 +00:00
|
|
|
|
|
|
|
|
|
ldy #4
|
|
|
|
|
ldx #1 set Y
|
2018-05-07 06:13:07 +00:00
|
|
|
|
jsr SETCLAMP
|
2017-06-02 15:14:42 +00:00
|
|
|
|
|
|
|
|
|
ldy #HOMEMOUSE
|
|
|
|
|
jsr GOMOUSE
|
|
|
|
|
|
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
OPEN php
|
|
|
|
|
sei
|
|
|
|
|
|
|
|
|
|
ldx DEVSLOT0n
|
|
|
|
|
lda MOUSEMODx,x keep if VBLInt already activated by kernel
|
|
|
|
|
and #MOUSEMODx.INTVBL
|
|
|
|
|
ora #MOUSEMODx.ACTIVE Enable, Polling mode
|
|
|
|
|
ldy #SETMOUSE
|
|
|
|
|
jsr GOMOUSE
|
|
|
|
|
|
|
|
|
|
ldy #INITMOUSE Reset
|
|
|
|
|
jsr GOMOUSE
|
|
|
|
|
|
|
|
|
|
plp
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
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
|
|
|
|
*--------------------------------------
|
2018-05-07 06:13:07 +00:00
|
|
|
|
SETCLAMP lda (ZPTmpPtr1),y
|
|
|
|
|
sta LOCLAMPLO
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPTmpPtr1),y
|
|
|
|
|
sta LOCLAMPHI
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPTmpPtr1),y
|
|
|
|
|
sta HICLAMPLO
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPTmpPtr1),y
|
|
|
|
|
sta HICLAMPHI
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
ldy #CLAMPMOUSE
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
GOMOUSE ldx $FF00,y SELF MODIFIED
|
|
|
|
|
stx GOMOUSE.JMP+1
|
|
|
|
|
GOMOUSE.Cn ldx #$ff SELF MODIFIED
|
|
|
|
|
GOMOUSE.n0 ldy #$ff SELF MODIFIED
|
|
|
|
|
GOMOUSE.JMP jmp $FFFF SELF MODIFIED
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
DRV.CS.END
|
2015-03-23 07:28:03 +00:00
|
|
|
|
DEVSLOT0n .BS 1
|
2017-11-28 16:32:38 +00:00
|
|
|
|
bDblClick .BS 1
|
|
|
|
|
SrcDrag .BS 4
|
2015-03-17 22:05:33 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-27 16:26:09 +00:00
|
|
|
|
DEVSTAT .DA #0
|
2018-05-07 06:13:07 +00:00
|
|
|
|
.DA #0,#0,#0
|
2017-01-27 16:26:09 +00:00
|
|
|
|
>PSTR "Apple II Mouse"
|
|
|
|
|
.BS 2
|
2018-07-19 15:33:55 +00:00
|
|
|
|
.DA #S.DIB.T.XY
|
2017-01-27 16:26:09 +00:00
|
|
|
|
.DA #0
|
2017-11-28 16:32:38 +00:00
|
|
|
|
.DA #0
|
|
|
|
|
.DA #91
|
2017-01-27 16:26:09 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-17 22:05:33 +00:00
|
|
|
|
MAN
|
2017-06-02 15:14:42 +00:00
|
|
|
|
SAVE /A2OSX.SRC/DRV/MOUSE.DRV.S
|
2015-03-17 22:05:33 +00:00
|
|
|
|
ASM
|