A2osX/BASIC.FX/BASIC.S.C.txt

1851 lines
28 KiB
Plaintext
Raw Normal View History

NEW
AUTO 3,1
*--------------------------------------
BS.KW.BSAVE bcc LAE2D
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
2022-04-03 21:25:00 +00:00
and #CMDBITS1.A+CMDBITS1.E+CMDBITS1.L
cmp #CMDBITS1.A+CMDBITS1.L
XAE00 bcc LAE31
2022-03-13 12:52:24 +00:00
lda GP.ParamA
sta GP.CRAUXTYPE
sta GP.FIAUXTYPE
2022-03-13 12:52:24 +00:00
lda GP.ParamA+1
sta GP.CRAUXTYPE+1
sta GP.FIAUXTYPE+1
2022-03-13 12:52:24 +00:00
lda #$06
sta GP.ParamT
sta GP.FITYPE
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS
2022-04-03 21:25:00 +00:00
and #CMDBITS0.T
bne LAE31
jsr BS.CreateFileOrDir
bcs LAE33
jsr BS.GetFileInfo
bcs LAE33
2022-03-13 12:52:24 +00:00
LAE2D lda #$02
bne LAE44
2022-03-13 12:52:24 +00:00
LAE31 lda #$06
LAE33 sec
rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
BS.KW.BRUN jsr BS.KW.BLOAD
bcs LAE33
jsr LAE3F
clc
rts
LAE3F jmp (GP.MLIRW.DATAPTR)
2022-03-15 19:33:19 +00:00
*--------------------------------------
2022-03-13 12:52:24 +00:00
BS.KW.BLOAD lda #$01
LAE44 ldx #$06
jsr BS.CheckFTypeXAccessA
bcs LAE33
ldx GP.ParamA
ldy GP.ParamA+1
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
bmi LAE66
ldx GP.FIAUXTYPE
ldy GP.FIAUXTYPE+1
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS
2022-04-03 21:25:00 +00:00
and #CMDBITS0.T
bne LAEAB
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
LAE66 stx GP.MLIRW.DATAPTR
sty GP.MLIRW.DATAPTR+1
bit GP.FoundBITS+1
bvs LAE80
pha
2022-03-13 12:52:24 +00:00
lda GP.FITYPE
cmp #$06
bne LAE7F
stx GP.FIAUXTYPE
sty GP.FIAUXTYPE+1
LAE7F pla
LAE80 ldx GP.ParamL
ldy GP.ParamL+1
and #$30
beq LAEAF
eor #$30
beq LAEAB
and #$10
beq LAEC5
2022-03-13 12:52:24 +00:00
lda GP.ParamE
sec
sbc GP.ParamA
tax
2022-03-13 12:52:24 +00:00
lda GP.ParamE+1
sbc GP.ParamA+1
tay
inx
bne LAEA5
iny
LAEA5 bcs LAEC5
lda #BS.E.RANGE
.HS 2C BIT ABS
LAEAB lda #BS.E.INVOPT
sec
rts
LAEAF jsr BS.MLIGetEOF
bcs LAEC3
ldx GP.SBUFADR
ldy GP.SBUFADR+1
2022-03-13 12:52:24 +00:00
lda GP.SBUFADR+2
beq LAEC5
lda #BS.E.TOOLARGE
LAEC3 sec
rts
LAEC5 stx GP.MLIRW.COUNT
sty GP.MLIRW.COUNT+1
2022-04-03 21:25:00 +00:00
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
2022-04-03 21:25:00 +00:00
and #CMDBITS1.B
beq LAEF7
ldx #$02
2022-03-13 12:52:24 +00:00
LAED4 lda GP.ParamB,x
sta GP.SBUFADR,x
dex
bpl LAED4
LAEDD jsr BS.MLISetMark
ldx GP.XCNUM
bcc LAEF7
cmp #$02
bne LAEC3
cpx #$0F
bne LAEC3
jsr BS.MLISetEOF
bcc LAEDD
rts
LAEF7 ldx GP.XCNUM
2022-03-15 19:33:19 +00:00
lda #MLI.C.READ
cpx #$0F
bne LAF24
bit GP.FoundBITS+1
bvs LAF22
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
2022-04-03 21:25:00 +00:00
and #CMDBITS1.E+CMDBITS1.L
beq LAF22
2022-03-13 12:52:24 +00:00
ldx GP.MLIRW.COUNT
ldy GP.MLIRW.COUNT+1
jsr BS.SetSBUFADRXY0
jsr BS.MLISetEOF
2022-03-13 12:52:24 +00:00
LAF22 lda #MLI.C.WRITE
LAF24 jsr GP.GOSYSTEM
bcs LAF38
2022-03-13 12:52:24 +00:00
bit GP.FoundBITS+1
bvs LAF35
cpx #$0F
bne LAF35
jsr BS.SetFileInfoNoDate
2022-03-15 19:33:19 +00:00
LAF35 jmp BS.MLIClose
LAF38 rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
BS.KW.STORE bcc LAF4E
2022-03-13 12:52:24 +00:00
lda #$FD
sta GP.ParamT
sta GP.FITYPE
2022-03-13 12:52:24 +00:00
lda #$C3
sta GP.FIACCESS
jsr BS.CreateFileOrDir
bcs LAF9C
LAF4E jsr LA411
bcs LAF9C
ldx #$FD
2022-03-13 12:52:24 +00:00
lda #$02
jsr BS.CheckFTypeXAccessA
bcs LAF95
jsr BS.SetupRWBASHDR
jsr BS.WriteXYBytes
bcs LAF95
2022-03-13 12:52:24 +00:00
lda XBBE9
sta GP.MLIRW.DATAPTR
sta GP.FIAUXTYPE
2022-03-13 12:52:24 +00:00
lda XBBEA
sta GP.MLIRW.DATAPTR+1
sta GP.FIAUXTYPE+1
ldy XBBEC
ldx XBBEB
jsr BS.WriteXYBytes
bcs LAF95
jsr BS.MLIGetMark
2022-03-13 12:52:24 +00:00
jsr BS.MLISetEOF
bcs LAF95
jsr BS.SetFileInfoNoDate
bcs LAF95
LAF92 jsr BS.MLIClose
LAF95 php
pha
jsr LA480
pla
plp
LAF9C rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
BS.SetupRWBASHDR
lda #BS.BAS.HDR
sta GP.MLIRW.DATAPTR
lda /BS.BAS.HDR
sta GP.MLIRW.DATAPTR+1
ldy #$00
ldx #$05
rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
BS.KW.RESTORE ldx #$FD
2022-03-13 12:52:24 +00:00
lda #$01
jsr BS.CheckFTypeXAccessA
bcs LAF9C
jsr BS.SetupRWBASHDR
jsr BS.ReadXYBytes
bcs LAF9C
2022-03-13 12:52:24 +00:00
lda GP.FIAUXTYPE
sta XBBE9
sta GP.MLIRW.DATAPTR
2022-03-13 12:52:24 +00:00
lda AS.HIMEM+1
sec
sbc BS.BAS.HDR+4
clc
adc GP.FIAUXTYPE+1
sta GP.MLIRW.DATAPTR+1
sta XBBEA
cmp AS.PGRMEND+1
bcc LAFF3
beq LAFF3
2022-03-13 12:52:24 +00:00
lda #$00
sbc XBBE9
tax
2022-03-13 12:52:24 +00:00
lda AS.HIMEM+1
sbc XBBEA
tay
jsr BS.ReadXYBytes
bcs LAF9C
bra LAF92
LAFF3 lda #BS.E.TOOLARGE
sec
rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
BS.ReadXYBytes clc
.HS B0 BCS
BS.WriteXYBytes sec
2022-03-15 19:33:19 +00:00
sty GP.MLIRW.COUNT+1
stx GP.MLIRW.COUNT
bcc BS.MLIRead
BS.MLIWrite lda #MLI.C.WRITE
.HS 2C BIT ABS
BS.MLIRead lda #MLI.C.READ
2022-03-15 19:33:19 +00:00
.HS 2C BIT ABS
BS.MLIClose lda #MLI.C.CLOSE
.HS 2C BIT ABS
BS.MLIGetEOF lda #MLI.C.GETEOF
.HS 2C BIT ABS
BS.MLISetEOF lda #MLI.C.SETEOF
.HS 2C BIT ABS
BS.MLIGetMark lda #MLI.C.GETMARK
.HS 2C BIT ABS
BS.MLISetMark lda #MLI.C.SETMARK
2022-03-15 19:33:19 +00:00
jmp GP.GOSYSTEM
*--------------------------------------
BS.KW.PR lda #$00
tax
beq LB018
2022-03-15 19:33:19 +00:00
*--------------------------------------
BS.KW.IN ldx #$02
2022-03-13 12:52:24 +00:00
lda #$08
LB018 stx BS.GetCharSep
ora GP.ParamINPR
asl
tax
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS
2022-04-03 21:25:00 +00:00
and #CMDBITS0.SLOT
beq LB035
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
bmi LB04A
2022-03-13 12:52:24 +00:00
lda GP.OUTVECT0,x
sta GP.ParamA
2022-03-13 12:52:24 +00:00
lda GP.OUTVECT0+1,x
sta GP.ParamA+1
LB035 jsr LB05C
bcs LB049
ldy BS.GetCharSep
2022-03-13 12:52:24 +00:00
lda GP.ParamA
sta ZP.CSW,y
2022-03-13 12:52:24 +00:00
lda GP.ParamA+1
sta ZP.CSW+1,y
LB049 rts
LB04A jsr LB05C
bcs LB05B
2022-03-13 12:52:24 +00:00
lda GP.ParamA+1
sta GP.OUTVECT0+1,x
2022-03-13 12:52:24 +00:00
lda GP.ParamA
sta GP.OUTVECT0,x
LB05B rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
2022-03-13 12:52:24 +00:00
LB05C lda GP.ParamA
sta ZP.PCL
2022-03-13 12:52:24 +00:00
lda GP.ParamA+1
sta ZP.PCH
ldy #$00
cmp #$C0
bcc LB081
2022-03-13 12:52:24 +00:00
lda $CFFF
sty ZP.A1L
2022-03-13 12:52:24 +00:00
lda (ZP.PCL),y
cmp #$FF
beq LB087
LB077 cmp (ZP.PCL),y
bne LB087
dec ZP.A1L
bne LB077
LB07F clc
rts
2022-03-13 12:52:24 +00:00
LB081 lda (ZP.PCL),y
cmp #$D8
beq LB07F
LB087 lda #BS.E.NODEV
sec
rts
2022-03-13 12:52:24 +00:00
*--------------------------------------
BS.KW.BYE jsr BS.CloseAll
jsr LB36B
2022-03-27 12:59:32 +00:00
jsr BS.RAMReset
* lda #$65
jsr MLI
.DA #MLI.C.QUIT
.DA GP.MLIRW
2022-03-13 12:52:24 +00:00
*--------------------------------------
2022-03-27 12:59:32 +00:00
BS.QUIT.IIgs jsr BS.RAMReset
jsr MLI
.DA #MLI.C.QUIT
2022-03-13 12:52:24 +00:00
.DA .1
.1 .DA #4
.DA #$EE
.DA MLI.PATHBUF
.DA #0
.DA 0
2022-03-13 12:52:24 +00:00
*--------------------------------------
2022-03-27 12:59:32 +00:00
BS.RAMReset bit GP.CISPARE1
bpl .8
php
sei
2022-04-03 21:25:00 +00:00
2022-03-27 12:59:32 +00:00
sta IO.SETWRITEAUX
2022-04-03 21:25:00 +00:00
2022-03-27 12:59:32 +00:00
lda #$FF
sta AUX.RAMSIG
2022-05-25 18:46:02 +00:00
dec $FE
2022-03-27 12:59:32 +00:00
sta AUX.RAMSIG+1 Set $E000-$FEFF as BLOCK FREE
2022-04-03 21:25:00 +00:00
2022-03-27 12:59:32 +00:00
sta IO.CLRWRITEAUX
plp
.8 rts
2022-04-03 21:25:00 +00:00
*--------------------------------------
2022-03-13 12:52:24 +00:00
BS.KW.CAT lda #$27
.HS 2C BIT ABS
BS.KW.CATALOG lda #$4F
2022-03-13 12:52:24 +00:00
sta BS.CATWIDTH
2022-04-03 21:25:00 +00:00
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS
2022-04-03 21:25:00 +00:00
and #CMDBITS0.T+CMDBITS0.FN1
lsr
bne LB0BA
sta GP.ParamT
LB0BA bcs LB0C1
jsr BS.GetFileInfo
bcs LB127
LB0C1 jsr BS.OpenDir
bcs LB127
jsr MON.CROUT
jsr BS.Filename2LineBuf
jsr BS.LINEBUFOUT
jsr MON.CROUT
jsr BS.LINEBUFCLR80
2022-03-27 12:59:32 +00:00
ldy #$10
ldx #BSX.GetMSGY.X
jsr BS.ToAUX
jsr BS.LINEBUFOUT
jsr MON.CROUT
2022-04-03 21:25:00 +00:00
* lda BS.CAT.FileCnt
* ora BS.CAT.FileCnt+1
LB0E8 jsr LB241
bcs LB113
2022-03-13 12:52:24 +00:00
lda GP.ParamT
beq LB0F7
cmp DIRENTBUF.TYPE
bne LB0FD
LB0F7 ldx #BSX.MkCatLine.X
jsr BS.ToAUX
2022-04-03 21:25:00 +00:00
jsr BS.LINEBUFOUT
2022-03-13 12:52:24 +00:00
LB0FD lda IO.KBD
cmp #$83
bne LB10E
2022-03-13 12:52:24 +00:00
lda GP.STATE
bne LB113
bit IO.KSTROBE
bcs LB113
2022-03-13 12:52:24 +00:00
LB10E lda #$FF
bne LB0E8
2022-03-15 19:33:19 +00:00
LB113 jsr BS.MLIClose
bcs LB127
jsr MON.CROUT
jsr BS.MkCatLineF
bcs LB127
jsr BS.LINEBUFOUT
jsr MON.CROUT
clc
LB127 rts
2022-03-13 12:52:24 +00:00
*--------------------------------------
BS.Filename2LineBuf
jsr BS.LINEBUFCLR80
ldx #$01
ldy DIRENTBUF.STNL
lda #"/"
cpy #$F0
bcc LB13A
sta IO.LINEBUF,x
inx
LB13A tya
and #$0F
sta IO.LINEBUF
ldy #$05
2022-03-13 12:52:24 +00:00
LB142 lda DIRENTBUF,y
ora #$80
sta IO.LINEBUF,x
iny
inx
dec IO.LINEBUF
bne LB142
2022-03-13 12:52:24 +00:00
lda #$A2
sta IO.LINEBUF
rts
*--------------------------------------
2022-04-03 21:25:00 +00:00
BS.MkCatLineF jsr BS.SetSBUFADRCMDBUF
2022-03-13 12:52:24 +00:00
lda MLI.DEVNUM
sta GP.MLIMRKEOFBUF.REFNUM
2022-03-13 12:52:24 +00:00
lda #MLI.C.ONLINE
jsr GP.GOSYSTEM
bcs LB127
2022-03-13 12:52:24 +00:00
lda BS.CMDBUF
and #$0F
inc
sta BS.CMDBUF.LEN
lda #"/"
sta BS.CMDBUF
jsr BS.GetFileInfo
bcs LB127
ldx #BSX.MkCatLineF.X
jsr BS.ToAUX
2022-03-27 12:59:32 +00:00
clc
rts
2022-03-13 12:52:24 +00:00
*--------------------------------------
BS.OpenDir lda #$01
ldx #$0F
ldy GP.STTYPE
cpy #$0F
bne LB1C8
stx GP.FITYPE
LB1C8 jsr BS.OpenTypeXAccessA
bcs LB203
2022-03-13 12:52:24 +00:00
BS.ReadDirEnt lda #$59
sta GP.MLIRW.DATAPTR
2022-03-13 12:52:24 +00:00
lda #$02
sta GP.MLIRW.DATAPTR+1
2022-03-13 12:52:24 +00:00
lda #$2B
sta GP.MLIRW.COUNT
2022-03-13 12:52:24 +00:00
stz GP.MLIRW.COUNT+1
jsr BS.MLIRead
bcs LB203
lda $27D
sta BS.CAT.EPB
2022-05-25 18:46:02 +00:00
lda $27C
sta BS.CAT.EL
sta GP.MLIRW.COUNT
2022-03-13 12:52:24 +00:00
lda #$01
sta BS.CAT.EICB
2022-03-15 19:33:19 +00:00
2022-03-13 12:52:24 +00:00
stz GP.SBUFADR+1
stz GP.SBUFADR+2
LB203 rts
*--------------------------------------
BS.CheckFTypeXAccessA
pha
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS
2022-04-03 21:25:00 +00:00
and #CMDBITS0.T
beq LB20F
ldx GP.ParamT
LB20F pla
BS.OpenTypeXAccessA
cpx GP.FITYPE
bne LB239
and GP.FIACCESS
beq LB23D
2022-04-03 21:25:00 +00:00
lda BS.BUFPAGE
sta GP.OSYSBUF+1
2022-03-13 12:52:24 +00:00
lda #$0F
sta MLI.LEVEL
2022-03-13 12:52:24 +00:00
lda #MLI.C.OPEN
jsr GP.GOSYSTEM
bcs LB238
2022-03-13 12:52:24 +00:00
lda GP.OREFNUM
sta GP.MLIRW.REFNUM
sta GP.MLICF.REFNUM
sta GP.MLIMRKEOFBUF.REFNUM
LB238 rts
LB239 lda #BS.E.MISMATCH
.HS 2C BIT ABS
LB23D lda #BS.E.LOCKED
sec
rts
2022-03-13 12:52:24 +00:00
*--------------------------------------
LB241 lda GP.SBUFADR+1
and #$FE
sta GP.SBUFADR+1
ldy BS.CAT.EICB
2022-03-13 12:52:24 +00:00
lda #$00
2022-04-03 21:25:00 +00:00
cpy BS.CAT.EPB
bcc LB25D
tay
sty BS.CAT.EICB
inc GP.SBUFADR+1
LB25A inc GP.SBUFADR+1
LB25D dey
clc
bmi LB268
2022-04-03 21:25:00 +00:00
adc BS.CAT.EL
bcc LB25D
bcs LB25A
LB268 adc #$04
sta GP.SBUFADR
jsr BS.MLISetMark
bcs LB28D
jsr BS.MLIRead
bcs LB28D
inc BS.CAT.EICB
2022-03-13 12:52:24 +00:00
lda DIRENTBUF
and #$F0
beq LB241
2022-03-15 19:33:19 +00:00
* lda BS.CAT.FileCnt
* bne .1
* dec BS.CAT.FileCnt+1
*.1 dec BS.CAT.FileCnt
2022-03-15 19:33:19 +00:00
LB28D rts
*--------------------------------------
BS.KW.EXTERNAL jmp (GP.XTRNADDR)
2022-03-15 19:33:19 +00:00
*--------------------------------------
BS.KW.EXEC jsr BS.CheckFilename
bcs LB2C0
bit GP.EXECFILE
bpl LB2BC
sta GP.MLIMRKEOFBUF.REFNUM
2022-03-15 19:33:19 +00:00
2022-03-13 12:52:24 +00:00
jsr BS.ZeroSBUFADR
2022-03-15 19:33:19 +00:00
jsr BS.MLISetMark
bcs LB2B5
2022-03-13 12:52:24 +00:00
lda GP.MLIMRKEOFBUF.REFNUM
bne LB333
LB2B5 pha
jsr LB36B
pla
sec
rts
LB2BC lda #BS.E.FBUSTY
sec
rts
LB2C0 bit GP.EXECACTV
bpl LB2CA
jsr LB36B
bcs LB2D3
2022-03-13 12:52:24 +00:00
LB2CA lda GP.FITYPE
cmp #$04
beq LB2D5
lda #BS.E.MISMATCH
LB2D3 sec
rts
2022-04-03 11:55:03 +00:00
LB2D5 jsr BS.GetSysBuf
bcs LB2D3
2022-03-13 12:52:24 +00:00
stz GP.SBUFADR
2022-03-15 19:33:19 +00:00
2022-04-03 21:25:00 +00:00
lda BS.BUFPAGE
sta GP.SBUFADR+1
ldx GP.OPENCNT
beq LB30E
tay
txa
asl
asl
2022-04-03 21:25:00 +00:00
adc BS.BUFPAGE
pha
2022-03-15 19:33:19 +00:00
2022-04-07 17:19:48 +00:00
LB2F2 cmp BS.BUFPAGEs-1,x
beq LB2FB
dex
bne LB2F2
brk
LB2FB tya
2022-04-07 17:19:48 +00:00
sta BS.BUFPAGEs-1,x
lda BS.REFNUMs,x
sta GP.MLIMRKEOFBUF.REFNUM
2022-03-13 12:52:24 +00:00
lda #MLI.C.SETBUF
jsr GP.GOSYSTEM
bcc LB30D
brk
LB30D pla
2022-04-07 17:19:48 +00:00
2022-04-03 21:25:00 +00:00
LB30E sta BS.BUFPAGE
sta GP.OSYSBUF+1
2022-03-15 19:33:19 +00:00
2022-03-13 12:52:24 +00:00
stz MLI.LEVEL
2022-03-15 19:33:19 +00:00
2022-03-13 12:52:24 +00:00
lda #MLI.C.OPEN
jsr GP.GOSYSTEM
bcc LB327
pha
2022-04-07 17:19:48 +00:00
jsr BS.FreeSysBuf
pla
sec
rts
LB327 ldx GP.OSYSBUF+1
stx BS.REFNUMs
2022-03-13 12:52:24 +00:00
lda GP.OREFNUM
2022-04-03 21:25:00 +00:00
sta BS.REFNUM
2022-03-13 12:52:24 +00:00
LB333 sta GP.MLIRW.REFNUM
sta GP.MLIMRKEOFBUF.REFNUM
sta GP.NEWLREF
2022-04-03 11:55:03 +00:00
ldx GP.FIAUXTYPE
stx GP.ParamL
ldx GP.FIAUXTYPE+1
stx GP.ParamL+1
2022-04-03 11:55:03 +00:00
jsr BS.AddOpenFile
2022-03-13 12:52:24 +00:00
lda #$7F
sta GP.NLINEMASK
2022-03-13 12:52:24 +00:00
lda #MLI.C.NEWLINE
jsr GP.GOSYSTEM
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
2022-04-03 21:25:00 +00:00
and #CMDBITS1.F+CMDBITS1.R
beq LB364
jsr LB592
bcc LB364
jmp LB2B5
2022-03-13 12:52:24 +00:00
LB364 lda #$FF
sta GP.EXECACTV
clc
rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
2022-03-13 12:52:24 +00:00
LB36B lda GP.EXECACTV
2022-05-25 18:46:02 +00:00
bpl .8
sta GP.EXECFILE
ldx #$08
lda BS.REFNUMs,x
jsr BS.CloseA
2022-05-25 18:46:02 +00:00
.8 rts
*--------------------------------------
BS.KW.VERIFY bcs LB3B7
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS
2022-04-03 21:25:00 +00:00
and #CMDBITS1.R
2022-05-25 18:46:02 +00:00
bne .8
2022-03-27 12:59:32 +00:00
ldy #0
jsr BS.GetMSGY
jsr MON.CROUT
2022-05-25 18:46:02 +00:00
.8 clc
rts
2022-03-13 12:52:24 +00:00
* lda #$00
2022-05-25 18:46:02 +00:00
* beq LB39F BS.KW.FLUSH.1
2022-05-25 18:46:02 +00:00
*--------------------------------------
2022-03-13 12:52:24 +00:00
BS.KW.FLUSH lda GP.FoundBITS
2022-04-03 21:25:00 +00:00
and #CMDBITS1.R
2022-05-25 18:46:02 +00:00
beq .1
jsr BS.CheckFilename
2022-05-25 18:46:02 +00:00
bcs .9
2022-05-25 18:46:02 +00:00
.1 sta GP.MLICF.REFNUM
2022-03-13 12:52:24 +00:00
lda #MLI.C.FLUSH
jsr GP.GOSYSTEM
2022-05-25 18:46:02 +00:00
.9 rts
*--------------------------------------
BS.KW.OPEN php
jsr BS.CheckFilename
bcs LB3BB
plp
lda #BS.E.FBUSTY
.HS 2C BIT ABS
LB3B3 lda #BS.E.MISMATCH
.HS 2C BIT ABS
LB3B7 lda #BS.E.PATHNFND6
sec
LB3B9 rts
LB3BB plp
ldx #$00
ldy #$00
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
2022-04-03 11:55:03 +00:00
and #CMDBITS1.L
bne LB3CD
stx GP.ParamL+1
sty GP.ParamL
2022-03-13 12:52:24 +00:00
LB3CD lda GP.FoundBITS
2022-04-03 11:55:03 +00:00
and #CMDBITS0.T
eor #CMDBITS0.T
beq LB3DB
2022-03-13 12:52:24 +00:00
lda #$04
sta GP.ParamT
LB3DB bcc LB3FE
beq LB3B7
sta GP.FITYPE
2022-03-13 12:52:24 +00:00
lda #$C3
sta GP.FIACCESS
ldx GP.ParamL+1
ldy GP.ParamL
stx GP.CRAUXTYPE+1
stx GP.FIAUXTYPE+1
sty GP.CRAUXTYPE
sty GP.FIAUXTYPE
jsr BS.CreateFileOrDir
bcs LB3B9
2022-03-13 12:52:24 +00:00
LB3FE lda GP.FITYPE
cmp GP.ParamT
bne LB3B3
cmp #$04
bne LB41D
ldx GP.FIAUXTYPE+1
ldy GP.FIAUXTYPE
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
2022-04-03 11:55:03 +00:00
and #CMDBITS1.L
bne LB41D
stx GP.ParamL+1
sty GP.ParamL
2022-04-03 11:55:03 +00:00
LB41D jsr BS.GetSysBuf
bcs LB3B9
2022-04-03 21:25:00 +00:00
lda BS.BUFPAGE
sta GP.OSYSBUF+1
2022-04-07 17:19:48 +00:00
2022-03-13 12:52:24 +00:00
lda #$07
sta MLI.LEVEL
2022-04-07 17:19:48 +00:00
2022-03-13 12:52:24 +00:00
lda #MLI.C.OPEN
jsr GP.GOSYSTEM
bcc LB43B
pha
2022-04-07 17:19:48 +00:00
jsr BS.FreeSysBuf
pla
sec
rts
2022-03-13 12:52:24 +00:00
LB43B lda GP.FITYPE
cmp #$0F
beq LB443
clc
2022-03-13 12:52:24 +00:00
LB443 lda #$00
ror
sta GP.DIRFLG
ldx GP.OPENCNT
2022-04-03 21:25:00 +00:00
lda BS.BUFPAGE
2022-04-07 17:19:48 +00:00
sta BS.BUFPAGEs,x
2022-03-13 12:52:24 +00:00
lda GP.OREFNUM
sta BS.REFNUMs+1,x
inc GP.OPENCNT
*--------------------------------------
2022-04-03 11:55:03 +00:00
BS.AddOpenFile asl
asl
asl
asl
asl
tax
2022-03-13 12:52:24 +00:00
lda MLI.PATHBUF
ora GP.DIRFLG
2022-04-03 21:25:00 +00:00
sta BS.OpenFiles,x
and #$7F
tay
cmp #$1E
bcc LB473
2022-03-13 12:52:24 +00:00
lda #$1D
LB473 sta ZP.PCL
2022-04-03 11:55:03 +00:00
2022-03-13 12:52:24 +00:00
lda GP.ParamL
2022-04-03 21:25:00 +00:00
sta BS.OpenFiles+1,x
2022-03-13 12:52:24 +00:00
lda GP.ParamL+1
2022-04-03 21:25:00 +00:00
sta BS.OpenFiles+2,x
LB481 inx
2022-03-13 12:52:24 +00:00
lda MLI.PATHBUF,y
2022-04-03 21:25:00 +00:00
sta BS.OpenFiles+2,x
dey
dec ZP.PCL
bne LB481
2022-04-19 18:24:34 +00:00
clc
rts
2022-03-27 12:59:32 +00:00
*--------------------------------------
BS.CheckFilename
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS
2022-04-03 11:55:03 +00:00
and #CMDBITS0.FN1
bne LB49A
lda #BS.E.SYNTAX
sec
rts
LB49A ldx GP.OPENCNT
beq LB4B8
stx GP.EXECFILE
LB4A2 stx ZP.PCH
lda BS.REFNUMs,x
2022-04-03 11:55:03 +00:00
jsr BS.FindOpenFile
bne LB4B3
ldx ZP.PCH
LB4AE lda BS.REFNUMs,x
LB4B1 clc
rts
LB4B3 ldx ZP.PCH
dex
bne LB4A2
2022-03-13 12:52:24 +00:00
LB4B8 lda GP.EXECACTV
bpl LB4CE
2022-04-03 21:25:00 +00:00
lda BS.REFNUM
2022-04-03 11:55:03 +00:00
jsr BS.FindOpenFile
bne LB4CE
2022-03-13 12:52:24 +00:00
lda #$FF
sta GP.EXECFILE
ldx #$08
bne LB4AE
LB4CE lda #BS.E.FNOTOPEN
sec
rts
*--------------------------------------
2022-04-03 11:55:03 +00:00
BS.FindOpenFile asl
asl
asl
asl
asl
tax
2022-04-03 21:25:00 +00:00
lda BS.OpenFiles,x
sta GP.DIRFLG
and #$7F
cmp MLI.PATHBUF
bne LB508
tay
cmp #$1E
bcc LB4EC
2022-03-13 12:52:24 +00:00
lda #$1D
LB4EC sta ZP.PCL
2022-04-03 11:55:03 +00:00
2022-04-03 21:25:00 +00:00
lda BS.OpenFiles+1,x
sta BS.RecordSize
lda BS.OpenFiles+2,x
sta BS.RecordSize+1
LB4FA inx
2022-03-13 12:52:24 +00:00
lda MLI.PATHBUF,y
2022-04-03 21:25:00 +00:00
cmp BS.OpenFiles+2,x
bne LB508
dey
dec ZP.PCL
bne LB4FA
LB508 rts
*--------------------------------------
BS.KW.CLOSE lda GP.FoundBITS
2022-04-03 21:25:00 +00:00
and #CMDBITS0.FN1
beq BS.CloseAll
jsr BS.CheckFilename
bcs LB4B1
BS.CloseA sta GP.MLICF.REFNUM
2022-04-07 17:19:48 +00:00
lda BS.BUFPAGEs-1,x
2022-04-03 21:25:00 +00:00
sta BS.BUFPAGE
bit GP.EXECFILE
bmi LB53F
ldy GP.OPENCNT
pha
2022-04-07 17:19:48 +00:00
lda BS.BUFPAGEs-1,y
sta BS.BUFPAGEs-1,x
pla
2022-04-07 17:19:48 +00:00
sta BS.BUFPAGEs-1,y
lda BS.REFNUMs,x
pha
lda BS.REFNUMs,y
sta BS.REFNUMs,x
pla
sta BS.REFNUMs,y
2022-03-13 12:52:24 +00:00
LB53F stz MLI.LEVEL
2022-03-15 19:33:19 +00:00
jsr BS.MLIClose
bcs LB572
2022-04-07 17:19:48 +00:00
jsr BS.FreeSysBuf
bit GP.EXECFILE
bpl LB55E
2022-03-13 12:52:24 +00:00
stz GP.EXECACTV
stz GP.EXECFILE
rts
LB55E dec GP.OPENCNT
rts
2022-03-27 12:59:32 +00:00
*--------------------------------------
BS.CloseAll ldx GP.OPENCNT
beq LB573
stx GP.EXECFILE
lda BS.REFNUMs,x
jsr BS.CloseA
bcc BS.CloseAll
LB572 rts
2022-03-13 12:52:24 +00:00
LB573 stz GP.MLICF.REFNUM
lda #$07
sta MLI.LEVEL
2022-03-15 19:33:19 +00:00
jmp BS.MLIClose
*--------------------------------------
BS.KW.POSITION jsr BS.CheckFilename
bcs LB5F0
sta GP.MLIRW.REFNUM
sta GP.NEWLREF
bit GP.DIRFLG
bmi LB5F0
2022-03-15 19:33:19 +00:00
*--------------------------------------
2022-03-13 12:52:24 +00:00
LB592 lda GP.FoundBITS+1
2022-04-03 21:25:00 +00:00
and #CMDBITS1.F+CMDBITS1.R
beq LB5ED
cmp #$03
beq LB5ED
and #$01
beq LB5AD
2022-03-13 12:52:24 +00:00
lda GP.ParamR
sta GP.ParamF
2022-03-13 12:52:24 +00:00
lda GP.ParamR+1
sta GP.ParamF+1
2022-03-13 12:52:24 +00:00
LB5AD lda #$EF
sta GP.MLIRW.COUNT
2022-03-13 12:52:24 +00:00
stz GP.MLIRW.COUNT+1
stz GP.MLIRW.DATAPTR
2022-03-13 12:52:24 +00:00
lda #$02
sta GP.MLIRW.DATAPTR+1
2022-03-13 12:52:24 +00:00
lda #$7F
sta GP.NLINEMASK
2022-03-13 12:52:24 +00:00
lda #MLI.C.NEWLINE
jsr GP.GOSYSTEM
bcs LB5F0
2022-03-13 12:52:24 +00:00
LB5CB lda GP.ParamF
ora GP.ParamF+1
clc
beq LB5F0
jsr BS.MLIRead
bcs LB5F0
2022-03-13 12:52:24 +00:00
lda GP.ParamF
sbc #$00
sta GP.ParamF
2022-03-13 12:52:24 +00:00
lda GP.ParamF+1
sbc #$00
sta GP.ParamF+1
bcs LB5CB
LB5ED lda #BS.E.INVOPT
sec
LB5F0 rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
2022-04-03 21:25:00 +00:00
LB5F1 lda BS.RecordSize
sta BS.TMPBUF4
2022-04-03 21:25:00 +00:00
lda BS.RecordSize+1
sta BS.TMPBUF4+1
2022-03-13 12:52:24 +00:00
stz BS.TMPBUF4+2
stz BS.TMPBUF4+3
2022-03-15 19:33:19 +00:00
2022-03-13 12:52:24 +00:00
jsr BS.ZeroSBUFADR
2022-03-15 19:33:19 +00:00
LB60E lsr GP.ParamR+1
ror GP.ParamR
ldx #$00
bcc LB62F
clc
2022-03-13 12:52:24 +00:00
LB619 lda BS.TMPBUF4,x
adc GP.SBUFADR,x
sta GP.SBUFADR,x
inx
txa
eor #$03
bne LB619
bcs LB642
ldx BS.TMPBUF4+3
bne LB642
LB62F rol BS.TMPBUF4,x
inx
txa
eor #$04
bne LB62F
2022-03-13 12:52:24 +00:00
lda GP.ParamR
ora GP.ParamR+1
bne LB60E
clc
rts
LB642 lda #BS.E.RANGE
sec
rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
BS.KW.READ jsr BS.CheckFilename
bcs LB69B
sta GP.MLIRW.REFNUM
sta GP.MLIMRKEOFBUF.REFNUM
sta GP.NEWLREF
bit GP.DIRFLG
bmi LB69C
2022-04-03 21:25:00 +00:00
jsr BS.CheckBFR
bcs LB69B
ldx #$7F
ldy #$EF
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
2022-04-03 21:25:00 +00:00
and #CMDBITS1.L
beq LB67C
ldy GP.ParamL
ldx GP.ParamL+1
bne LB6CB
cpy #$EF
bcs LB6CB
2022-03-13 12:52:24 +00:00
lda #$22
sta IO.LINEBUF
2022-03-13 12:52:24 +00:00
lda #$01
LB67C sta GP.MLIRW.DATAPTR
sty GP.MLIRW.COUNT
stx GP.NLINEMASK
2022-03-13 12:52:24 +00:00
lda #$02
sta GP.MLIRW.DATAPTR+1
2022-03-15 19:33:19 +00:00
2022-03-13 12:52:24 +00:00
stz GP.MLIRW.COUNT+1
lda #MLI.C.NEWLINE
jsr GP.GOSYSTEM
bcs LB69B
2022-03-13 12:52:24 +00:00
LB696 lda #$FF
sta GP.IFILACTV
LB69B rts
2022-03-13 12:52:24 +00:00
LB69C lda #$59
sta GP.MLIRW.DATAPTR
2022-03-13 12:52:24 +00:00
lda #$02
sta GP.MLIRW.DATAPTR+1
2022-03-13 12:52:24 +00:00
lda #$01
sta GP.CATFLAG
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
2022-04-03 21:25:00 +00:00
and #CMDBITS1.R
clc
beq LB696
2022-03-13 12:52:24 +00:00
jsr BS.ZeroSBUFADR
2022-03-15 19:33:19 +00:00
jsr BS.MLISetMark
bcc LB696
LB6CA rts
LB6CB lda #BS.E.RANGE
tax
sec
rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
2022-04-03 21:25:00 +00:00
BS.CheckBFR lda GP.FoundBITS+1
and #CMDBITS1.B+CMDBITS1.F+CMDBITS1.R
beq LB719
2022-04-03 21:25:00 +00:00
and #CMDBITS1.R
beq LB6E5
jsr LB5F1
bcs LB6CB
LB6E0 jsr LB712
bcs LB71A
2022-04-03 21:25:00 +00:00
LB6E5 lda GP.FoundBITS+1
and #CMDBITS1.F
beq LB6F1
jsr LB5AD
bcs LB71A
2022-03-13 12:52:24 +00:00
LB6F1 lda GP.FoundBITS+1
2022-04-03 21:25:00 +00:00
and #CMDBITS1.B
beq LB719
jsr BS.MLIGetMark
bcs LB71A
ldx #$00
ldy #$02
2022-03-13 12:52:24 +00:00
LB703 lda GP.ParamB,x
adc GP.SBUFADR,x
sta GP.SBUFADR,x
inx
dey
bpl LB703
bcs LB6CB
LB712 jsr BS.MLISetMark
bcs LB71A
LB719 clc
LB71A ldx #$00
rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
BS.KW.WRITE jsr BS.CheckFilename
bcs LB732
sta GP.MLIRW.REFNUM
sta GP.MLIMRKEOFBUF.REFNUM
sta GP.NEWLREF
bit GP.DIRFLG
bpl LB734
lda #BS.E.LOCKED
LB732 sec
rts
2022-03-13 12:52:24 +00:00
LB734 stz GP.MLIRW.DATAPTR
lda #$02
sta GP.MLIRW.DATAPTR+1
2022-04-03 21:25:00 +00:00
jsr BS.CheckBFR
bcc LB757
cmp #$02
bne LB732
cpx #$02
beq LB732
LB74B jsr BS.MLISetEOF
bcs LB732
jsr LB6E0
bcs LB732
2022-03-13 12:52:24 +00:00
LB757 lda AS.HIMEM
sta GP.MLIRW.DATAPTR
2022-03-13 12:52:24 +00:00
lda AS.HIMEM+1
sta GP.MLIRW.DATAPTR+1
2022-03-13 12:52:24 +00:00
lda #$FF
sta GP.OFILACTV
clc
rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
BS.KW.APPEND php
jsr BS.CheckFilename
bcc LB77A
plp
jsr BS.KW.OPEN
bcs LB788
2022-03-13 12:52:24 +00:00
lda GP.OREFNUM
bne LB77B
brk
LB77A plp
LB77B sta GP.MLIRW.REFNUM
sta GP.MLIMRKEOFBUF.REFNUM
bit GP.DIRFLG
bpl LB78A
lda #BS.E.LOCKED
2022-04-03 21:25:00 +00:00
sec
2022-04-03 21:25:00 +00:00
LB788 rts
LB78A ldx GP.ParamL
ldy GP.ParamL+1
2022-03-13 12:52:24 +00:00
lda GP.FoundBITS+1
2022-04-03 21:25:00 +00:00
and #CMDBITS1.L
bne LB79D
ldx GP.FIAUXTYPE
ldy GP.FIAUXTYPE+1
2022-03-15 19:33:19 +00:00
2022-04-03 21:25:00 +00:00
LB79D phx
2022-03-13 12:52:24 +00:00
jsr BS.GetFTableIdx
pla
2022-04-03 21:25:00 +00:00
sta BS.OpenFiles+1,x
sta BS.RecordSize
tya
2022-04-03 21:25:00 +00:00
sta BS.OpenFiles+2,x
sta BS.RecordSize+1
jsr BS.MLIGetEOF
bcs LB788
2022-04-03 21:25:00 +00:00
lda BS.RecordSize+1
bne LB7C8
2022-04-03 21:25:00 +00:00
lda BS.RecordSize
cmp #$02
bcc LB7CD
2022-04-03 21:25:00 +00:00
LB7C8 jsr BS.FileLenDivRS
bcs LB788
LB7CD jmp LB74B
2022-03-15 19:33:19 +00:00
*--------------------------------------
2022-04-03 21:25:00 +00:00
BS.FileLenDivRS ldx #$03
2022-04-03 21:25:00 +00:00
LB7D2 lda GP.SBUFADR-1,x
sta BS.TMPBUF4-1,x
dex
bne LB7D2
stz BS.TMPBUF4+3
stz XBC0E
2022-04-03 21:25:00 +00:00
ldy #24
LB7E3 jsr BS.TMPBUF3x2
rol BS.TMPBUF4+3
rol XBC0E
sec
2022-03-13 12:52:24 +00:00
lda BS.TMPBUF4+3
2022-04-03 21:25:00 +00:00
sbc BS.RecordSize
tax
2022-03-13 12:52:24 +00:00
lda XBC0E
2022-04-03 21:25:00 +00:00
sbc BS.RecordSize+1
bcc LB805
stx BS.TMPBUF4+3
sta XBC0E
inc BS.TMPBUF4
LB805 dey
bne LB7E3
2022-03-13 12:52:24 +00:00
lda BS.TMPBUF4+3
ora XBC0E
clc
beq LB839
2022-04-03 21:25:00 +00:00
lda BS.RecordSize
sec
sbc BS.TMPBUF4+3
tax
2022-04-03 21:25:00 +00:00
lda BS.RecordSize+1
sbc XBC0E
tay
txa
clc
adc GP.SBUFADR
sta GP.SBUFADR
tya
adc GP.SBUFADR+1
sta GP.SBUFADR+1
bcc .1
2022-04-03 21:25:00 +00:00
inc GP.SBUFADR+2
2022-04-03 21:25:00 +00:00
.1 lda #BS.E.RANGE
LB839 rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
BS.GetFileInfo ldx #$0A
2022-03-13 12:52:24 +00:00
lda #MLI.C.GETFILEINFO
bne LB858
BS.SetFileInfoNoDate
ldx #7
.1 stz GP.FIMDATE,x
dex
bpl .1
BS.SetFileInfo ldx #$07
2022-03-13 12:52:24 +00:00
lda #MLI.C.SETFILEINFO
LB858 stx GP.SSGINFO
jmp GP.GOSYSTEM
BS.JMP.GP.VSYSO jmp (GP.VSYSO)
BS.JMP.GP.VSYSI jmp (GP.VSYSI)
*--------------------------------------
2022-03-27 12:59:32 +00:00
BS.KW.MTR jsr BS.SetState0
jsr MON.CLREOL
jmp MON.ENTERMON
*--------------------------------------
BS.KW.MEM jsr MON.CROUT
ldx #9
.1 lda AS.PGRMSTART,x
sta $260,x
dex
bpl .1
2022-04-03 21:25:00 +00:00
lda AS.HIMEM
sta $260+10
lda AS.HIMEM+1
sta $260+11
lda #0
sta XBC10
.2 ldx #BSX.Mem.X
jsr BS.ToAUX
jsr BS.LINEBUFOUT
inc XBC10
lda XBC10
cmp #6
bne .2
2022-04-03 21:25:00 +00:00
jsr MON.CROUT
2022-04-03 21:25:00 +00:00
clc
rts
*--------------------------------------
BS.KW.ONLINE jsr MON.CROUT
2022-04-03 21:25:00 +00:00
jsr BS.SetSBUFADRCMDBUF
lda MLI.DEVNUM
pha
lda #$10
.1 sta GP.MLIMRKEOFBUF.REFNUM
lda #MLI.C.ONLINE
jsr GP.GOSYSTEM
bcs .7
2022-04-03 21:25:00 +00:00
lda BS.CMDBUF
and #$0F
inc
sta BS.CMDBUF.LEN
lda #'/'
sta BS.CMDBUF
2022-04-03 21:25:00 +00:00
jsr BS.GetFileInfo
bcs .7
2022-04-03 21:25:00 +00:00
ldx #BSX.Online.X
jsr BS.ToAUX
2022-04-03 21:25:00 +00:00
jsr BS.LINEBUFOUT
2022-04-03 21:25:00 +00:00
.7 lda GP.MLIMRKEOFBUF.REFNUM
eor #$80
bmi .1
2022-04-03 21:25:00 +00:00
clc
adc #$10
bpl .1
2022-04-03 21:25:00 +00:00
jsr MON.CROUT
2022-04-03 21:25:00 +00:00
pla
sta MLI.DEVNUM
2022-04-19 18:24:34 +00:00
BS.KW.NOMON clc
rts
*--------------------------------------
2022-05-25 18:46:02 +00:00
* FORMAT VOLNAME,Sx,Dy
* ,A<HEADCOUNT>,E<TRACKCOUNT>,F<STEPPING>
* ,L<CATBLOCK>,B<BLOCK>
*
* d : 1,2 heads
* sss : 4,3,2,1 steppings
* => T : dev type, 0 = BLK, 255 = D2
* => V : d0000sss
*--------------------------------------
BS.KW.FORMAT ldx #BSX.FMT.CheckP.X
jsr BS.ToAUX
bcs .99
bit GP.ParamT
bmi .5
*--------------------------------------
* Format BLK dev
*--------------------------------------
lda #10
sta ZP.BUFPTR+1 fake Buffer for status & format
stz ZP.BUFPTR
lda GP.FoundBITS+1
and #CMDBITS1.B
bne .1
jsr .2 A = cmd = 0 = status
bcs .19
stx GP.ParamB
sty GP.ParamB+1
stz GP.ParamB+2
.1 lda #3 cmd = 3 = format
jsr .2
bcc BS.KW.FORMAT.CAT
.19 lda #BS.E.IO
rts
.2 sta ZP.CMD
lda BS.WBlock.P.NUM unitnum : DSSS0000
sta ZP.UNITNUM
lsr
lsr
lsr
tax 000DSSS0
jmp (MLI.DEVPTRS,x)
*--------------------------------------
* Format Disk II
*--------------------------------------
.5 stz GP.ParamB+1 Total Block Count
ldx #3
bit GP.ParamV
bpl .6
inx 2 heads....
.6 lda GP.ParamE
.7 asl
rol GP.ParamB+1
dex
bne .7
sta GP.ParamB
ldx #BSX.FMT.D2.X
jsr BS.ToAUX
bcs .99
bra BS.KW.FORMAT.CAT
.99 rts
*--------------------------------------
BS.KW.FORMAT.CAT
lda #2 512 bytes buffers
jsr BS.GETBUFR
bcs .99
sta BS.WBlock.P.PTR+1
ldx GP.ParamV
bne .10
lda #0 BB.ProDOS
ldx #BSX.FMT.GetCatBlk.X
jsr BS.ToAUX
jsr BS.WBlock
bcs .9
ldx #BSX.FMT.GetCatBlk.X
lda #1 BB.SOS
jsr BS.ToAUX
jsr BS.WBlock
bcs .9
bra .11
.10 ldx #BSX.FMT.GetCatBlk.X
lda #2 BB.FX 1/2
jsr BS.ToAUX
jsr BS.WBlock
bcs .9
ldx #BSX.FMT.GetCatBlk.X
lda #3 BB.FX 2/2
jsr BS.ToAUX
jsr BS.WBlock
bcs .9
.11 ldx #BSX.FMT.GetCatBlk.X
lda #4 Ist CAT block
jsr BS.ToAUX
jsr BS.WBlock
bcs .9
.1 ldx #BSX.FMT.GetCatBlk.X
lda #5 Next CAT block
jsr BS.ToAUX
bcs .2
jsr BS.WBlock
bcs .9
bra .1
.2 ldx #BSX.FMT.GetCatBlk.X
lda #6 BM blocks
jsr BS.ToAUX
bcs .3
jsr BS.WBlock
bcs .9
bra .2
.3
clc
.9 php
jsr BS.FREEBUFR
lda #BS.E.IO
plp
.99 rts
*--------------------------------------
BS.WBlock jsr MLI
.DA #MLI.C.WRITEBLOCK
.DA BS.WBlock.P
bcs .9
inc BS.WBlock.P.BLK
rts
.9 lda #BS.E.IO
rts
*--------------------------------------
BS.WBlock.P .DA #3
BS.WBlock.P.NUM .BS 1
BS.WBlock.P.PTR .BS 2
BS.WBlock.P.BLK .BS 2
*--------------------------------------
2022-03-27 12:59:32 +00:00
BS.Expand2.P .DA #1
.DA MLI.PATHBUF
*--------------------------------------
BS.Expand2PATHBUF
2022-03-27 12:59:32 +00:00
stz MLI.PATHBUF reset target path
lda BS.CMDBUF
cmp #'/' new path is absolute ?
beq .1
jsr MLI no, get current path as a base
.DA #MLI.C.GETPREFIX
.DA BS.Expand2.P
2022-03-27 12:59:32 +00:00
.1 ldx #BSX.Expand.X
*--------------------------------------
BS.ToAUX stx .1+1
2022-03-27 12:59:32 +00:00
sei
2022-04-03 21:25:00 +00:00
2022-03-27 12:59:32 +00:00
tsx
sta IO.SETALTZP
stx $100
ldx $101
txs
2022-03-27 12:59:32 +00:00
bit IO.RRAMWRAMBNK1
bit IO.RRAMWRAMBNK1
2022-03-27 12:59:32 +00:00
cli
2022-03-27 12:59:32 +00:00
.1 ldx #$FF SELF MODIFIED
jsr BSX.JMPX
2022-04-03 21:25:00 +00:00
2022-03-27 12:59:32 +00:00
stx .3+1
php
plx
stx .2+1
2022-04-03 21:25:00 +00:00
2022-03-27 12:59:32 +00:00
sei
2022-04-03 21:25:00 +00:00
2022-03-27 12:59:32 +00:00
tsx
stx $101
ldx $100
txs
sta IO.CLRALTZP
2022-04-03 21:25:00 +00:00
2022-03-27 12:59:32 +00:00
bit IO.RROMBNK1
2022-04-03 21:25:00 +00:00
2022-03-27 12:59:32 +00:00
cli
2022-04-03 21:25:00 +00:00
2022-03-27 12:59:32 +00:00
.2 ldx #$FF SELF MODIFIED
phx
.3 ldx #$FF SELF MODIFIED
plp
rts
*--------------------------------------
2022-04-03 11:55:03 +00:00
BS.ToAUXSaveX .BS 1
2022-03-13 12:52:24 +00:00
*--------------------------------------
BS.GetFTableIdx lda GP.MLIRW.REFNUM
lsr
ror
ror
ror
tax
rts
*--------------------------------------
2022-04-03 21:25:00 +00:00
BS.SetSBUFADRCMDBUF
ldx #BS.CMDBUF
ldy /BS.CMDBUF
2022-03-13 12:52:24 +00:00
BS.SetSBUFADRXY0
stz GP.SBUFADR+2
2022-03-15 19:33:19 +00:00
2022-03-13 12:52:24 +00:00
BS.SetSBUFADRXY stx GP.SBUFADR
sty GP.SBUFADR+1
rts
*--------------------------------------
BS.ZeroSBUFADR lda #0
sta GP.SBUFADR
sta GP.SBUFADR+1
sta GP.SBUFADR+2
rts
*--------------------------------------
MAN
SAVE usr/src/basic.fx/basic.s.c
LOAD usr/src/basic.fx/basic.s
ASM