A2osX/ProDOS.FX/ProDOS.S.XDOS.A.txt

1099 lines
27 KiB
Plaintext
Raw Normal View History

2019-10-16 06:09:13 +00:00
NEW
AUTO 3,1
*--------------------------------------
2023-11-04 14:42:28 +00:00
FCB.MAX .EQ 8
FCB.ID .EQ 0
FCB.DEVID .EQ 1 d_dev -> d_dev+5
FCB.DIRHBLK .EQ 2 2 bytes
FCB.DIREBLK .EQ 4 2 bytes
FCB.DIRENUM .EQ 6
FCB.STYPE .EQ 7
FCB.F .EQ 8
FCB.F.STMOD .EQ %00001000
FCB.F.UMOD .EQ %00010000
FCB.F.DBLKMOD .EQ %01000000
FCB.F.IBLKMOD .EQ %10000000
FCB.ACCESS .EQ 9
FCB.NLBYTE .EQ 10
FCB.BUFID .EQ 11
FCB.1stBLK .EQ 12 2 bytes
FCB.IBLK .EQ 14 2 bytes
FCB.DBLK .EQ 16 2 bytes
FCB.MARK .EQ 18 3 bytes
FCB.EOF .EQ 21 3 bytes
FCB.UBLK .EQ 24 2 bytes
FCB.FLEVEL .EQ 27
FCB.DIRTY .EQ 28
FCB.NLMASK .EQ 31
*
FCB .EQ 32
*--------------------------------------
VCB.DEV .EQ 16
VCB.OFCNT .EQ 17
VCB.BMAP .EQ 18 2 bytes
VCB.TBLK .EQ 20 2 bytes
VCB.FBLK .EQ 22 2 bytes
VCB.BMAPIDX .EQ 24
*
VCB .EQ 25
*--------------------------------------
XDOS.VCBPtr .EQ XDOS.VCBs+0
XDOS.VCBDupFlag .EQ XDOS.VCBs+1
XDOS.VCBDupEnt .EQ XDOS.VCBs+2
bmcnt .EQ XDOS.VCBs+3
bmptr .EQ XDOS.VCBs+4
basval .EQ XDOS.VCBs+5
XDOS.VCB0 .EQ XDOS.VCBs+6 range $D906-$DA00
*--------------------------------------
* ZERO Page
*--------------------------------------
zpt .EQ $48 highly used zero page index pointer
datptr .EQ $4A ptr to data area of buffer.
sos .EQ $4C sos buffer pointer.
usrbuf .EQ $4E data ptr in user buffer.
*--------------------------------------
XDOS.START .PH XDOS
.DO AUXLC=0
XDOS.MAIN cld no decimal.
sty GP.MLIY save x and y
stx GP.MLIX
2020-05-28 21:13:52 +00:00
ply get processor status
2023-11-04 14:42:28 +00:00
2019-10-16 06:09:13 +00:00
pla find out the address of the caller
2023-11-04 14:42:28 +00:00
sta ZP.A3L
2019-10-16 06:09:13 +00:00
clc preserve the address of the call spec.
adc #$04
2023-11-04 14:42:28 +00:00
sta GP.MLIRTN last MLI call return address
2019-10-16 06:09:13 +00:00
pla
2023-11-04 14:42:28 +00:00
sta ZP.A3L+1
2019-10-16 06:09:13 +00:00
adc #$00
2023-11-04 14:42:28 +00:00
sta GP.MLIRTN+1
2020-05-25 13:58:59 +00:00
2020-05-28 21:13:52 +00:00
phy pull processor status
2023-11-04 14:42:28 +00:00
.ELSE
XDOS.AUX cld
bit IO.RRAMWRAMBNK1
sty GP.BNKBYT2
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
stx GP.MLIEXIT.X+1
tsx
stx $100
ldx $101
txs
sec
ror GP.MLIACTV
pha
lda GP.MLIEXIT.PCL+1
sta ZP.A3L
clc
adc #$04
sta GP.MLIEXIT.PCL+1
lda GP.MLIEXIT.PCH+1
sta ZP.A3L+1
adc #$00
sta GP.MLIEXIT.PCH+1
.FIN
*--------------------------------------
plp to re-enable interrupts.
2019-10-16 06:09:13 +00:00
cld still no decimal
2023-11-04 14:42:28 +00:00
stz GP.ERROR clear any previous errors.
2019-10-16 06:09:13 +00:00
ldy #$01 find out if command is valid.
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y get command #
2019-12-09 15:53:14 +00:00
2019-10-16 06:09:13 +00:00
lsr and hash it to a range of 0-$1F
lsr
lsr
lsr
clc
2023-11-04 14:42:28 +00:00
adc (ZP.A3L),y
2019-10-16 06:09:13 +00:00
and #$1F
tax
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y check result to see if valid command #
2019-11-28 22:06:22 +00:00
cmp XDOS.CmdNums,x
2023-11-04 14:42:28 +00:00
bne XDOS.BadCall
2019-10-16 06:09:13 +00:00
iny index to call spec parm list.
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y make A3L point to parameter count byte
2019-10-16 06:09:13 +00:00
pha in parameter block.
iny
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y
sta ZP.A3L+1
2019-10-16 06:09:13 +00:00
pla
2023-11-04 14:42:28 +00:00
sta ZP.A3L
2020-11-19 15:34:02 +00:00
2019-11-28 22:06:22 +00:00
lda XDOS.ParamCnt,x make sure parameter list has the correct # of parameters.
2023-11-04 14:42:28 +00:00
beq .2 clock has 0 parameters.
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
cmp (ZP.A3L)
bne XDOS.BadCnt error if wrong count.
2019-10-16 06:09:13 +00:00
2019-11-28 22:06:22 +00:00
lda XDOS.CmdNums,x get call # again
2023-11-04 14:42:28 +00:00
cmp #MLI.QUIT is it quit?
beq .1 if so, then call quit dispatcher
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
asl carry set if BFMgr or DevMgr
bpl .3
bcs .4
2019-10-16 06:09:13 +00:00
lsr shift back down for interrupt manager
and #$03 valid calls are 0 and 1
2023-11-04 14:42:28 +00:00
jsr XDOS.IntMgr
bra XDOS.Exit
2019-10-22 06:23:40 +00:00
2023-11-04 14:42:28 +00:00
.1 jmp GP.DISPATCH P8 system death vector
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
.2 jsr GP.CLOCK go read clock.
bra XDOS.Exit no errors possible
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
.3 lsr shift back down for device manager.
2019-10-16 06:09:13 +00:00
adc #$01 valid commands are 1 and 2.
2023-11-04 14:42:28 +00:00
sta ZP.CMDNUM
jsr XDOS.DevMgr execute read or write request.
bra XDOS.Exit
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
.4 lsr shift back down for block file manager.
2019-10-16 06:09:13 +00:00
and #$1F valid commands are 0-$13
tax
2023-11-04 14:42:28 +00:00
jsr XDOS.BFMgr
*--------------------------------------
XDOS.Exit stz GP.BUBIT clear backup bit
ldy GP.ERROR P8 error code
cpy #$01 if > 0 then set C
tya and set Z
2019-10-16 06:09:13 +00:00
php disable interrupts until exit complete.
sei
2023-11-04 14:42:28 +00:00
lsr GP.MLIACTV indicate MLI done.
ply Get status register until return.
* Y = Status register
* A = MLI Error code
.DO AUXLC=0
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
ldx GP.MLIRTN+1 place last MLI call return address
phx on stack. return is done via 'rti'
ldx GP.MLIRTN so the status register is restored
phx at the same time, so
phy place status back on stack
pha Push return error, if any.
ldx GP.MLIX MLI X register savearea
ldy GP.MLIY MLI Y register savearea
lda GP.BNKBYT1 restore language card status
jmp GP.MLIEXIT and return.
.ELSE
tsx
stx $101
ldx $100
txs
jmp GP.MLIEXITX
2019-10-22 06:23:40 +00:00
2023-11-04 14:42:28 +00:00
.FIN
*--------------------------------------
XDOS.NoDevice lda #MLI.E.NODEV no device connected.
jsr GP.SYSERR
XDOS.BadCall lda #MLI.E.BADCALL
2019-10-16 06:09:13 +00:00
.HS 2C BIT ABS
2023-11-04 14:42:28 +00:00
XDOS.BadCnt lda #MLI.E.BADCNT
jsr XDOS.GoSysErr
bra XDOS.Exit
2019-10-16 06:09:13 +00:00
*--------------------------------------
* ProDOS Device Manager
*--------------------------------------
2023-11-04 14:42:28 +00:00
XDOS.DevMgr ldy #$05 the call spec for devices must
2019-11-23 15:24:55 +00:00
2023-11-04 14:42:28 +00:00
.1 lda (ZP.A3L),y be passed to drivers in page zero:
sta ZP.CMDNUM,y
2019-10-16 06:09:13 +00:00
dey
bne .1
2023-11-04 14:42:28 +00:00
ldx ZP.BUFPTR+1 buffer page
2019-10-16 06:09:13 +00:00
stx usrbuf+1 to user buffer
inx
inx
2023-11-04 14:42:28 +00:00
lda ZP.BUFPTR is buffer page aligned (nn00) ?
2019-10-16 06:09:13 +00:00
beq .2 branch if it is
2020-09-17 05:43:06 +00:00
2019-10-16 06:09:13 +00:00
inx else account for 3-page straddle
.2 jsr vldbuf1 make sure user buffer is not
2023-11-04 14:42:28 +00:00
bcs XDOS.GoSysErr conflicting with protected ram.
2020-04-23 06:02:25 +00:00
2020-09-17 15:29:41 +00:00
jsr XDOS.DevCall call internal entry for device dispatch
bcc XDOS.DevCall.RTS
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
XDOS.GoSysErr jsr GP.SYSERR
2019-10-16 06:09:13 +00:00
*--------------------------------------
2020-09-17 15:29:41 +00:00
XDOS.DevCall php do not allow interrupts.
2023-11-04 14:42:28 +00:00
sei
2020-09-17 15:29:41 +00:00
2023-11-04 14:42:28 +00:00
lda ZP.UNITNUM get device # and
2019-10-16 06:09:13 +00:00
and #$F0 strip misc lower nibble
2023-11-04 14:42:28 +00:00
sta ZP.UNITNUM then save it.
2019-10-16 06:09:13 +00:00
lsr use as index to device table
lsr
lsr
tax
2020-09-17 15:29:41 +00:00
jsr XDOS.DevCall.Jmp
2023-11-04 14:42:28 +00:00
bit IO.CLRC8ROM RELEASE $C800-$CFFF ROM space
2020-09-17 15:29:41 +00:00
bcs .9
2023-11-04 14:42:28 +00:00
2020-09-17 15:29:41 +00:00
plp
clc
rts
2023-11-04 14:42:28 +00:00
.9 plp
2020-09-17 15:29:41 +00:00
sec
XDOS.DevCall.RTS
rts
2023-11-04 14:42:28 +00:00
2020-09-17 15:29:41 +00:00
XDOS.DevCall.Jmp
2023-11-04 14:42:28 +00:00
jmp (GP.DEVPTRS,x) goto driver (or error if no driver)
2019-10-16 06:09:13 +00:00
*--------------------------------------
* ProDOS interrupt manager
*--------------------------------------
2023-11-04 14:42:28 +00:00
XDOS.IntMgr sta ZP.A4L interrupt command
2019-10-16 06:09:13 +00:00
lsr allocate interrupt or deallocate?
2023-11-04 14:42:28 +00:00
bcs .4 branch if deallocate.
2019-10-16 06:09:13 +00:00
ldx #$03 test for a free interrupt space in tbl.
.1 lda GP.IRQVs-2,x test high address for 0.
2019-10-16 06:09:13 +00:00
bne .2 branch if spot occupied.
ldy #$03 get address of routine.
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y must not be zero page.
beq .3 error if it is.
2021-06-11 17:20:35 +00:00
sta GP.IRQVs-2,x save high address
2019-10-16 06:09:13 +00:00
dey
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y
sta GP.IRQVs-3,x and low address.
2019-10-16 06:09:13 +00:00
txa return interrupt # in range 1-4
lsr
dey
2023-11-04 14:42:28 +00:00
sta (ZP.A3L),y pass back to user.
2019-10-16 06:09:13 +00:00
clc no errors.
rts
.2 inx
inx next lower priority spot
cpx #$0B are all 4 already allocated?
bne .1 branch if not.
lda #MLI.E.IRQFULL interrupt table full
.HS 2C BIT ABS
2023-11-04 14:42:28 +00:00
.3 lda #MLI.E.INVPARAM invalid parameter.
jsr GP.SYSERR
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
.4 ldy #$01 zero out interrupt vector
lda (ZP.A3L),y but make sure it is a valid #.
beq .3 error if < 1
2019-10-16 06:09:13 +00:00
cmp #$05 or > 4
2023-11-04 14:42:28 +00:00
bcs .3
2019-10-16 06:09:13 +00:00
asl
tax
2023-11-04 14:42:28 +00:00
stz GP.IRQVs-2,x
stz GP.IRQVs-1,x
2023-11-04 14:42:28 +00:00
* clc
2019-10-16 06:09:13 +00:00
rts
*--------------------------------------
2023-11-04 14:42:28 +00:00
XDOS.SysErr sta GP.ERROR P8 error code
2019-10-16 06:09:13 +00:00
plx
plx pop 1 level of return
sec
rts
2019-11-10 18:28:06 +00:00
*--------------------------------------
2023-11-04 14:42:28 +00:00
* $01 = more than 255 unclaimed irqs
* $0A = open file has no volume
* $0B = open file has no 1K buffer
* $0C = block allocation error.
*--------------------------------------
2020-09-19 16:48:28 +00:00
XDOS.SysDeath tax death error code.
2023-11-04 14:42:28 +00:00
sta IO.CLR80DISP disable 80 col hardware.
lda IO.SETTEXT switch in text.
lda XDOS.CortFlag is this a Cortland?
2019-11-11 14:21:06 +00:00
beq .1 if not, don't use super hires switch.
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
stz IO.GS.NEWVIDEO force off super hires.
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
.1 lda IO.CLRPAGE2 switch in text page 1.
2019-10-16 06:09:13 +00:00
2019-11-11 14:21:06 +00:00
ldy #deathmsg.LEN-1
.2 lda deathmsg,y
sta $400,y 'RESTART SYSTEM-$'
2019-10-16 06:09:13 +00:00
dey
2019-11-11 14:21:06 +00:00
bpl .2
2019-10-16 06:09:13 +00:00
txa x = death error code
and #$0F convert to ascii
2019-11-11 14:21:06 +00:00
ora #$30
cmp #$3A
bcc .3 branch if not > 9.
2019-10-16 06:09:13 +00:00
adc #$06 inc to alpha a-f
2019-11-11 14:21:06 +00:00
.3 ldy #deathmsg.LEN
2020-09-18 15:06:12 +00:00
ora #$80
2019-11-11 14:21:06 +00:00
sta $400,y
2023-11-04 14:42:28 +00:00
2020-09-18 15:06:12 +00:00
lda #" "
2023-11-04 14:42:28 +00:00
2019-11-11 14:21:06 +00:00
.4 iny
sta $400,y
cpy #39
bne .4
bra *
2019-10-16 06:09:13 +00:00
*--------------------------------------
* ProDOS Block File Manager
*--------------------------------------
2023-11-04 14:42:28 +00:00
XDOS.BFMgr lda XDOS.CmdFlags,x translate into command address.
2019-10-16 06:09:13 +00:00
asl bit 7 indicates pathname to process
sta cmdtemp
and #$3F bit 6 is refnum, 5 is time to process
tax
lda cmdtable,x move address to indirect jump
sta H3274+1
lda cmdtable+1,x high byte
sta H3274+2
2020-05-25 13:58:59 +00:00
2019-10-16 06:09:13 +00:00
lda #$20 init backup bit flag
sta bkbitflg to say 'file modified'
bcc nopath
2019-11-11 14:21:06 +00:00
jsr XDOS.GetPath process pathname before calling command
2019-10-16 06:09:13 +00:00
bcs errorsys branch if bad name.
nopath asl cmdtemp test for refnum processing
bcc nopreref
2020-09-18 15:06:12 +00:00
jsr XDOS.GetFCB set pointers to fcb and vcb of file
2019-10-16 06:09:13 +00:00
bcs errorsys
nopreref asl cmdtemp check for necessity of time stamp
2023-11-04 14:42:28 +00:00
bcc H3274
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
jsr GP.CLOCK date/time
2020-05-25 13:58:59 +00:00
2019-10-16 06:09:13 +00:00
H3274 jsr $FFFF SELF MODIFIED : execute command
bcc goodop
2023-11-04 14:42:28 +00:00
errorsys jsr GP.SYSERR
2019-10-16 06:09:13 +00:00
goodop rts
2019-11-10 18:28:06 +00:00
*--------------------------------------
2019-11-11 14:21:06 +00:00
* entry used by rename for 2nd pathname.
*--------------------------------------
XDOS.GetRenPath ldy #$03 get address to new pathname
.HS 2C
*--------------------------------------
XDOS.GetPath ldy #$01 index to pathname pointer
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y low pointer address
2019-10-16 06:09:13 +00:00
sta zpt
2019-11-11 14:21:06 +00:00
2019-10-16 06:09:13 +00:00
iny
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y hi pointer address
2019-10-16 06:09:13 +00:00
sta zpt+1
2023-11-04 14:42:28 +00:00
ldx #$00 x = index to XDOS.PathBuf
2019-10-16 06:09:13 +00:00
ldy #$00 y = index to input pathname.
2019-11-10 18:28:06 +00:00
stz prfxflg assume prefix is in use.
2023-11-04 14:42:28 +00:00
stz XDOS.PathBuf mark XDOS.PathBuf = nothing processed.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
lda (zpt),y validate pathname length > 0 and < 65
beq errsyn
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
cmp #$41
bcs errsyn
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
sta pathcnt this is used to compare for
inc pathcnt end of pathname processing.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
iny now check for full pathname...
lda (zpt),y (full name if starts with '/')
2019-11-10 18:28:06 +00:00
and #$7F
cmp #'/'
2019-10-16 06:09:13 +00:00
bne H32AD branch if prefix appended.
2019-11-10 18:28:06 +00:00
dec prfxflg set prefix flag = prefix not used.
2019-10-16 06:09:13 +00:00
iny index to 1st character of pathname.
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
H32AD lda #$FF set current position of XDOS.PathBuf
sta XDOS.PathBuf,x to indicate end of pathname.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
sta namcnt $FF = no chars processed in local name.
stx namptr pointer to local name length byte.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
H32B8 cpy pathcnt done with pathname processing?
bcs endpath
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
lda (zpt),y get character
and #$7F
inx prepare for next char
iny
2019-11-10 18:28:06 +00:00
cmp #'/' is it delimiter '/' ?
2019-10-16 06:09:13 +00:00
beq endname yes
2019-11-10 18:28:06 +00:00
.DO LOWERCASE=0
cmp #'a' lowercase?
bcc .1 no
2023-11-04 14:42:28 +00:00
cmp #'z'+1
bcs .1
eor #$20 to uppercase
2019-11-10 18:28:06 +00:00
.1 .FIN
2023-11-04 14:42:28 +00:00
sta XDOS.PathBuf,x store char
2019-10-16 06:09:13 +00:00
inc namcnt is it the 1st char of a local name?
2019-11-10 18:28:06 +00:00
bne .2 no
2023-11-04 14:42:28 +00:00
2019-10-16 06:09:13 +00:00
inc namcnt increment to 1
2019-11-10 18:28:06 +00:00
jsr XDOS.IsValidFirstChar
bcc H32B8
bra errsyn
2023-11-04 14:42:28 +00:00
2019-11-10 18:28:06 +00:00
.2 jsr XDOS.IsValidChar
bcc H32B8
errsyn lda #MLI.E.INVPATH
2023-11-04 14:42:28 +00:00
.HS 2C
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
ptyperr lda #MLI.E.UNSUPST filetype error (not a directory)
pfxerr sec
rts
2019-10-16 06:09:13 +00:00
endpath lda #$00 end pathname with a 0
bit namcnt also make sure count is positive
bpl H32FD
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
sta namcnt
dex
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
H32FD inx
2023-11-04 14:42:28 +00:00
sta XDOS.PathBuf,x
2019-10-16 06:09:13 +00:00
beq errsyn error if '/' only.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
stx pathcnt save length of pathname
tax
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
endname lda namcnt validate local name < 16
2019-11-10 18:28:06 +00:00
cmp #16
2019-10-16 06:09:13 +00:00
bcs errsyn
2019-11-10 18:28:06 +00:00
phx save pointer
2019-10-16 06:09:13 +00:00
ldx namptr get index to beginning of local name
2023-11-04 14:42:28 +00:00
sta XDOS.PathBuf,x save local name's length
2019-10-16 06:09:13 +00:00
plx restore pointer
bne H32AD branch if more names to process
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
clc probably no error, but
lda prfxflg make sure all pathnames are prefixed
bne H3323 or begin with a '/'.
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
lda GP.NEWPFXPTR must be non-zero
2019-10-16 06:09:13 +00:00
beq errsyn
H3323 rts
2019-11-10 18:28:06 +00:00
*--------------------------------------
2019-11-11 14:21:06 +00:00
XDOS.SetPrefix jsr XDOS.GetPath call is made to detect if a null path.
2019-10-16 06:09:13 +00:00
bcc H3333 path ok.
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
ldy XDOS.PathBuf is it a null pathname?
2019-10-16 06:09:13 +00:00
bne pfxerr error if not
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
sty GP.NEWPFXPTR fix appletalk PFI bug
sty GP.PFXPTR
2019-10-16 06:09:13 +00:00
clc no error
rts
2019-11-10 18:28:06 +00:00
2020-07-18 14:04:21 +00:00
H3333 jsr XDOS.FindFileOrVol go find specified prefix directory.
2023-11-04 14:42:28 +00:00
pfxerr1 bcs pfxerr branch if error is not root directory.
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
lda d_stor make sure last local name is dir type
2019-10-16 06:09:13 +00:00
and #$D0 (either root or sub).
eor #$D0 directory?
bne ptyperr wrong type
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
ldy prfxflg new or appended prefix?
bne H334D
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
lda GP.NEWPFXPTR append new prefix to old
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
H334D tay
sec find new beginning of prefix
sbc pathcnt
cmp #$C0 too long?
bcc errsyn then error
tax
2023-11-04 14:42:28 +00:00
sta GP.NEWPFXPTR
sta GP.PFXPTR
2019-10-16 06:09:13 +00:00
lda d_dev save device #
sta p_dev
lda d_frst and address of 1st block
sta p_blok
lda d_frst+1
sta p_blok+1
2023-11-04 14:42:28 +00:00
.1 lda XDOS.PathBuf,y
sta XDOS.PathBuf,x
2019-10-16 06:09:13 +00:00
iny
inx
2019-11-23 15:24:55 +00:00
bne .1
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
clc good prefix
rts
2019-11-10 18:28:06 +00:00
*--------------------------------------
XDOS.GetPrefix clc calc how big a buffer is needed.
2019-10-16 06:09:13 +00:00
ldy #$01 get index to users pathname buffer
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y
2019-10-16 06:09:13 +00:00
sta usrbuf user buffer ptr
iny
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y
2019-10-16 06:09:13 +00:00
sta usrbuf+1
2019-11-23 15:24:55 +00:00
2019-10-16 06:09:13 +00:00
stz cbytes+1 set buffer length at 64 char max
lda #$40
sta cbytes
2019-11-23 15:24:55 +00:00
2019-10-16 06:09:13 +00:00
jsr valdbuf go validate prefix buffer address
2023-11-04 14:42:28 +00:00
bcs pfxerr1
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
ldy #$00 y = indirect index to user buffer.
2023-11-04 14:42:28 +00:00
lda GP.NEWPFXPTR get address of beginning of prefix
2019-10-16 06:09:13 +00:00
tax
beq nulprfx if null prefix.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
eor #$FF get total length of prefix
adc #$02 add 2 for leading and trailing slashes.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
nulprfx sta (usrbuf),y store length in user's buffer.
beq gotprfx branch if null prefix.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
sendprfx iny inc to next user buffer location.
2023-11-04 14:42:28 +00:00
lda XDOS.PathBuf,x get next char of prefix.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
sndlimit sta (usrbuf),y give char to user.
and #$F0 check for length descriptor.
bne H33B3 branch if regular character
2019-11-23 15:24:55 +00:00
lda #'/' otherwise, substitute a slash.
2019-10-16 06:09:13 +00:00
bne sndlimit branch always
H33B3 inx
bne sendprfx branch if more to send.
iny
2019-11-23 15:24:55 +00:00
lda #'/' end with '/'
2019-10-16 06:09:13 +00:00
sta (usrbuf),y
gotprfx clc no error
rts
2019-11-23 15:24:55 +00:00
*--------------------------------------
2020-09-18 15:06:12 +00:00
XDOS.GetFCB ldy #$01 index to ref#
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y is it a valid file# ?
2019-10-16 06:09:13 +00:00
beq badref must not be 0.
2019-11-10 18:28:06 +00:00
2020-09-18 15:06:12 +00:00
cmp #FCB.MAX+1
2019-10-16 06:09:13 +00:00
bcs badref
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
pha
2023-11-04 14:42:28 +00:00
dec
2019-10-16 06:09:13 +00:00
lsr
ror
ror
ror multiply by 32.
sta fcbptr used as an index to fcb
2020-09-18 15:06:12 +00:00
tax
2019-10-16 06:09:13 +00:00
pla restore ref# in acc
2023-11-04 14:42:28 +00:00
cmp XDOS.FCBs+FCB.ID,x
2019-10-16 06:09:13 +00:00
bne errnoref
2020-09-18 15:06:12 +00:00
*--------------------------------------
2023-11-04 14:42:28 +00:00
XDOS.GetFCBBufX lda XDOS.FCBs+FCB.BUFID,x get page address of file buffer.
2020-09-18 15:06:12 +00:00
tay index into global buffer table.
2023-11-04 14:42:28 +00:00
lda GB.BUFTABL-1,y
2020-09-18 15:06:12 +00:00
sta bufaddrh
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
beq fcbdead fcb corrupted
2020-05-28 21:13:52 +00:00
2020-09-18 15:06:12 +00:00
sta datptr+1 save ptr to data area of buffer
inc
inc index block always 2 pages after data
sta zpt+1
2020-08-28 15:11:27 +00:00
2023-11-04 14:42:28 +00:00
lda GB.BUFTABL-2,y ???? ALWAYS 0
2020-09-18 15:06:12 +00:00
sta bufaddrl
2019-10-16 06:09:13 +00:00
sta datptr index and data buffers always on
sta zpt page boundaries.
2019-11-10 18:28:06 +00:00
2020-09-19 16:48:28 +00:00
jsr XDOS.FCBDevIDSelect
2020-09-18 15:06:12 +00:00
2023-11-04 14:42:28 +00:00
lda #XDOS.VCB0
2020-08-28 15:11:27 +00:00
2020-09-18 15:06:12 +00:00
fndfvol tay search for associated vcb
2023-11-04 14:42:28 +00:00
lda XDOS.VCBs+VCB.DEV,y
cmp XDOS.FCBs+FCB.DEVID,x is this vcb the same device?
2019-10-16 06:09:13 +00:00
beq tstvopen if it is, make sure volume is active.
2019-11-10 18:28:06 +00:00
2020-09-18 15:06:12 +00:00
nxtfvol tya adjust index to next vcb.
2019-10-16 06:09:13 +00:00
clc
2020-07-17 06:04:08 +00:00
adc #VCB
2019-10-16 06:09:13 +00:00
bcc fndfvol loop until volume found.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
lda #$0A open file has no volume so
2019-11-10 18:28:06 +00:00
.HS 2C BIT ABS
2019-10-16 06:09:13 +00:00
fcbdead lda #$0B fcb error so
2020-09-18 15:06:12 +00:00
2023-11-04 14:42:28 +00:00
jsr GP.SYSDEATH kill the system.
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
tstvopen lda XDOS.VCBs,y make sure this vcb is open.
2019-10-16 06:09:13 +00:00
beq nxtfvol branch if it is not active.
2020-09-18 15:06:12 +00:00
2023-11-04 14:42:28 +00:00
sty XDOS.VCBPtr save ptr to good vcb.
2019-10-16 06:09:13 +00:00
clc no error
2023-11-04 14:42:28 +00:00
rts Y = XDOS.VCBPtr, X = FCBPtr
2019-10-16 06:09:13 +00:00
2023-11-04 14:42:28 +00:00
errnoref stz XDOS.FCBs,x
2019-10-16 06:09:13 +00:00
badref lda #MLI.E.BADREF requested refnum is
sec illegal (out of range)
rts
2019-11-10 18:28:06 +00:00
*--------------------------------------
XDOS.Online jsr mvdbufr figure out how big buffer has to be.
2019-10-16 06:09:13 +00:00
stz cbytes set this for valdbuf routine.
stz cbytes+1
ldy #$01
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y if 0 then cbytes=$100 else $010 for one
2019-10-16 06:09:13 +00:00
and #$F0 device. mask out unused nibble.
2023-11-04 14:42:28 +00:00
sta GP.DEVNUM last device used.
beq .1 branch if all devices.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
lda #$10 cbytes = $010
sta cbytes
bne .2 always taken
2019-11-10 18:28:06 +00:00
.1 inc cbytes+1 cbytes = $100
2019-11-10 18:28:06 +00:00
.2 jsr valdbuf go validate buffer range against
bcs .9 allocated memory.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
lda #$00 zero out user buffer space
ldy cbytes
2019-11-10 18:28:06 +00:00
.3 dey
2019-10-16 06:09:13 +00:00
sta (usrbuf),y
bne .3
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
sta namptr used as pointer to user buffer.
2023-11-04 14:42:28 +00:00
lda GP.DEVNUM get device # again.
2019-10-16 06:09:13 +00:00
bne online1 branch if only 1 device to process.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
jsr mvdevnums get list of currently recognized dev's.
2019-11-10 18:28:06 +00:00
.4 phx save index to last item on list
2019-10-16 06:09:13 +00:00
lda loklst,x
2023-11-04 14:42:28 +00:00
sta GP.DEVNUM save desired device to look at.
2019-10-16 06:09:13 +00:00
jsr online1 log this volume and return it's name.
lda namptr inc pointer for next device
clc
adc #$10
sta namptr
plx get index to device list.
dex next device.
bpl .4 branch if there is another device.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
lda #$00 no errors for multiple on-line
clc
.9 rts
2019-11-10 18:28:06 +00:00
*--------------------------------------
2020-08-28 15:11:27 +00:00
online1 jsr XDOS.FindVCBForDevNum see if it has already been logged in.
bcs online1.ERR branch if vcb is full.
2019-11-10 18:28:06 +00:00
2019-10-16 06:09:13 +00:00
lda #$02
2020-08-27 15:34:55 +00:00
ldx #$00 read in root (volume) directory
2020-08-28 10:47:41 +00:00
jsr XDOS.ReadGBufAX read ROOT VOL into general purpose buffer.
bcc .1 branch if read was ok.
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
ldx XDOS.VCBPtr
ldy XDOS.VCBs+VCB.OFCNT,x don't take the vcb offline if
bne online1.ERR there are active files present.
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
stz XDOS.VCBs,x now take the volume offline
stz XDOS.VCBs+VCB.DEV,x
2019-11-26 16:35:49 +00:00
bra online1.ERR branch if unable to read.
2019-11-10 18:28:06 +00:00
.1 .DO LOWERCASE=1
2021-02-20 10:18:02 +00:00
jsr XDOS.CheckAndUnpackGBuf
bcs online1.ERR
2020-08-27 15:34:55 +00:00
.FIN
2020-08-28 15:11:27 +00:00
2023-11-04 14:42:28 +00:00
ldx XDOS.VCBPtr
lda XDOS.VCBs,x has it been logged in before?
beq .2 if not.
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
lda XDOS.VCBs+VCB.OFCNT,x it has, are there active files?
bne .3 branch if volume is currently busy.
2019-11-10 18:28:06 +00:00
.2 jsr XDOS.VCBMountAtX
bcs online1.ERR branch if there is a problem.
2019-11-10 18:28:06 +00:00
2019-11-26 16:35:49 +00:00
lda #MLI.E.DUPVOL anticipate a duplicate active volume
2023-11-04 14:42:28 +00:00
bit XDOS.VCBDupFlag exits.
bmi online1.ERR branch if so.
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
.3 ldx XDOS.VCBPtr
2020-09-17 05:43:06 +00:00
jsr XDOS.VCBCmpGBUF does vol read compare with logged vol?
2019-11-26 16:35:49 +00:00
lda #MLI.E.DSKSWIT anticipate wrong volume mounted.
bcc online1.OK branch if ok.
*--------------------------------------
online1.ERR pha save error code.
2019-10-16 06:09:13 +00:00
jsr svdevn report what device has problem.
pla error code.
iny tell what error was encountered.
sta (usrbuf),y
2019-11-26 16:35:49 +00:00
cmp #MLI.E.DUPVOL duplicate volume error?
bne .1 no.
2019-10-16 06:09:13 +00:00
iny report which other device has same name
2023-11-04 14:42:28 +00:00
ldx XDOS.VCBDupEnt
lda XDOS.VCBs+VCB.DEV,x
2019-10-16 06:09:13 +00:00
sta (usrbuf),y
2023-11-04 14:42:28 +00:00
stz XDOS.VCBDupFlag clear duplicate flag.
2019-11-26 16:35:49 +00:00
lda #MLI.E.DUPVOL duplicate volume error code.
2019-11-10 18:28:06 +00:00
.1 sec flag error
2019-10-16 06:09:13 +00:00
rts
*--------------------------------------
2023-11-04 14:42:28 +00:00
online1.OK lda XDOS.VCBs,x get volume name count
2019-10-16 06:09:13 +00:00
sta namcnt
ldy namptr index to user's buffer.
2023-11-04 14:42:28 +00:00
.1 lda XDOS.VCBs,x move name to user's buffer
2019-10-16 06:09:13 +00:00
sta (usrbuf),y
inx
iny
dec namcnt
bpl .1
2019-10-16 06:09:13 +00:00
svdevn ldy namptr index to 1st byte of this entry.
2023-11-04 14:42:28 +00:00
lda GP.DEVNUM upper nibble = device# and
2019-10-16 06:09:13 +00:00
ora (usrbuf),y lower nibble = name length.
sta (usrbuf),y
2023-11-04 14:42:28 +00:00
2019-10-16 06:09:13 +00:00
clc no errors
rts end of block file manager
*--------------------------------------
2021-04-08 20:30:18 +00:00
XDOS.Create jsr XDOS.CheckPath check for duplicate, get free entry
2019-11-10 18:28:06 +00:00
bcc duperr error code may be 'file not found'
tstfnf cmp #MLI.E.FNOTFND 'file not found' is ok
bne crerr1 otherwise exit with error.
ldy #$07 test for tree or directory file,
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y no other kinds are legal.
2019-11-10 18:28:06 +00:00
cmp #$04 is it seed, sapling or tree?
bcc tstdspc branch if it is
cmp #$0D
bne ctyperr report type error if not directory.
2023-11-04 14:42:28 +00:00
tstdspc lda GP.DEVNUM make sure destination device
2019-11-10 18:28:06 +00:00
jsr twrprot1 is not write protected.
bcs H351D
lda nofree is there space in directory to
beq xtndir add this file? branch if not
jmp creat1 otherwise, go create file.
xtndir lda own_blk before extending directory,
ora own_blk+1 make sure it's a subdirectory.
bne H352A
lda #MLI.E.DIRFULL otherwise, directory full error
.HS 2C BIT ABS
ctyperr lda #MLI.E.UNSUPST filetype error
.HS 2C BIT ABS
duperr lda #MLI.E.DUPFILE name already exists
crerr1 sec
H351D rts
2023-11-04 14:42:28 +00:00
H352A lda ZP.BLKNUM preserve disk address of current (last)
2019-11-10 18:28:06 +00:00
pha directory link, before allocating an
2023-11-04 14:42:28 +00:00
lda ZP.BLKNUM+1 extended block.
2019-11-10 18:28:06 +00:00
pha
jsr alc1blk allocate a block for extending directory
plx
2023-11-04 14:42:28 +00:00
stx ZP.BLKNUM+1 restore block addr of dir info in XDOS.GBuf
2019-11-10 18:28:06 +00:00
plx
2023-11-04 14:42:28 +00:00
stx ZP.BLKNUM
2019-11-10 18:28:06 +00:00
bcs H351D unable to allocate.
2023-11-04 14:42:28 +00:00
sta XDOS.GBuf+2 save block address in y,a to
sty XDOS.GBuf+3 current directory.
2020-08-28 06:23:27 +00:00
.DO LOWERCASE=1
jsr XDOS.WriteGBufDir
.ELSE
2020-05-28 21:13:52 +00:00
jsr XDOS.WriteGBuf update directory block with new link.
2020-08-28 06:23:27 +00:00
.FIN
2019-11-10 18:28:06 +00:00
bcs H351D if error
ldx #$01
2023-11-04 14:42:28 +00:00
swpbloks lda ZP.BLKNUM,x prepare new directory block
sta XDOS.GBuf,x using current block as back link
lda XDOS.GBuf+2,x
sta ZP.BLKNUM,x and save new block as next to be written
2019-11-10 18:28:06 +00:00
dex
bpl swpbloks
2020-09-17 15:29:41 +00:00
inx x = 0
2023-11-04 14:42:28 +00:00
clrdir stz XDOS.GBuf+2,x
stz XDOS.GBuf+$100,x
2019-11-10 18:28:06 +00:00
inx
bne clrdir
2020-08-27 15:34:55 +00:00
.DO LOWERCASE=1
jsr XDOS.WriteGBufDir
.ELSE
2020-05-28 21:13:52 +00:00
jsr XDOS.WriteGBuf write prepared directory extension.
2020-08-27 15:34:55 +00:00
.FIN
2019-11-10 18:28:06 +00:00
bcs H351D if error
lda own_blk
ldx own_blk+1
2020-09-17 15:29:41 +00:00
2020-08-27 15:34:55 +00:00
.DO LOWERCASE=1
jsr XDOS.ReadGBufAXDir
.ELSE
2020-05-28 21:13:52 +00:00
jsr XDOS.ReadGBufAX read in parent directory block
2020-08-27 15:34:55 +00:00
.FIN
2020-09-17 15:29:41 +00:00
jsr XDOS.ZPT.InitGBuf
2019-11-10 18:28:06 +00:00
ldx own_ent and calc entry address.
2020-05-28 21:13:52 +00:00
ocalc dex has entry address been calculated?
2019-11-10 18:28:06 +00:00
beq H3584 if yes.
2020-05-28 21:13:52 +00:00
lda own_len next entry address
jsr XDOS.ZPT.NextA
bra ocalc
2023-11-04 14:42:28 +00:00
H3584 ldy #$13 index to block count
clc
2019-11-10 18:28:06 +00:00
H3588 lda (zpt),y
adc dinctbl-$13,y add 1 to block count and
sta (zpt),y
iny
tya $200 to the directory's eof.
eor #$18 done with usage/eof update?
bne H3588 branch if not.
2020-08-27 15:34:55 +00:00
.DO LOWERCASE=1
jsr XDOS.WriteGBufDir
.ELSE
2020-07-16 14:53:35 +00:00
jsr XDOS.WriteGBuf go update parent.
2020-08-27 15:34:55 +00:00
.FIN
2019-11-10 18:28:06 +00:00
bcs crerr2
jmp XDOS.Create
crerr2 rts return and report errors
2019-11-11 14:21:06 +00:00
*--------------------------------------
2023-11-04 14:42:28 +00:00
creat1 ldx #$00 zero out XDOS.GBuf
2019-11-10 18:28:06 +00:00
2023-11-04 14:42:28 +00:00
H35A0 stz XDOS.GBuf,x
stz XDOS.GBuf+$100,x and data block of file.
2019-11-10 18:28:06 +00:00
inx
bne H35A0
ldy #$0B move user specified date/time
2023-11-04 14:42:28 +00:00
cmvtime lda (ZP.A3L),y to directory.
2019-11-10 18:28:06 +00:00
sta d_filid,y
txa if all 4 bytes of date/time = 0
2023-11-04 14:42:28 +00:00
ora (ZP.A3L),y then use built-in date/time.
2019-11-10 18:28:06 +00:00
tax
dey
cpy #$07
bne cmvtime
txa does user want default time?
bne cmvname if not.
ldx #$03
2023-11-04 14:42:28 +00:00
mvdftime lda GP.DATE,x move current default date/time
2019-11-10 18:28:06 +00:00
sta d_credt,x
dex
bpl mvdftime
2023-11-04 14:42:28 +00:00
cmvname lda (ZP.A3L),y y = index to file kind.
2019-11-10 18:28:06 +00:00
cmp #$04
lda #$10 assume tree type
bcc csvfkind
2020-05-28 21:13:52 +00:00
2019-11-10 18:28:06 +00:00
lda #$D0 it's directory.
csvfkind ldx namptr index to local name of pathname.
2023-11-04 14:42:28 +00:00
ora XDOS.PathBuf,x combine file kind with name length.
2019-11-10 18:28:06 +00:00
sta d_stor sos calls this 'storage type'.
and #$0F strip back to name length
tay and use as counter for move.
clc
adc namptr calc end of name
tax
2023-11-04 14:42:28 +00:00
crname lda XDOS.PathBuf,x move local name as filename
2019-11-10 18:28:06 +00:00
sta d_stor,y
dex
dey
bne crname
ldy #$03 index to 'access' parameter
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y
2019-11-10 18:28:06 +00:00
sta d_attr
iny also move 'file identification'
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y
2019-11-10 18:28:06 +00:00
sta d_filid
cmvauxid iny move auxillary identification bytes
2023-11-04 14:42:28 +00:00
lda (ZP.A3L),y
2019-11-10 18:28:06 +00:00
sta d_auxid-5,y
cpy #$06
bne cmvauxid
.DO LOWERCASE=0
lda xdosver save current xdos version #
sta d_sosver
lda compat and backward compatibility #
sta d_comp
.FIN
2023-11-04 14:42:28 +00:00
2019-11-10 18:28:06 +00:00
lda #$01 usage is always 1 block
sta d_usage
lda d_head place back pointer to header block
sta d_dhdr
lda d_head+1
sta d_dhdr+1
lda d_stor storage type.
and #$E0 is it a directory?
beq cralcblk branch if seed file.
2020-08-28 10:47:41 +00:00
* Create Dir First Block
2019-11-10 18:28:06 +00:00
ldx #$1E move header to data block
cmvheadr lda d_stor,x
2023-11-04 14:42:28 +00:00
sta XDOS.GBuf+4,x
2019-11-10 18:28:06 +00:00
dex
bpl cmvheadr
eor #$30
2023-11-04 14:42:28 +00:00
sta XDOS.GBuf+4 make it a directory header mark.
2019-11-10 18:28:06 +00:00
2019-11-23 15:24:55 +00:00
.DO LOWERCASE=0
2023-11-04 14:42:28 +00:00
2019-11-10 18:28:06 +00:00
ldx #$07 overwrite password area and other
cmvpass lda pass,x header info.
2023-11-04 14:42:28 +00:00
sta XDOS.GBuf+20,x
2019-11-10 18:28:06 +00:00
lda xdosver,x
2023-11-04 14:42:28 +00:00
sta XDOS.GBuf+32,x
2019-11-10 18:28:06 +00:00
dex
bpl cmvpass
2023-11-04 14:42:28 +00:00
2019-11-23 15:24:55 +00:00
.ELSE
2019-12-11 14:41:13 +00:00
lda #$75
2023-11-04 14:42:28 +00:00
sta XDOS.GBuf+20
2019-12-13 10:10:08 +00:00
ldx #XDOS.VolHdrDef.Cnt-1
2023-11-04 14:42:28 +00:00
2019-12-13 10:10:08 +00:00
.1 lda XDOS.VolHdrDef,x
2023-11-04 14:42:28 +00:00
sta XDOS.GBuf+34,x
2019-12-13 10:10:08 +00:00
dex
bpl .1
2023-11-04 14:42:28 +00:00
2019-11-23 15:24:55 +00:00
.FIN
2019-11-10 18:28:06 +00:00
ldx #$02 and include info about parent directory
2020-08-28 10:47:41 +00:00
stx d_eof+1 set file size = 512
2019-11-10 18:28:06 +00:00
cmvparnt lda d_entblk,x
2023-11-04 14:42:28 +00:00
sta XDOS.GBuf+39,x
2019-11-10 18:28:06 +00:00
dex
bpl cmvparnt
lda h_entln lastly, the length of parent's
2023-11-04 14:42:28 +00:00
sta XDOS.GBuf+42 directory entries.
2019-11-11 14:21:06 +00:00
2020-08-28 10:47:41 +00:00
.DO LOWERCASE=1
jsr XDOS.PackGBuf
.FIN
2019-11-10 18:28:06 +00:00
cralcblk jsr alc1blk get address of file's data block
bcs crerr3
2019-11-11 14:21:06 +00:00
2019-11-10 18:28:06 +00:00
sta d_frst
sty d_frst+1
2023-11-04 14:42:28 +00:00
sta ZP.BLKNUM
sty ZP.BLKNUM+1
2020-05-28 21:13:52 +00:00
jsr XDOS.WriteGBuf go write data block of file
2019-11-10 18:28:06 +00:00
bcs crerr3
2019-11-11 14:21:06 +00:00
2019-11-10 18:28:06 +00:00
inc h_fcnt add 1 to total # of files in this dir
bne credone
2019-11-11 14:21:06 +00:00
2019-11-10 18:28:06 +00:00
inc h_fcnt+1
2019-11-11 14:21:06 +00:00
2019-11-10 18:28:06 +00:00
credone jsr drevise go revise directories with new file
bcs crerr3
2019-11-11 14:21:06 +00:00
2019-11-10 18:28:06 +00:00
jmp upbmap lastly, update volume bitmap
2019-11-11 14:21:06 +00:00
*--------------------------------------
2019-10-16 06:09:13 +00:00
MAN
2020-05-23 18:45:32 +00:00
SAVE usr/src/prodos.fx/prodos.s.xdos.a
LOAD usr/src/prodos.fx/prodos.s
2019-10-16 06:09:13 +00:00
ASM