mirror of
https://github.com/A2osX/A2osX.git
synced 2024-08-14 13:29:02 +00:00
547 lines
11 KiB
Plaintext
547 lines
11 KiB
Plaintext
NEW
|
||
PREFIX /A2OSX.BUILD
|
||
AUTO 4,1
|
||
*--------------------------------------
|
||
* A2osX.DIIDrv
|
||
* X = DEVMGR.cmd
|
||
* Y,A = PTR to Params
|
||
* pDev -> Dev Header AUX!!!
|
||
* $42 Command Number
|
||
* $43 Unit Number
|
||
* $44-$45 Buffer Pointer
|
||
* $46-$47 Block Number
|
||
*--------------------------------------
|
||
A2osX.DIIDrv .DA A2osX.DIIDrv.S status
|
||
.DA A2osX.DIIDrv.RW Read
|
||
.DA A2osX.DIIDrv.RW Write
|
||
.DA A2osX.BadCall Format
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
*--------------------------------------
|
||
A2osX.DIIDrv.S >LDYAI A2osx.DII.Stat
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
A2osX.DIIDrv.RW >STYA A2osX.RW.SrcDst+1
|
||
jsr A2osX.Blk.GetCmdAndDevAX
|
||
*--------------------------------------
|
||
ldy #$D0
|
||
.HS 2C bit abs
|
||
A2osX.RamDrv.RW1
|
||
ldy #$FF
|
||
|
||
sty A2osX.RW.Drv+2
|
||
|
||
jsr GO.ProDOS
|
||
stx $42
|
||
sta $43
|
||
|
||
ldy #3
|
||
|
||
A2osX.RW.SrcDst lda $ffff,y Self Modified
|
||
sta $44,y
|
||
dey
|
||
bpl A2osX.RW.SrcDst
|
||
|
||
A2osX.RW.Drv jsr $0000
|
||
cli
|
||
jsr GO.A2osX
|
||
rts
|
||
*--------------------------------------
|
||
A2osx.DII.Stat .DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
|
||
.DA 280
|
||
.DA #0
|
||
>PSTR "Disk II 5.25"
|
||
.BS 4
|
||
.DA #S.DSTAT.T.DISKII
|
||
.DA #0
|
||
.DA #0,#91
|
||
*--------------------------------------
|
||
* A2osX.RamDrv
|
||
* X = DEVMGR.cmd
|
||
* Y,A = PTR to Params
|
||
* pDev -> Dev Header AUX!!!
|
||
* $42 Command Number
|
||
* $43 Unit Number
|
||
* $44-$45 Buffer Pointer
|
||
* $46-$47 Block Number
|
||
*--------------------------------------
|
||
A2osX.RamDrv .DA A2osX.RamDrv.S status
|
||
.DA A2osX.RamDrv.RW Read
|
||
.DA A2osX.RamDrv.RW Write
|
||
.DA A2osX.BadCall Format
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
*--------------------------------------
|
||
A2osX.RamDrv.S jsr A2osX.Blk.GetCmdAndDevAX
|
||
jsr GO.ProDOS
|
||
stx $42
|
||
sta $43
|
||
jsr $FF00
|
||
jsr GO.A2osX
|
||
bcs .9
|
||
stx A2osx.RamDrv.Stat+S.DSTAT.SIZE
|
||
sty A2osx.RamDrv.Stat+S.DSTAT.SIZE+1
|
||
|
||
>LDYAI A2osX.RamDrv.Stat
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
A2osX.RamDrv.RW >STYA A2osX.RW.SrcDst+1
|
||
jsr A2osX.Blk.GetCmdAndDevAX
|
||
bra A2osX.RamDrv.RW1
|
||
*--------------------------------------
|
||
A2osx.RamDrv.Stat
|
||
.DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
|
||
.BS 3
|
||
>PSTR "ProDOS /RAM Disk"
|
||
.DA #S.DSTAT.T.RAM
|
||
.DA #0
|
||
.DA #0,#91
|
||
*--------------------------------------
|
||
* A2osX.BlkDrv
|
||
* X = DEVMGR.cmd
|
||
* Y,A = PTR to Params
|
||
* pDev -> Dev Header
|
||
* $42 Command Number
|
||
* $43 Unit Number
|
||
* $44-$45 Buffer Pointer
|
||
* $46-$47 Block Number
|
||
*--------------------------------------
|
||
A2osX.BlkDrv .DA A2osX.BlkDrv.S status
|
||
.DA A2osX.BlkDrv.RW
|
||
.DA A2osX.BlkDrv.RW
|
||
.DA A2osX.BlkDrv.F
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
*--------------------------------------
|
||
A2osX.BlkDrv.S jsr A2osX.Blk.GetCmdAndDev
|
||
|
||
jsr A2osX.BlkDrv.Go
|
||
bcs .9
|
||
stx A2osx.Blk.Stat+S.DSTAT.SIZE
|
||
sty A2osx.Blk.Stat+S.DSTAT.SIZE+1
|
||
|
||
>LDYAI A2osX.Blk.Stat
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
A2osX.BlkDrv.RW >STYA A2osX.Blk.GetParam.1+1
|
||
|
||
jsr A2osX.Blk.GetCmdAndDev
|
||
|
||
jsr A2osX.Blk.GetParam
|
||
bra A2osX.BlkDrv.Go
|
||
*--------------------------------------
|
||
A2osX.BlkDrv.F jsr A2osX.Blk.GetCmdAndDev
|
||
|
||
A2osX.BlkDrv.Go ldy #S.DEV.ROM.JMP
|
||
lda (pDev),y
|
||
sta .8+1
|
||
iny
|
||
lda (pDev),y
|
||
sta .8+2
|
||
.8 jmp $ffff
|
||
*--------------------------------------
|
||
A2osX.Blk.GetParam
|
||
ldy #3
|
||
A2osX.Blk.GetParam.1
|
||
lda $ffff,y Self Modified
|
||
sta $44,y
|
||
dey
|
||
bpl A2osX.Blk.GetParam.1
|
||
rts
|
||
*--------------------------------------
|
||
A2osX.Blk.GetCmdAndDev
|
||
jsr A2osX.Blk.GetCmdAndDevAX
|
||
stx $42
|
||
sta $43
|
||
rts
|
||
A2osX.Blk.GetCmdAndDevAX
|
||
txa
|
||
lsr
|
||
tax CMD
|
||
|
||
ldy #S.DEV.DEVID Drive 1, or 2
|
||
lda (pDev),y
|
||
dec O or 1
|
||
lsr in Carry
|
||
php
|
||
|
||
ldy #S.DEV.BUSID
|
||
lda (pDev),y
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
plp
|
||
ror DSSS0000
|
||
|
||
rts
|
||
*--------------------------------------
|
||
A2osX.Blk.Stat .DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
|
||
.BS 3
|
||
>PSTR "ProDOS Block Dev"
|
||
.DA #S.DSTAT.T.PRODOS
|
||
.DA #0
|
||
.DA #0,#91
|
||
*--------------------------------------
|
||
* Smartport Driver
|
||
*--------------------------------------
|
||
A2osX.PrtDrv .DA A2osX.PrtDrv.S STATUS
|
||
.DA A2osX.PrtDrv.P BR
|
||
.DA A2osX.PrtDrv.P BW
|
||
.DA A2osX.PrtDrv.NP FORMAT
|
||
.DA A2osX.PrtDrv.P CONTROL
|
||
.DA A2osX.PrtDrv.NP INIT
|
||
.DA A2osX.PrtDrv.NP OPEN
|
||
.DA A2osX.PrtDrv.NP CLOSE
|
||
.DA A2osX.PrtDrv.P R
|
||
.DA A2osX.PrtDrv.P W
|
||
*--------------------------------------
|
||
A2osX.PrtDrv.S jsr A2osX.PrtDrv.GetDev
|
||
>LDYAI K.S.DSTAT
|
||
>STYA K.SP.PARAMS+2
|
||
lda #3
|
||
sta K.SP.PARAMS+4
|
||
jsr A2osX.PrtDrv.Go
|
||
bcs .9
|
||
>LDYAI K.S.DSTAT
|
||
.9 rts
|
||
*--------------------------------------
|
||
A2osX.PrtDrv.P jsr A2osX.PrtDrv.GetParam
|
||
bra A2osX.PrtDrv.Go
|
||
A2osX.PrtDrv.NP jsr A2osX.PrtDrv.GetDev
|
||
*--------------------------------------
|
||
A2osX.PrtDrv.Go ldy #S.DEV.ROM.JMP
|
||
lda (pDev),y
|
||
sta .8+1
|
||
iny
|
||
lda (pDev),y
|
||
sta .8+2
|
||
|
||
.8 jsr $ffff
|
||
A2osX.PrtDrv.Go.Cmd
|
||
.BS 1
|
||
.DA K.SP.PARAMS
|
||
rts
|
||
*--------------------------------------
|
||
A2osX.PrtDrv.GetParam
|
||
>STYA ZPDRV Get Ptr To ParamList
|
||
jsr A2osX.Blk.GetCmdAndDev
|
||
|
||
ldy #7
|
||
|
||
.1 lda (ZPDRV),y
|
||
sta K.SP.PARAMS+2,y
|
||
dey
|
||
bpl .1
|
||
rts
|
||
*--------------------------------------
|
||
A2osX.PrtDrv.GetDev
|
||
txa
|
||
lsr
|
||
sta A2osX.PrtDrv.Go.Cmd
|
||
tax
|
||
lda A2osX.PrtDrv.Cnt,x
|
||
sta K.SP.PARAMS
|
||
ldy #S.DEV.DEVID
|
||
lda (pDev),y
|
||
sta K.SP.PARAMS+1
|
||
rts
|
||
A2osX.PrtDrv.Cnt
|
||
.HS 03030301030101010404
|
||
*--------------------------------------
|
||
* NULL DEVICE
|
||
*--------------------------------------
|
||
DevMgr.NUL.Code .DA .1 STATUS
|
||
.DA A2osX.BADCALL READBLOCK
|
||
.DA A2osX.BADCALL WRITEBLOCK
|
||
.DA A2osX.BADCALL FORMAT
|
||
.DA A2osX.BADCALL CONTROL
|
||
.DA A2osX.BADCALL INIT
|
||
.DA A2osX.BADCALL OPEN
|
||
.DA A2osX.BADCALL CLOSE
|
||
.DA A2osX.BADCALL READ
|
||
.DA .8 WRITE
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
.1 >LDYAI .2
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
.2 .DA #S.DEV.S.WRITE+S.DEV.S.READ
|
||
.DA #0,#0,#0
|
||
>PSTR "NULL DEVICE "
|
||
.DA #S.DSTAT.T.CHAR
|
||
.DA #0
|
||
.DA KVER
|
||
*--------------------------------------
|
||
* SYS DEVICE
|
||
*--------------------------------------
|
||
DevMgr.SYS.Code .DA .1 STATUS
|
||
.DA A2osX.BADCALL READBLOCK
|
||
.DA A2osX.BADCALL WRITEBLOCK
|
||
.DA A2osX.BADCALL FORMAT
|
||
.DA DevMgr.SYS.Control
|
||
.DA A2osX.BADCALL INIT
|
||
.DA DevMgr.SYS.Open
|
||
.DA A2osX.BADCALL CLOSE
|
||
.DA DevMgr.SYS.Read
|
||
.DA DevMgr.SYS.Write
|
||
*--------------------------------------
|
||
.1 >LDYAI .2
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
.2 .DA #S.DEV.S.WRITE+S.DEV.S.READ
|
||
.DA #0,#0,#0
|
||
>PSTR "A2osX SYS Screen"
|
||
.DA #S.DSTAT.T.CHAR
|
||
.DA #0
|
||
.DA KVER
|
||
*--------------------------------------
|
||
DevMgr.SYS.Open lda #1
|
||
sta A2osX.SCRNDEVS
|
||
jsr DevMgr.SYS.Home
|
||
*--------------------------------------
|
||
DevMgr.SYS.Control
|
||
sta SETTEXT
|
||
sta SETALTCHAR
|
||
sta SET80DISP
|
||
sta CLR80STORE
|
||
sta CLRPAGE2
|
||
lda #1
|
||
sta A2osX.ASCREEN
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DevMgr.SYS.Read lda A2osX.ASCREEN
|
||
cmp #1 is SYS active?
|
||
bne .9
|
||
|
||
lda OPENAPPLE
|
||
bmi .9 Open apple key, not for us...
|
||
lda KBD
|
||
bpl .9
|
||
sta KBDSTROBE
|
||
|
||
and #$7F
|
||
|
||
clc
|
||
rts
|
||
|
||
.9 lda #0 Error = no event
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
DevMgr.SYS.Write
|
||
phx
|
||
phy
|
||
cmp #' '
|
||
bcs .7
|
||
|
||
cmp #10
|
||
bne .1
|
||
jsr DevMgr.SYS.LF
|
||
bra .8
|
||
|
||
.1 cmp #13
|
||
bne .2
|
||
jsr DevMgr.SYS.CR
|
||
bra .8
|
||
|
||
.2 ora #$20
|
||
|
||
.HS 2C BIT ABS
|
||
|
||
.7 ora #$80
|
||
ldy DevMgr.SYS.CH
|
||
ldx DevMgr.SYS.CV
|
||
jsr DevMgr.SYS.SetCharAtYX
|
||
jsr DevMgr.SYS.FSOut
|
||
|
||
.8 ply
|
||
plx
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DevMgr.SYS.FSOut
|
||
lda DevMgr.SYS.CH
|
||
cmp #79
|
||
bne .1
|
||
|
||
stz DevMgr.SYS.CH
|
||
bra DevMgr.SYS.LF
|
||
|
||
.1 inc DevMgr.SYS.CH
|
||
rts
|
||
*--------------------------------------
|
||
DevMgr.SYS.CR jsr DevMgr.SYS.ClrEOL
|
||
stz DevMgr.SYS.CH
|
||
rts
|
||
*--------------------------------------
|
||
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.ScrollAux
|
||
sta SETREADAUX
|
||
|
||
.1 lda (ZPDRV+2),y
|
||
sta (ZPDRV),y
|
||
dey
|
||
bpl .1
|
||
|
||
sta CLRREADAUX
|
||
rts
|
||
*--------------------------------------
|
||
DevMgr.SYS.Scroll
|
||
ldx #1
|
||
.1 jsr DevMgr.SYS.SetBaseX
|
||
|
||
inx
|
||
lda DevMgr.SYS.BASEL,x
|
||
sta ZPDRV+2
|
||
lda DevMgr.SYS.BASEH,x
|
||
sta ZPDRV+3
|
||
|
||
php
|
||
sei
|
||
|
||
ldx #DevMgr.SYS.Scroll-DevMgr.SYS.ScrollAux-1
|
||
|
||
.2 lda DevMgr.SYS.ScrollAux,x
|
||
sta $102,x
|
||
dex
|
||
bpl .2
|
||
|
||
ldy #39
|
||
|
||
sta SETWRITEAUX
|
||
jsr $102
|
||
sta CLRWRITEAUX
|
||
|
||
plp
|
||
|
||
ldy #39
|
||
|
||
.3 lda (ZPDRV+2),y
|
||
sta (ZPDRV),y
|
||
dey
|
||
bpl .3
|
||
|
||
cpx #23
|
||
bne .1 Fall in ClrLineAtX for last line
|
||
*--------------------------------------
|
||
DevMgr.SYS.ClrLineAtX
|
||
jsr DevMgr.SYS.SetBaseX
|
||
|
||
lda #$A0
|
||
ldy #39
|
||
|
||
php
|
||
sei
|
||
|
||
.1 sta SETWRITEAUX
|
||
sta (ZPDRV),y
|
||
sta CLRWRITEAUX
|
||
sta (ZPDRV),y
|
||
dey
|
||
bpl .1
|
||
|
||
plp
|
||
|
||
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
|
||
jsr DevMgr.SYS.SetBaseX
|
||
tya
|
||
lsr
|
||
tay
|
||
|
||
pla
|
||
|
||
bcs .2
|
||
|
||
php
|
||
sei
|
||
sta SETWRITEAUX
|
||
sta (ZPDRV),y
|
||
sta CLRWRITEAUX
|
||
plp
|
||
ply
|
||
rts
|
||
|
||
.2 sta (ZPDRV),y
|
||
ply
|
||
rts
|
||
*--------------------------------------
|
||
DevMgr.SYS.SetBaseX
|
||
lda DevMgr.SYS.BASEL,x
|
||
sta ZPDRV
|
||
lda DevMgr.SYS.BASEH,x
|
||
sta ZPDRV+1
|
||
rts
|
||
*--------------------------------------
|
||
DevMgr.SYS.CH .BS 1
|
||
DevMgr.SYS.CV .BS 1
|
||
*--------------------------------------
|
||
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 04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SYS/KERNEL.S.D01
|
||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||
ASM
|