A2osX/ProDOS.203/ProDOS.S.XDOS.D.txt

580 lines
18 KiB
Plaintext
Raw Permalink Normal View History

2019-09-11 15:53:33 +00:00
NEW
AUTO 3,1
* read command
2019-09-16 20:50:08 +00:00
readf jsr mvdbufr xfer buffer address and request count
2019-09-11 15:53:33 +00:00
jsr mvcbytes to a more accessable location, also
2019-09-14 19:13:22 +00:00
pha get fcb attributes and save on stack.
jsr calcmrk calc mark after read, test if mark > eof
pla carry set means end mark > eof.
and #$01 test for read enabled.
bne L41DE branch if ok to read.
lda #$4E illegal access.
bne L4202 always.
L41DE bcc L4205 branch if result mark < eof. adjust
ldy fcbptr request to read until just before eof.
lda fcbbuf+21,y result = (eof-1) - position
2019-09-11 15:53:33 +00:00
sbc tposll
sta cbytes
sta rwreql
lda fcbbuf+22,y
sbc tposlh
sta cbytes+1
sta rwreqh
2019-09-14 19:13:22 +00:00
ora cbytes if both bytes = 0 then eof error
2019-09-11 15:53:33 +00:00
bne L4210
2019-09-14 19:13:22 +00:00
lda #$4C eof error
L4202 jmp errfix1
L4205 lda cbytes
2019-09-11 15:53:33 +00:00
ora cbytes+1
2019-09-14 19:13:22 +00:00
bne L4210 if read request definitely non-zero.
L420D jmp rwdone do nothing.
L4210 jsr valdbuf validate user's data buffer range.
bcs L4202 branch if memory conflict.
jsr gfcbstyp get storage type
cmp #$04 and find out if it's a tree or other.
bcc L421F branch if a tree file
jmp dread otherwise assume it's a directory.
L421F jsr rdposn set up data pointer.
bcs L4202 errors.
jsr preprw test for newline, setup for partial
2019-09-11 15:53:33 +00:00
jsr readpart read. move current data buffer contents
2019-09-14 19:13:22 +00:00
bvs L420D to user area. branch if satisfied.
bcs L421F indicates newline is set.
lda rwreqh how many blocks are to be read ?
lsr if < 2 then use the slow way.
2019-09-11 15:53:33 +00:00
beq L421F
2019-09-14 19:13:22 +00:00
sta cmdtemp save bulk block count.
jsr gfcbstat make sure current data area doesn't
and #$40 need writing before resetting ptr to
bne L421F read into user's area. branch if data
sta ioaccess needs to be written to force 1st call
lda usrbuf thru all dev handler checking. make
sta datptr the data buffer the user's space.
2019-09-11 15:53:33 +00:00
lda usrbuf+1
sta datptr+1
2019-09-14 19:13:22 +00:00
L4249 jsr rdposn get next block directly into user space.
bcs L42B7 if error.
L424E inc datptr+1 incll ptrs by one block (512 bytes)
2019-09-11 15:53:33 +00:00
inc datptr+1
dec rwreqh
dec rwreqh
inc tposlh
inc tposlh
2019-09-14 19:13:22 +00:00
bne L4269 if pos'n doesn't get to a 64k boundary
inc tposhi otherwise, must check for a 128k one.
lda tposhi carry set if 128k boundary reached.
2019-09-11 15:53:33 +00:00
eor #$01
lsr
2019-09-14 19:13:22 +00:00
L4269 dec cmdtemp has all been read fast ?
bne L427B branch if more to read.
2019-09-11 15:53:33 +00:00
jsr fxdatptr go fix up data pointer to xdos buffer.
2019-09-14 19:13:22 +00:00
lda rwreql test for end of read.
ora rwreqh are both 0 ?
2019-09-16 20:50:08 +00:00
beq rwdone yes, done.
2019-09-14 19:13:22 +00:00
bne L421F no, read last partial block
L427B bcs L4249
lda tposhi get index to next block address
2019-09-11 15:53:33 +00:00
lsr
lda tposlh
ror
2019-09-14 19:13:22 +00:00
tay index to address = int(pos/512)
lda (zpt),y get low address
2019-09-11 15:53:33 +00:00
sta bloknml
inc zpt+1
2019-09-14 19:13:22 +00:00
cmp (zpt),y are hi and low address the same?
bne L4299 no, it's a real block address.
cmp #$00 are both bytes 0 ?
bne L4299 no, must be real data.
sta ioaccess don't do repeat io just after sparse.
beq L429C branch always (carry set).
L4299 lda (zpt),y get high address
2019-09-11 15:53:33 +00:00
clc
2019-09-14 19:13:22 +00:00
L429C dec zpt+1
bcs L4249 if no block to read.
2019-09-11 15:53:33 +00:00
sta bloknml+1
2019-09-14 19:13:22 +00:00
lda ioaccess has 1st call gone to device yet ?
beq L4249 no, go thru normal route
2019-09-11 15:53:33 +00:00
clc
2019-09-14 19:13:22 +00:00
php interrupts can't occur during dmgr call
2019-09-11 15:53:33 +00:00
sei
2019-09-14 19:13:22 +00:00
lda datptr+1 reset hi buffer address for dev handler
2019-09-11 15:53:33 +00:00
sta buf+1
jsr dmgr
2019-09-14 19:13:22 +00:00
bcs L42B6 if error
2019-09-11 15:53:33 +00:00
plp
2019-09-14 19:13:22 +00:00
bcc L424E no errors, branch always.
L42B6 plp restore interrupts.
L42B7 pha save error code.
jsr fxdatptr go restore data pointers, etc.
2019-09-11 15:53:33 +00:00
pla
2019-09-16 20:50:08 +00:00
errfix1 pha save error code
2019-09-14 19:13:22 +00:00
jsr rwdone pass back # of bytes actually read
2019-09-11 15:53:33 +00:00
pla
2019-09-14 19:13:22 +00:00
sec error
2019-09-11 15:53:33 +00:00
rts
2019-09-16 20:50:08 +00:00
rwdone ldy #$06 return total # of bytes actually read
2019-09-14 19:13:22 +00:00
sec derived from cbytes-rwreq.
2019-09-11 15:53:33 +00:00
lda cbytes
sbc rwreql
sta (A3L),y
iny
lda cbytes+1
sbc rwreqh
sta (A3L),y
2019-09-14 19:13:22 +00:00
jmp rdposn leave with valid position in fcb.
2019-09-16 20:50:08 +00:00
preprw ldy fcbptr adj pointer to user's buffer to make
2019-09-14 19:13:22 +00:00
sec the transfer
2019-09-11 15:53:33 +00:00
lda usrbuf
sbc tposll
sta usrbuf
2019-09-14 19:13:22 +00:00
bcs L42E9 if no adjustment to hi address needed
2019-09-11 15:53:33 +00:00
dec usrbuf+1
2019-09-14 19:13:22 +00:00
L42E9 lda fcbbuf+31,y test for new line enabled.
2019-09-11 15:53:33 +00:00
clc
2019-09-14 19:13:22 +00:00
beq L42F9 if new line not enabled.
sec carry indicates new line enabled
2019-09-11 15:53:33 +00:00
sta nlmask
2019-09-14 19:13:22 +00:00
lda fcbbuf+10,y move newline character to more
sta nlchar accesible spot.
L42F9 ldy tposll index to 1st data.
lda datptr reset low order of position pointer to
sta sos beginning of page.
ldx rwreql get low order count of requested bytes.
rts return statuses.
2019-09-16 20:50:08 +00:00
readpart txa x = low count of bytes to move.
2019-09-14 19:13:22 +00:00
bne L430F branch if request is not an even page.
lda rwreqh a call of 0 bytes should never get here!
beq L435D branch if nothing to do.
2019-09-11 15:53:33 +00:00
dec rwreqh
2019-09-14 19:13:22 +00:00
L430F dex
L4310 lda (sos),y move data to user's buffer
2019-09-11 15:53:33 +00:00
sta (usrbuf),y
2019-09-14 19:13:22 +00:00
bcs tstnewl test for newline 1st !
L4316 txa note: x must be unchanged from tstnewl !
beq L4332 go see if read request is satified...
L4319 dex dec # of bytes left to move.
iny page crossed ?
bne L4310 no, move next byte.
lda sos+1 test for end of buffer, but first
inc usrbuf+1 adjust user buffer pointer
inc tposlh and position
2019-09-11 15:53:33 +00:00
bne L4329
inc tposhi
2019-09-14 19:13:22 +00:00
L4329 inc sos+1 and sos buffer high address.
eor datptr+1 (carry is undisturbed)
beq L4310 branch if more to read in buffer.
clv indicate not finished.
bvc L4360 always.
L4332 lda rwreqh
beq L4350 branch if request is satisfied.
iny done with this block of data ?
bne L4340 no, adjust high byte of request.
lda sos+1 maybe, check for end of block buffer.
eor datptr+1 (don't disturb carry).
bne L4343 if hi count can be dealt with next time
L4340 dec rwreqh
L4343 dey restore proper value
2019-09-11 15:53:33 +00:00
bra L4319
2019-09-14 19:13:22 +00:00
tstnewl lda (sos),y get last byte transferred again.
and nlmask only bits on in mask are significant.
eor nlchar does it match newline character?
bne L4316 no, read next.
L4350 iny adjust position.
2019-09-11 15:53:33 +00:00
bne L435D
2019-09-14 19:13:22 +00:00
inc usrbuf+1 inc pointers
2019-09-11 15:53:33 +00:00
inc tposlh
bne L435D
inc tposhi
2019-09-14 19:13:22 +00:00
L435D bit setvflg (sets v flag)
L4360 sty tposll save low position
2019-09-11 15:53:33 +00:00
bvs L4366
2019-09-14 19:13:22 +00:00
inx leave request as +1 for next call
L4366 stx rwreql and remainder of request count.
php save statuses
clc adjust user's low buffer address
2019-09-11 15:53:33 +00:00
tya
adc usrbuf
sta usrbuf
bcc L4374
2019-09-14 19:13:22 +00:00
inc usrbuf+1 adjust hi address as needed.
L4374 plp restore return statuses.
2019-09-16 20:50:08 +00:00
setvflg rts this byte ($60) is used to set v flag.
fxdatptr lda datptr put current user buffer address back to normal
2019-09-11 15:53:33 +00:00
sta usrbuf
lda datptr+1
2019-09-14 19:13:22 +00:00
sta usrbuf+1 bank pair byte should be moved also.
ldy fcbptr restore buffer address
2019-09-11 15:53:33 +00:00
jmp fndfcbuf
* read directory file
2019-09-16 20:50:08 +00:00
dread jsr rdposn
2019-09-14 19:13:22 +00:00
bcs L43B8 pass back any errors.
jsr preprw prepare for transfer.
jsr readpart move data to user's buffer.
2019-09-16 20:50:08 +00:00
bvc dread repeat until request is satisfied.
2019-09-14 19:13:22 +00:00
jsr rwdone update fcb as to new position.
bcc L43B6 branch if done with no errors.
cmp #$4C was last read to end of file ?
sec anticipate some other error.
bne L43B7 branch if not eof error.
2019-09-11 15:53:33 +00:00
jsr svmark
2019-09-14 19:13:22 +00:00
jsr zipdata clear out data block.
ldy #$00 provide dummy back pointer for future
ldx fcbptr re-position. x = hi byte of last block
L43A6 lda fcbbuf+16,x
2019-09-11 15:53:33 +00:00
sta (datptr),y
2019-09-14 19:13:22 +00:00
lda #$00 mark current block as impossible
2019-09-11 15:53:33 +00:00
sta fcbbuf+16,x
inx
2019-09-14 19:13:22 +00:00
iny inc indexes to do both hi and low bytes
2019-09-11 15:53:33 +00:00
cpy #$02
bne L43A6
2019-09-14 19:13:22 +00:00
L43B6 clc no error
L43B7 rts
L43B8 jmp errfix1 report how much xfer'd before error.
2019-09-16 20:50:08 +00:00
mvcbytes ldy #$04 move request count to a more accessable location
2019-09-11 15:53:33 +00:00
lda (A3L),y
sta cbytes
sta rwreql
iny
lda (A3L),y
sta cbytes+1
sta rwreqh
2019-09-14 19:13:22 +00:00
ldy fcbptr return y = val(fcbptr),
lda fcbbuf+9,y a = attributes
clc and carry clear...
2019-09-11 15:53:33 +00:00
rts
2019-09-16 20:50:08 +00:00
mvdbufr ldy #$02 move the pointer to user's buffer
lda (A3L),y to the block file manager
2019-09-14 19:13:22 +00:00
sta usrbuf z-page area
2019-09-11 15:53:33 +00:00
iny
lda (A3L),y
sta usrbuf+1
2019-09-16 20:50:08 +00:00
gfcbstyp ldy fcbptr return storage type
2019-09-11 15:53:33 +00:00
lda fcbbuf+7,y
rts
* this subroutine adds the requested byte count to mark and returns sum
* in scrtch and also returns mark in tpos and oldmark.
*
* on exit:
* y,x,a is unknown
* carry set indicates scrtch > eof
2019-09-16 20:50:08 +00:00
calcmrk ldx #$00
2019-09-11 15:53:33 +00:00
ldy fcbptr
clc
2019-09-14 19:13:22 +00:00
L43EE lda fcbbuf+18,y
2019-09-11 15:53:33 +00:00
sta tposll,x
sta oldmark,x
adc cbytes,x
sta scrtch,x
txa
2019-09-14 19:13:22 +00:00
eor #$02 cbytes+2 always=0
2019-09-16 20:50:08 +00:00
beq eoftest
2019-09-11 15:53:33 +00:00
iny
inx
2019-09-14 19:13:22 +00:00
bne L43EE always.
2019-09-16 20:50:08 +00:00
eoftest lda scrtch,x new mark in scrtch.
2019-09-14 19:13:22 +00:00
cmp fcbbuf+21,y is new position > eof ?
bcc L4414 no, proceed.
bne L4414 yes, adjust 'cbytes' request
2019-09-11 15:53:33 +00:00
dey
2019-09-14 19:13:22 +00:00
dex all tree bytes compared ?
2019-09-16 20:50:08 +00:00
bpl eoftest no, test next lowest
2019-09-14 19:13:22 +00:00
L4414 rts
2019-09-16 20:50:08 +00:00
werreof jsr plus2fcb reset eof to pre-error position.
2019-09-14 19:13:22 +00:00
L4418 lda oldeof,x place oldeof back into fcb
2019-09-11 15:53:33 +00:00
sta fcbbuf+21,y
2019-09-14 19:13:22 +00:00
lda oldmark,x also reset mark to last best
sta fcbbuf+18,y write position
sta scrtch,x and copy mark to scrtch for test of
dey eof less than mark.
2019-09-11 15:53:33 +00:00
dex
bpl L4418
2019-09-14 19:13:22 +00:00
jsr plus2fcb get pointers to test eof < mark.
jsr eoftest carry set means mark > eof !!
2019-09-11 15:53:33 +00:00
* drop into wadjeof to adjust eof to mark if necessary
2019-09-16 20:50:08 +00:00
wadjeof jsr plus2fcb get y=fcbptr+2, x=2, a=y.
2019-09-14 19:13:22 +00:00
L4434 lda fcbbuf+21,y copy eof to old eof
2019-09-11 15:53:33 +00:00
sta oldeof,x
2019-09-14 19:13:22 +00:00
bcc L4442 and if carry set...
lda scrtch,x then copy scrtch to fcb's eof.
2019-09-11 15:53:33 +00:00
sta fcbbuf+21,y
2019-09-14 19:13:22 +00:00
L4442 dey
dex copy all 3 bytes
2019-09-11 15:53:33 +00:00
bpl L4434
rts
2019-09-16 20:50:08 +00:00
plus2fcb lda #$02 on exit both a and y = fcbptr+2.
2019-09-14 19:13:22 +00:00
tax x = 2
2019-09-11 15:53:33 +00:00
ora fcbptr
tay
rts
* write command
2019-09-16 20:50:08 +00:00
writef jsr mvcbytes first determine if requested write is legal.
2019-09-11 15:53:33 +00:00
pha
2019-09-14 19:13:22 +00:00
jsr calcmrk save a copy of eof to old eof, set/clr
jsr wadjeof carry to determine if new mark > eof.
pla get attributes again.
and #$02 is write enabled ?
bne L4462 yes, continue...
L445E lda #$4E illegal access error.
2019-09-11 15:53:33 +00:00
bne L44A2
2019-09-14 19:13:22 +00:00
L4462 jsr tstwprot otherwise, make sure device is not
bcs L44A2 write protected. if so, branch to abort.
2019-09-11 15:53:33 +00:00
lda cbytes
2019-09-14 19:13:22 +00:00
ora cbytes+1 anything to write ?
bne L4472 branch if so,
jmp rwdone else do nothing.
L4472 jsr mvdbufr move the user's buffer ptr to bfm zero
cmp #$04 page area, also get storage type.
bcs L445E if not tree, return an access error.
L4479 jsr rdposn
2019-09-11 15:53:33 +00:00
bcs L44A2
jsr gfcbstat
and #$07
beq L44E9
2019-09-14 19:13:22 +00:00
ldy #$00 is enough disk space available for
L4487 iny indexes and data block ?
2019-09-11 15:53:33 +00:00
lsr
bne L4487
sty reql
sta reqh
jsr tstfrblk
2019-09-14 19:13:22 +00:00
bcs L44A2 pass back any errors.
jsr gfcbstat now get more specific.
and #$04 are we lacking a tree top ?
beq L44AC no, test for lack of sapling level index
jsr topdown go allocate tree top and adj file type.
bcc L44B8 continue with allocation of data block.
L44A2 pha save error.
jsr errfix1 error return.
jsr werreof adjust eof and mark to pre-error state.
pla restore error code.
2019-09-11 15:53:33 +00:00
sec
rts
2019-09-14 19:13:22 +00:00
L44AC jsr gfcbstat get status byte again.
and #$02 do we need a sapling level index block ?
beq L44B8 no, assume it's just a data block needed
jsr sapdown go alloc an indx blk and update tree top
bcs L44A2 if error.
L44B8 jsr alcwblk go allocate for data block.
2019-09-11 15:53:33 +00:00
bcs L44A2
2019-09-14 19:13:22 +00:00
jsr gfcbstat clear allocation required bits in status
ora #$80 but first indicate index block is dirty.
2019-09-11 15:53:33 +00:00
and #$F8
sta fcbbuf+8,y
2019-09-14 19:13:22 +00:00
lda tposhi calculate position within index block.
2019-09-11 15:53:33 +00:00
lsr
lda tposlh
ror
2019-09-14 19:13:22 +00:00
tay now put block address into index block.
inc zpt+1 high byte first.
2019-09-11 15:53:33 +00:00
lda scrtch+1
tax
sta (zpt),y
2019-09-14 19:13:22 +00:00
dec zpt+1 restore pointer to lower page of index
lda scrtch block. get low block address.
sta (zpt),y store low address.
ldy fcbptr update fcb to indicate that this block
sta fcbbuf+16,y is allocated.
txa get high address again.
2019-09-11 15:53:33 +00:00
sta fcbbuf+17,y
2019-09-14 19:13:22 +00:00
L44E9 jsr preprw
2019-09-11 15:53:33 +00:00
jsr wrtpart
bvc L4479
2019-09-14 19:13:22 +00:00
jmp rwdone update fcb with new position
2019-09-16 20:50:08 +00:00
wrtpart txa
2019-09-14 19:13:22 +00:00
bne L44FF branch if request is not even pages
lda rwreqh a call of 0 bytes should never get here!
beq L4546 do nothing
2019-09-11 15:53:33 +00:00
dec rwreqh
2019-09-14 19:13:22 +00:00
L44FF dex
lda (usrbuf),y move data from user's buffer
2019-09-11 15:53:33 +00:00
sta (sos),y
txa
beq L4525
2019-09-14 19:13:22 +00:00
L4507 iny page crossed ?
bne L44FF no, keep moving.
lda sos+1 test for end of buffer
inc usrbuf+1 but first adjust user buffer pointer
inc tposlh and position
2019-09-11 15:53:33 +00:00
bne L451C
inc tposhi
bne L451C
2019-09-14 19:13:22 +00:00
lda #$4D out of range if > 32MB
2019-09-11 15:53:33 +00:00
bne L44A2
2019-09-14 19:13:22 +00:00
L451C inc sos+1 adjust sos buffer high address
eor datptr+1 (carry is undisturbed)
beq L44FF branch if more to write to buffer.
clv indicates not finished.
bvc L4549 always.
L4525 lda rwreqh
beq L4539 branch if request satisfied.
iny done with this block of data ?
bne L4533 if not.
lda sos+1 this is necessary for proper
eor datptr+1 adjustment of request count
2019-09-11 15:53:33 +00:00
bne L4536
2019-09-14 19:13:22 +00:00
L4533 dec rwreqh
L4536 dey reset modified y
2019-09-11 15:53:33 +00:00
bra L4507
2019-09-14 19:13:22 +00:00
L4539 iny and position
2019-09-11 15:53:33 +00:00
bne L4546
2019-09-14 19:13:22 +00:00
inc usrbuf+1 inc pointers
2019-09-11 15:53:33 +00:00
inc tposlh
bne L4546
inc tposhi
2019-09-14 19:13:22 +00:00
L4546 bit setvflg set v flag
L4549 sty tposll save low position
stx rwreql and remainder of request count.
php save statuses
2019-09-11 15:53:33 +00:00
jsr gfcbstat
ora #$50
sta fcbbuf+8,y
2019-09-14 19:13:22 +00:00
clc adjust user's low buffer address
2019-09-11 15:53:33 +00:00
lda tposll
adc usrbuf
sta usrbuf
bcc L4564
2019-09-14 19:13:22 +00:00
inc usrbuf+1 adjust high address as needed.
L4564 jsr fcbused set directory flush bit.
plp restore return statuses
2019-09-11 15:53:33 +00:00
rts
2019-09-16 20:50:08 +00:00
topdown jsr swapdown make current 1st block an entry in new
2019-09-14 19:13:22 +00:00
bcs L45B1 top. branch if errors.
jsr gfcbstyp get storage type
2019-09-11 15:53:33 +00:00
* has storage type been changed to 'tree' ? if not, assume it was originally
* a seed and both levels need to be built. otherwise, only an index needs
* to be allocated.
2019-09-14 19:13:22 +00:00
cmp #$03 tree type
2019-09-11 15:53:33 +00:00
beq L457A
jsr swapdown make previous swap a sap level index
2019-09-14 19:13:22 +00:00
bcs L45B1 block. branch if errors.
L457A jsr alcwblk get another block address for the sap
bcs L45B1 level index. branch if errors.
lda tposhi calculate position of new index block
lsr in the top of the tree.
2019-09-11 15:53:33 +00:00
tay
2019-09-14 19:13:22 +00:00
lda scrtch get address of newly allocated index
tax block again.
2019-09-11 15:53:33 +00:00
sta (zpt),y
inc zpt+1
lda scrtch+1
2019-09-14 19:13:22 +00:00
sta (zpt),y save hi address
2019-09-11 15:53:33 +00:00
dec zpt+1
2019-09-14 19:13:22 +00:00
ldy fcbptr make newly allocated block the current
sta fcbbuf+15,y index block.
2019-09-11 15:53:33 +00:00
txa
sta fcbbuf+14,y
jsr wfcbfst save new top of tree
bcs L45B1
jmp zeroindex zero index block in user's i/o buffer.
2019-09-16 20:50:08 +00:00
sapdown jsr gfcbstyp find out if dealing with a tree.
2019-09-11 15:53:33 +00:00
cmp #$01 if seed then adj to file type is needed.
2019-09-16 20:50:08 +00:00
beq swapdown branch if seed
2019-09-11 15:53:33 +00:00
jsr rfcbfst otherwise read in top of tree.
bcc L457A if no error.
L45B1 rts return errors.
2019-09-16 20:50:08 +00:00
swapdown jsr alcwblk make current seed into a sapling, allocate a block before swap.
2019-09-11 15:53:33 +00:00
bcs L45F6 return errors.
ldy fcbptr get previous first block
lda fcbbuf+12,y address into index block.
pha save temporarily while swapping in new
lda scrtch top index. get new block address (low)
tax
sta fcbbuf+12,y
lda fcbbuf+13,y
pha
2019-09-14 19:13:22 +00:00
lda scrtch+1 and high address too
2019-09-11 15:53:33 +00:00
sta fcbbuf+13,y
2019-09-14 19:13:22 +00:00
sta fcbbuf+15,y make new top also the current index in
txa memory. get low address again.
2019-09-11 15:53:33 +00:00
sta fcbbuf+14,y
2019-09-14 19:13:22 +00:00
inc zpt+1 make previous the 1st entry in sub index
2019-09-11 15:53:33 +00:00
pla
sta (zpt)
dec zpt+1
pla
sta (zpt)
2019-09-14 19:13:22 +00:00
jsr wfcbfst save new file top.
bcs L45F6 if error.
jsr gfcbstyp now adjust storage type by adding 1
adc #$01 (seed becomes sapling becomes tree)
2019-09-11 15:53:33 +00:00
sta fcbbuf+7,y
2019-09-14 19:13:22 +00:00
lda fcbbuf+8,y mark storage type modified
2019-09-11 15:53:33 +00:00
ora #$08
sta fcbbuf+8,y
2019-09-14 19:13:22 +00:00
clc no error
2019-09-11 15:53:33 +00:00
L45F6 rts
2019-09-16 20:50:08 +00:00
alcwblk jsr alc1blk
2019-09-11 15:53:33 +00:00
bcs L4616
jsr gfcbstat mark usage as modified
ora #$10
sta fcbbuf+8,y
lda fcbbuf+24,y inc current usage count by 1
clc
adc #$01
sta fcbbuf+24,y
lda fcbbuf+25,y
adc #$00
sta fcbbuf+25,y
L4615 clc no error
L4616 rts
2019-09-12 06:39:47 +00:00
2019-09-16 20:50:08 +00:00
tstwprot jsr gfcbstat check for 'never been modified' condition
2019-09-11 15:53:33 +00:00
and #$F0
bne L4615 ordinary rts if known write ok.
lda fcbbuf+1,y get file's dev #.
sta devnum get current status of block device.
2019-09-12 06:39:47 +00:00
2019-09-16 20:50:08 +00:00
twrprot1 sta unitnum make the device status call
2019-09-11 15:53:33 +00:00
lda bloknml+1
pha
lda bloknml save the current block values
pha
stz A4L
stz bloknml zero the block #
stz bloknml+1
php
sei
jsr dmgr
bcs .1 branch if write protect error
lda #$00 otherwise, assume no errors.
.1 plp restore interrupt status
clc
tax save error.
beq .2 branch if no error
sec else, set carry to show error.
.2 pla
sta bloknml restore the block #
pla
sta bloknml+1
txa
rts carry is indeterminate.
MAN
SAVE usr/src/prodos.203/prodos.s.xdos.d
LOAD usr/src/prodos.203/prodos.s
2019-09-11 15:53:33 +00:00
ASM