2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
DevMgr.HiMem .EQ $FFFE Protect IRQ vector in Aux LC
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* S.DevMgrInit
|
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
S.DevMgrInit ldx #S.DEV.SIZE*DevMgr.Count
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.1 lda DevMgr.NUL-1,x
|
|
|
|
|
sta DevMgr.Table-1,x
|
2015-03-14 21:48:35 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
stz DevMgr.Table+S.DEV.SIZE*DevMgr.Count+1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda #DevMgr.Count-1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta DevMgr.LastDevID
|
|
|
|
|
|
|
|
|
|
>LDYAI DevMgr.End
|
|
|
|
|
>STYA DevMgr.Free
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.GetDevByIDA
|
|
|
|
|
* IN:
|
|
|
|
|
* A = DevID
|
|
|
|
|
* OUT:
|
|
|
|
|
* CC = OK, CS = ERROR
|
|
|
|
|
* Y,A = devslot
|
|
|
|
|
* X Unmodified
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
S.GetDevByIDA cmp DevMgr.LastDevID
|
|
|
|
|
beq .1
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
.1 stz S.GetDevByIDA.T
|
|
|
|
|
|
|
|
|
|
asl
|
|
|
|
|
ror S.GetDevByIDA.T
|
|
|
|
|
asl
|
|
|
|
|
ror S.GetDevByIDA.T
|
|
|
|
|
asl
|
|
|
|
|
ror S.GetDevByIDA.T
|
|
|
|
|
asl
|
|
|
|
|
ror S.GetDevByIDA.T
|
|
|
|
|
|
|
|
|
|
adc #DevMgr.Table
|
|
|
|
|
tay
|
|
|
|
|
lda S.GetDevByIDA.T
|
|
|
|
|
adc /DevMgr.Table
|
|
|
|
|
rts CC
|
|
|
|
|
|
|
|
|
|
.9 lda #DEVMGR.ERRDNF
|
|
|
|
|
rts CS
|
|
|
|
|
S.GetDevByIDA.T .BS 1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* GetDevIDByNameA
|
|
|
|
|
* IN:
|
|
|
|
|
* A = hPStr
|
|
|
|
|
* OUT:
|
|
|
|
|
* CC = OK, CS = ERROR
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* X = DEVID
|
|
|
|
|
* Y,A = pDev
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.GetDevByNameA jsr S.GetMemPtrA
|
2015-03-23 07:28:03 +00:00
|
|
|
|
S.GetDevByNameYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
>STYA ZPQuickPtr1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>LDYAI DevMgr.Table+S.DEV.NAME
|
|
|
|
|
>STYA ZPQuickPtr2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPQuickPtr1)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
cmp (ZPQuickPtr2)
|
|
|
|
|
bne .3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
tay
|
|
|
|
|
.2 lda (ZPQuickPtr1),y
|
|
|
|
|
cmp (ZPQuickPtr2),y
|
|
|
|
|
bne .3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
dey
|
|
|
|
|
bne .2
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
lda ZPQuickPtr2
|
|
|
|
|
sec
|
|
|
|
|
sbc #S.DEV.NAME
|
|
|
|
|
tay
|
|
|
|
|
lda ZPQuickPtr2+1
|
|
|
|
|
sbc /S.DEV.NAME
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
.3 lda ZPQuickPtr2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.DEV.SIZE
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta ZPQuickPtr2
|
|
|
|
|
bcc .4
|
|
|
|
|
|
|
|
|
|
inc ZPQuickPtr2+1
|
|
|
|
|
|
|
|
|
|
.4 cpx DevMgr.LastDevID
|
|
|
|
|
inx
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
.9 lda #DEVMGR.ERRDNF
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
S.GetDevEvent >LDYAI DevMgr.Table
|
|
|
|
|
>STYA pDev
|
|
|
|
|
|
|
|
|
|
stz DevMgr.DevID
|
|
|
|
|
|
|
|
|
|
.1 ldy #S.DEV.F
|
|
|
|
|
lda (pDev),y get S.DEV.F
|
|
|
|
|
and #S.DEV.F.EVENT
|
|
|
|
|
beq .2 EVENT enabled ?
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
ldx #DEVMGR.GETEVENT
|
|
|
|
|
jsr pDevJmp Call DRV GetEvent function
|
|
|
|
|
bcc .8 Got An Event
|
|
|
|
|
|
|
|
|
|
.2 lda pDev
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.DEV.SIZE
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta pDev
|
|
|
|
|
bcc .3
|
|
|
|
|
inc pDev+1
|
|
|
|
|
|
|
|
|
|
.3 lda DevMgr.DevID
|
|
|
|
|
inc DevMgr.DevID
|
|
|
|
|
cmp DevMgr.LastDevID
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
lda #0 error code=0,CS=no event
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.8 lda DevMgr.DevID Carry is alredy clear
|
|
|
|
|
ldy #S.EVT.hDEV
|
|
|
|
|
sta (pEvent),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
S.GetKeyboardEvent
|
|
|
|
|
lda KBD
|
|
|
|
|
bpl .9
|
|
|
|
|
|
|
|
|
|
sta KBDSTROBE
|
|
|
|
|
and #$7F
|
|
|
|
|
ldy #S.EVT.DATA
|
|
|
|
|
sta (pEvent),y
|
|
|
|
|
iny
|
|
|
|
|
lda OPENAPPLE
|
|
|
|
|
asl
|
|
|
|
|
lda SOLIDAPPLE
|
|
|
|
|
ror
|
|
|
|
|
and #$C0
|
|
|
|
|
sta (pEvent),y
|
|
|
|
|
lda #S.EVT.F.KEY
|
|
|
|
|
|
|
|
|
|
sta (pEvent)
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 inc A2osX.RANDOM16
|
|
|
|
|
bne .99
|
|
|
|
|
inc A2osX.RANDOM16+1
|
|
|
|
|
.99 lda #0 error code=0
|
|
|
|
|
sec no event
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
DevMgr.Free .BS 2
|
|
|
|
|
DevMgr.DevID .BS 1
|
|
|
|
|
DevMgr.LastDevID .BS 1
|
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
DevMgr.Count .EQ 2
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
DevMgr.NUL cld
|
|
|
|
|
jmp (DevMgr.NUL.Code,x)
|
|
|
|
|
.DA #S.DEV.F.INUSE+S.DEV.F.SHARE+S.DEV.F.COUT+S.DEV.F.CHAR
|
|
|
|
|
>PSTRING "NUL" NAME
|
|
|
|
|
.HS 00 NAME must Be 5 bytes long
|
|
|
|
|
.HS 00.00
|
|
|
|
|
.HS 00.00.00.00
|
|
|
|
|
*--------------------------------------
|
2015-11-10 21:47:57 +00:00
|
|
|
|
DevMgr.SYS cld #S.DEV.F.EVENT
|
2015-10-19 20:35:00 +00:00
|
|
|
|
jmp (DevMgr.SYS.Code,x)
|
2015-11-10 21:47:57 +00:00
|
|
|
|
.DA #S.DEV.F.INUSE+S.DEV.F.EVENT+S.DEV.F.SHARE+S.DEV.F.COUT+S.DEV.F.CHAR
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>PSTRING "SYS" NAME
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.HS 00 NAME must Be 5 bytes long
|
|
|
|
|
.HS 00.00
|
|
|
|
|
.HS 00.00.00.00
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DevMgr.NUL.Code .DA .8 OPEN
|
|
|
|
|
.DA .8 GETEVENT
|
|
|
|
|
.DA .8 COUT
|
|
|
|
|
.DA .8 CLOSE
|
|
|
|
|
.DA .8 GETINFO
|
|
|
|
|
.DA .8 IRQ
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
DevMgr.SYS.Code .DA .8 OPEN
|
2015-11-10 21:47:57 +00:00
|
|
|
|
.DA DevMgr.SYS.GetEvent
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA .8 COUT
|
|
|
|
|
.DA .8 CLOSE
|
|
|
|
|
.DA .8 GETINFO
|
|
|
|
|
.DA .8 IRQ
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-11-10 21:47:57 +00:00
|
|
|
|
DevMgr.SYS.GetEvent
|
|
|
|
|
lda A2osX.ASCREEN
|
|
|
|
|
and #A2osX.SCREENS.S is screen active?
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
jsr S.GetKeyboardEvent
|
|
|
|
|
bcs .9
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #0 Error = no event
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
DevMgr.End .EQ *
|
2015-03-14 21:48:35 +00:00
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S.DEV
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|