A2osX/SYS/KERNEL.S.DEV.txt

386 lines
7.4 KiB
Plaintext
Raw Normal View History

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
*--------------------------------------
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
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
*--------------------------------------
2016-02-24 19:52:24 +00:00
S.GetDevInfoA jsr S.GetDevByIDA
bcs .9
>STYA ZPQuickPtr1
ldx #DEVMGR.GETINFO
jmp (ZPQuickPtr1)
.9 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
DevMgr.SYS.BASL0 .EQ $800
2015-10-19 20:35:00 +00:00
*--------------------------------------
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
*--------------------------------------
DevMgr.SYS cld
2015-10-19 20:35:00 +00:00
jmp (DevMgr.SYS.Code,x)
.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
*--------------------------------------
DevMgr.SYS.Code .DA DevMgr.SYS.Open
.DA DevMgr.SYS.GetEvent
.DA DevMgr.SYS.COut
2015-06-03 18:30:57 +00:00
.DA .8 CLOSE
.DA .8 GETINFO
.DA .8 IRQ
.8 clc
rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
DevMgr.SYS.Open stz DevMgr.SYS.CPULOADI
stz DevMgr.SYS.CH
stz DevMgr.SYS.CV
ldx #0
ldy #0
.1 lda DevMgr.SYS.TITLE,y
beq .2
jsr DevMgr.SYS.SetCharAtYX
iny
bne .1
.2 lda #$20
jsr DevMgr.SYS.SetCharAtYX
iny
cpy #80
bne .2
jsr DevMgr.SYS.Home
lda A2osX.SCREENS
ora #A2osX.SCREENS.S
sta A2osX.SCREENS
lda #A2osX.SCREENS.S
jsr S.ScreenSelectA
clc
rts
*--------------------------------------
DevMgr.SYS.GetEvent
lda A2osX.ASCREEN
and #A2osX.SCREENS.S is screen active?
beq .9
ldx DevMgr.SYS.CPULOADI
lda DevMgr.SYS.CPULOADC,x
sta DevMgr.SYS.BASL0+38
dec DevMgr.SYS.CPULOADI
bpl .1
lda #3
sta DevMgr.SYS.CPULOADI
.1 jsr S.GetKeyboardEvent
bcs .9
rts
.9 lda #0 Error = no event
sec
rts
*--------------------------------------
DevMgr.SYS.COut phx
phy
2015-12-13 21:29:51 +00:00
cmp #' '
bcc .1
ldy DevMgr.SYS.CH
ldx DevMgr.SYS.CV
ora #$80
jsr DevMgr.SYS.SetCharAtYX
jsr DevMgr.SYS.FSOut
2015-12-13 21:29:51 +00:00
bra .8
.1 cmp #10
bne .2
jsr DevMgr.SYS.LF
bra .8
.2 cmp #13
bne .3
jsr DevMgr.SYS.CROut
bra .8
.3 ora #$20
jsr DevMgr.SYS.SetCharAtYX
jsr DevMgr.SYS.FSOut
.8 ply
plx
clc
rts
*--------------------------------------
DevMgr.SYS.FSOut
lda DevMgr.SYS.CH
cmp #79
2015-12-13 21:29:51 +00:00
beq DevMgr.SYS.LF1
inc DevMgr.SYS.CH
rts
*--------------------------------------
DevMgr.SYS.CROut
jsr DevMgr.SYS.ClrEOL
stz DevMgr.SYS.CH
2015-12-13 21:29:51 +00:00
rts
*--------------------------------------
DevMgr.SYS.LF1 stz DevMgr.SYS.CH
DevMgr.SYS.LF ldx DevMgr.SYS.CV
cpx #23
beq DevMgr.SYS.Scroll
inc DevMgr.SYS.CV
rts
*--------------------------------------
DevMgr.SYS.ClrEOL
ldx DevMgr.SYS.CV
lda #$A0
ldy DevMgr.SYS.CH
.1 cpy #79
beq .2
jsr DevMgr.SYS.SetCharAtYX
iny
bne .1
.2 rts
*--------------------------------------
DevMgr.SYS.Scroll
ldx #1
.1 lda DevMgr.SYS.BASEL,x
sta ZPDRV
lda DevMgr.SYS.BASEH,x
sta ZPDRV+1
inx
lda DevMgr.SYS.BASEL,x
sta ZPDRV+2
lda DevMgr.SYS.BASEH,x
sta ZPDRV+3
ldy #39
sta SETWRITEAUX
sta SETREADAUX
.2 lda (ZPDRV+2),y
sta (ZPDRV),y
dey
bpl .2
ldy #39
sta CLRWRITEAUX
sta CLRREADAUX
.3 lda (ZPDRV+2),y
sta (ZPDRV),y
dey
bpl .3
cpx #23
bne .1
ldy #39
lda #$A0
.4 sta SETWRITEAUX
sta (ZPDRV+2),y
sta CLRWRITEAUX
sta (ZPDRV+2),y
dey
bpl .4
rts
*--------------------------------------
DevMgr.SYS.ClrLineAtX
lda DevMgr.SYS.BASEL,x
sta ZPDRV
lda DevMgr.SYS.BASEH,x
sta ZPDRV+1
lda #$A0
ldy #39
sta SETWRITEAUX
.1 sta (ZPDRV),y
dey
bpl .1
ldy #39
sta CLRWRITEAUX
.2 sta (ZPDRV),y
dey
bpl .2
rts
*--------------------------------------
DevMgr.SYS.Home ldx #23
.1 jsr DevMgr.SYS.ClrLineAtX
dex
bne .1
stz DevMgr.SYS.CH
lda #1
sta DevMgr.SYS.CV
rts
*--------------------------------------
DevMgr.SYS.SetCharAtYX
cmp #$40
bcc .1
cmp #$5F
bcs .1
and #$3F
.1 phy
pha
lda DevMgr.SYS.BASEL,x
sta ZPDRV
lda DevMgr.SYS.BASEH,x
sta ZPDRV+1
tya
lsr
tay
bcs .2
sta SETWRITEAUX
.2 pla
sta (ZPDRV),y
sta CLRWRITEAUX
ply
rts
*--------------------------------------
DevMgr.SYS.CH .BS 1
DevMgr.SYS.CV .BS 1
DevMgr.SYS.CPULOADI .BS 1
DevMgr.SYS.CPULOADC .AS -"|/-\"
*--------------------------------------
DevMgr.SYS.TITLE >CSTRING "A2osX System Screen"
DevMgr.SYS.BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
DevMgr.SYS.BASEH .HS 08.08.09.09.0A.0A.0B.0B.08.08.09.09.0A.0A.0B.0B.08.08.09.09.0A.0A.0B.0B
*--------------------------------------*--------------------------------------
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