mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-23 07:35:19 +00:00
767 lines
20 KiB
Plaintext
767 lines
20 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
findfile jsr lookfile see if file exists
|
||
bcs nofind
|
||
|
||
moventry ldy h_entln Get FileInfo From Directory Block Buffer
|
||
|
||
.1 dey
|
||
lda (zpt),y move entry into storage
|
||
sta d_stor,y
|
||
tya
|
||
bne .1
|
||
|
||
nofind rts
|
||
*--------------------------------------
|
||
lookfile jsr preproot go find volume
|
||
bcs fnderr
|
||
|
||
bne lookfil0 branch if more than root
|
||
|
||
lda /gbuf otherwise, report a bad path error
|
||
sta zpt+1 (but 1st create a phantom entry
|
||
lda #$04 for open)
|
||
sta zpt
|
||
|
||
ldy #$1F move in id and date info
|
||
|
||
phantm1 lda (zpt),y
|
||
sta d_stor,y
|
||
dey
|
||
cpy #$17
|
||
bne phantm1
|
||
|
||
phantm2 lda rootstuf-$10,y
|
||
sta d_stor,y
|
||
dey
|
||
cpy #$0F
|
||
bne phantm2
|
||
|
||
lda #$D0 fake directory file
|
||
sta d_stor
|
||
lda gbuf+2 check forward link.
|
||
ora gbuf+3 if non-zero, assume full sized directory
|
||
bne H37C2 else assume it's the slot 3 /RAM volume
|
||
|
||
lda #$02 so reset eof and blocks_used fields
|
||
sta d_eof+1
|
||
lda #$01
|
||
sta d_usage
|
||
|
||
H37C2 lda #MLI.E.INVPATH bad path (carry set)
|
||
rts
|
||
*--------------------------------------
|
||
lookfil0 stz nofree reset free entry indicator.
|
||
sec dir to be searched has header in this block.
|
||
L37C9 stz totent reset entry counter.
|
||
|
||
jsr XDOS.LookupNameInDirBlk look for name pointed to by pnptr.
|
||
bcc namfound if name was found.
|
||
|
||
lda entcntl have we looked at all of the
|
||
sbc totent entries in this directory?
|
||
bcc L37E2 maybe, check hi count.
|
||
bne L37EB no, read next directory block.
|
||
|
||
cmp entcnth has the last entry been looked at?
|
||
beq errfnf yes, give 'file not found' error
|
||
bne L37EB or branch always.
|
||
|
||
L37E2 dec entcnth should be at least one
|
||
bpl L37EB so this should be branch always...
|
||
|
||
errdir lda #MLI.E.BADDIR directory error
|
||
fnderr sec
|
||
rts
|
||
|
||
L37EB sta entcntl keep a running count.
|
||
lda /gbuf reset indirect pointer
|
||
sta zpt+1
|
||
|
||
lda gbuf+2 get link to next dir block
|
||
bne L37FC (if there is one).
|
||
|
||
cmp gbuf+3 are both zero, i.e. no link? if so,
|
||
beq errdir then not all entries were acct'd for.
|
||
|
||
L37FC ldx gbuf+3 acc has value for block# (low).
|
||
jsr rdblk go read the next linked directory.
|
||
bcc L37C9 if no error.
|
||
rts return error in acc.
|
||
|
||
errfnf lda nofree was any free entry found?
|
||
bne fnf0
|
||
lda gbuf+2 test link
|
||
bne L3814
|
||
cmp gbuf+3 if both are 0 then give up.
|
||
beq fnf0 report 'not found'.
|
||
|
||
L3814 sta d_entblk
|
||
lda gbuf+3
|
||
sta d_entblk+1 assume 1st entry of next block
|
||
lda #$01 is free for use.
|
||
sta d_entnum mark as valid (for create)
|
||
sta nofree
|
||
|
||
fnf0 jsr nxtpnam1 'file not found' or 'path not found'?
|
||
errpath1 beq .1 if non-zero then 'path not found'
|
||
|
||
lda #MLI.E.PNOTFND path not found
|
||
.HS 2C BIT ABS
|
||
|
||
.1 lda #MLI.E.FNOTFND file not found
|
||
sec
|
||
lookfil0.RTS rts
|
||
*--------------------------------------
|
||
namfound jsr nxtpname adj index to next name in path.
|
||
beq filfound branch if that was the last name.
|
||
|
||
ldy #$00 be sure this is a directory entry.
|
||
lda (zpt),y high nibble will tell.
|
||
and #$F0
|
||
cmp #$D0 is it a subdirectory?
|
||
bne errpath1 error if not.
|
||
|
||
ldy #$11 get address of 1st subdirectory block
|
||
lda (zpt),y
|
||
sta bloknml (no checking done for a valid block#)
|
||
iny
|
||
sta d_head save as file's header block too
|
||
lda (zpt),y
|
||
sta bloknml+1
|
||
sta d_head+1
|
||
|
||
jsr rdgbuf read subdirectory into gbuf.
|
||
bcs lookfil0.RTS if error.
|
||
|
||
lda gbuf+37 get the # of files contained in this
|
||
sta entcntl directory.
|
||
lda gbuf+38
|
||
sta entcnth
|
||
*--------------------------------------
|
||
* Check if $75 at VOL/DIR entry + $14
|
||
* (8 bytes reserved)
|
||
*--------------------------------------
|
||
.DO LOWERCASE=0
|
||
lda gbuf+20 make sure password is disabled
|
||
|
||
ldx #$00
|
||
sec
|
||
rol
|
||
L3869 bcc L386C
|
||
|
||
inx
|
||
L386C asl
|
||
bne L3869
|
||
|
||
cpx #$05 is password disabled?
|
||
beq movhead
|
||
|
||
lda #MLI.E.INCFF directory is not compatible
|
||
sec
|
||
rts
|
||
.FIN
|
||
*--------------------------------------
|
||
movhead jsr movhed0 move directory info.
|
||
jmp lookfil0 do next local pathname.
|
||
|
||
movhed0 .DO ACL=1
|
||
ldx #18
|
||
.ELSE
|
||
ldx #10 move this directory info
|
||
.FIN
|
||
|
||
.1 .DO ACL=1
|
||
lda gbuf+$14,x
|
||
sta h_acl,x
|
||
.ELSE
|
||
lda gbuf+1C,x
|
||
sta h_credt,x
|
||
.FIN
|
||
dex
|
||
bpl .1
|
||
|
||
lda gbuf+4 if this is root, then nothing to do
|
||
and #$F0
|
||
eor #$F0 test header type.
|
||
beq .8 branch if root
|
||
|
||
ldx #$03 otherwise, save owner info about
|
||
|
||
.2 lda gbuf+$27,x this header.
|
||
sta own_blk,x
|
||
dex
|
||
bpl .2
|
||
|
||
.8 rts
|
||
*--------------------------------------
|
||
filfound lda h_maxent figure out which entry # this is
|
||
sec
|
||
sbc cntent max entries - count entries + 1
|
||
adc #$00 = entry # (carry was set)
|
||
sta d_entnum
|
||
lda bloknml and indicate block # of this directory
|
||
sta d_entblk
|
||
lda bloknml+1
|
||
sta d_entblk+1
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
XDOS.LookupNameInDirBlk
|
||
lda h_maxent reset count of files per block
|
||
sta cntent
|
||
|
||
lda /gbuf
|
||
sta zpt+1
|
||
lda #$04
|
||
|
||
L38C1 sta zpt reset indirect pointer to gbuf
|
||
bcs L38F8 branch if this block contains a header
|
||
|
||
ldy #$00
|
||
lda (zpt),y get length of name in directory.
|
||
bne isname branch if there is a name.
|
||
|
||
lda nofree test if a free entry has been declared.
|
||
bne L38F8 yes, inc to next entry.
|
||
|
||
jsr filfound set address for current entry.
|
||
|
||
inc nofree indicate a free spot has been found.
|
||
bra L38F8
|
||
|
||
isname and #$0F strip byte (is checked by 'filfound')
|
||
inc totent inc count of valid files found.
|
||
sta namcnt save name length as counter.
|
||
|
||
ldx namptr get index to current path.
|
||
cmp pathbuf,x are both names the same length?
|
||
bne L38F8 no, inc to next entry.
|
||
|
||
cmpname inx (first) next letter index
|
||
iny
|
||
|
||
.DO LOWERCASE=1
|
||
phy
|
||
cpy #8 CS if MIN_VERSION to use
|
||
|
||
ldy #$1C VERSION
|
||
lda (zpt),y
|
||
bpl .4 no lowercase information
|
||
|
||
bcs .1
|
||
|
||
ply
|
||
and whichbit,y
|
||
beq .5 UPPERCASE
|
||
|
||
bra .2
|
||
|
||
.1 iny MIN_VERSION
|
||
lda (zpt),y
|
||
|
||
ply
|
||
and whichbit-8,y
|
||
beq .5
|
||
|
||
.2 lda (zpt),y
|
||
jsr XDOS.ToLower
|
||
bra .6
|
||
|
||
.4 ply
|
||
.FIN
|
||
.5 lda (zpt),y compare names letter by letter
|
||
.6 cmp pathbuf,x
|
||
bne L38F8
|
||
|
||
dec namcnt all letters compared?
|
||
bne cmpname no, continue.
|
||
|
||
clc a match is found.
|
||
noname rts
|
||
|
||
L38F8 dec cntent checked all entries in this block?
|
||
sec
|
||
beq noname yes, no name match.
|
||
lda h_entln add entry length to current pointer
|
||
clc
|
||
adc zpt
|
||
bcc L38C1 branch if still in 1st page.
|
||
|
||
inc zpt+1 look on 2nd page.
|
||
clc carry should always be clear before
|
||
bra L38C1 looking at next.
|
||
*--------------------------------------
|
||
preproot jsr findvol search vcb's and dev's for spec'd volume
|
||
bcs novolume
|
||
|
||
.DO ACL=1
|
||
ldx #$4A
|
||
.ELSE
|
||
ldx #$42 zero out directory temps
|
||
.FIN
|
||
|
||
.1 stz own_blk,x and owner info
|
||
dex
|
||
bpl .1
|
||
|
||
lda devnum setup device # for this directory
|
||
sta d_dev
|
||
jsr movhed0 setup other header info from directory
|
||
|
||
ldy #$01 in gbuf and clean up misc info.
|
||
ldx vcbptr
|
||
inx
|
||
|
||
.2 lda vcbbuf+18,x misc info includes
|
||
sta h_tblk,y total # of blocks,
|
||
lda vcbbuf+26,x the address of the 1st bitmap,
|
||
sta h_bmap,y
|
||
lda bloknml,y directory's disk address,
|
||
sta d_head,y
|
||
lda h_fcnt,y and setting up a counter for the # of
|
||
sta entcntl,y files in this directory.
|
||
dex
|
||
dey
|
||
bpl .2
|
||
|
||
nxtpname jsr nxtpnam1 get new namptr in y and namlen in acc.
|
||
sty namptr save new pathname pointer.
|
||
rts (status reg according to accumulator)
|
||
|
||
nxtpnam1 ldy namptr inc pathname pointer to next name
|
||
lda pathbuf,y in the path.
|
||
sec
|
||
adc namptr if this addition results in zero,
|
||
tay then prefixed directory has been moved
|
||
bne L395F to another device. branch if not.
|
||
|
||
lda devnum revise devnum for prefixed directory
|
||
sta p_dev
|
||
|
||
L395F lda pathbuf,y test for end of name.
|
||
clc no errors
|
||
novolume rts
|
||
*--------------------------------------
|
||
findvol lda #$00
|
||
ldy preflag use prefix volume name to look up vcb.
|
||
bit prfxflg is this a prefixed path?
|
||
bpl L396F branch if it is
|
||
|
||
tay set ptr to volume name
|
||
|
||
L396F sty vnptr and save.
|
||
sta devnum zero out dev# until vcb located.
|
||
|
||
L3975 pha acc now used as vcb lookup index.
|
||
tax index pointer to x.
|
||
lda vcbbuf,x get vcb volume name length.
|
||
bne L3987 branch if claimed vcb to be tested.
|
||
|
||
L397C ldy vnptr restore pointer to requested vol name.
|
||
pla now adj vcb index to next vcb entry.
|
||
clc
|
||
adc #$20
|
||
bcc L3975 branch if more vcb's to check
|
||
bcs L39D4 otherwise go look for unlogged volumes.
|
||
|
||
L3987 sta namcnt save length of vol name to be compared.
|
||
|
||
L398A cmp pathbuf,y is it the same as requested vol name?
|
||
bne L397C branch if not
|
||
|
||
inx
|
||
iny next character
|
||
lda vcbbuf,x
|
||
dec namcnt last character?
|
||
bpl L398A if not.
|
||
|
||
plx restore pointer to matching vcb.
|
||
stx vcbptr save it for future reference.
|
||
lda vcbbuf+16,x get it's device #
|
||
sta devnum and save it.
|
||
stz bloknml+1 assume prefix is not used and
|
||
lda #$02 that root directory is to be used.
|
||
sta bloknml
|
||
lda vnptr = 0 if no prefix.
|
||
|
||
L39AC tay if prefix then find ptr to prefixed
|
||
sta namptr dir name. save path ptr.
|
||
beq L39C2 branch if no prefix.
|
||
sec
|
||
adc pathbuf,y inc to next dir in prefix path.
|
||
bcc L39AC branch if another dir in prefix.
|
||
|
||
lda p_blok volume verification will occur at
|
||
sta bloknml subdirectory level.
|
||
lda p_blok+1
|
||
sta bloknml+1
|
||
|
||
* verify volume name
|
||
|
||
L39C2 jsr rdgbuf read in directory (or prefix dir)
|
||
bcs L39CC if error then look on other devices.
|
||
|
||
jsr XDOS.CheckVolName compare dir name with path name.
|
||
bcc L39F0 if they match, stop looking.
|
||
|
||
L39CC ldx vcbptr check if current (matched) vcb is active
|
||
lda vcbbuf+17,x i.e. does it have open files?
|
||
bmi L39ED report not found if active.
|
||
|
||
L39D4 lda vnptr make path ptr same as volume ptr
|
||
sta namptr
|
||
jsr mvdevnums copy all device #'s to be examined.
|
||
lda devnum log current device 1st before searching
|
||
bne L39F1 others.
|
||
|
||
L39E2 ldx DEVCNT scan look list for devices we need
|
||
|
||
L39E5 lda loklst,x to search for the requested volume.
|
||
bne L39F4 branch if we've a device to look at.
|
||
dex
|
||
bpl L39E5 look at next one.
|
||
|
||
L39ED lda #MLI.E.VNOTFND no mounted volume
|
||
sec error
|
||
L39F0 rts
|
||
|
||
L39F1 ldx DEVCNT now remove the device from the list
|
||
|
||
L39F4 cmp loklst,x of prospective devices.
|
||
beq L39FE branch if match.
|
||
dex look until found.
|
||
bpl L39F4 always taken (usually) unless
|
||
bmi L39ED if dev was removed from devlst (/RAM).
|
||
|
||
L39FE sta devnum preserve device to be checked next.
|
||
stz loklst,x mark this one as tested.
|
||
jsr fnddvcb find vcb that claims this dev (if any).
|
||
bcs L3A29 branch if vcb full.
|
||
ldx vcbptr did fndvcb find it or return free vcb?
|
||
lda vcbbuf,x
|
||
beq L3A16 if free vcb.
|
||
lda vcbbuf+17,x is this volume active?
|
||
bmi L39E2 if so, no need to re-log.
|
||
|
||
L3A16 lda #$02 go read root dir into gbuf
|
||
ldx #$00
|
||
jsr rdblk
|
||
bcs L39E2 ignore if unable to read.
|
||
|
||
jsr logvcb go log in volume name.
|
||
bcs L39E2 look at next if non-xdos disk mounted.
|
||
|
||
jsr XDOS.CheckVolName is this the volume ?
|
||
bcs L39E2 if not
|
||
L3A29 rts
|
||
*--------------------------------------
|
||
mvdevnums ldx DEVCNT copy all dev #'s to be checked.
|
||
|
||
L3A2D lda DEVLST,x active device list.
|
||
and #$F0 strip device type info.
|
||
sta loklst,x copy them to a temp workspace
|
||
dex
|
||
bpl L3A2D
|
||
|
||
ldx DEVCNT
|
||
rts
|
||
*--------------------------------------
|
||
fnddvcb lda #$00 look for vcb with this device#
|
||
ldy #$FF
|
||
|
||
L3A40 tax new index to next vcb
|
||
lda vcbbuf+16,x check all devnums
|
||
cmp devnum is this the vcb?
|
||
bne L3A4E if not
|
||
stx vcbptr
|
||
clc indicates found
|
||
rts
|
||
|
||
L3A4E lda vcbbuf,x is this a free vcb?
|
||
bne L3A57 if not
|
||
|
||
iny
|
||
stx vcbptr
|
||
L3A57 txa
|
||
clc inc index to next vcb
|
||
adc #$20
|
||
bne L3A40
|
||
|
||
tya any free vcb's available?
|
||
bpl L3A79 yes
|
||
|
||
lda #$00 look for an entry to kick out
|
||
|
||
L3A62 tax
|
||
lda vcbbuf+17,x any open files?
|
||
bpl L3A70 no, kick this one out.
|
||
txa next vcb
|
||
clc
|
||
adc #$20 (vcb entry size)
|
||
bne L3A62
|
||
beq L3A7A all vcb entries have open files
|
||
|
||
L3A70 stx vcbptr save entry index.
|
||
stz vcbbuf,x free this entry
|
||
stz vcbbuf+16,x
|
||
L3A79 clc no error.
|
||
|
||
L3A7A lda #$55 # vcb full error
|
||
rts
|
||
*--------------------------------------
|
||
XDOS.CheckVolName
|
||
ldx #$00 index to directory name.
|
||
ldy namptr index to pathname.
|
||
|
||
lda gbuf+4 get dir name length and type.
|
||
cmp #$E0 is it a directory?
|
||
bcc L3A90 if not.
|
||
|
||
and #$0F isolate name length and
|
||
sta namcnt save as a counter.
|
||
bne L3A95 branch if valid length.
|
||
|
||
L3A90 sec indicate not found
|
||
rts
|
||
|
||
L3A92 .DO LOWERCASE=1
|
||
lda gbuf+$20 VERSION
|
||
bpl .8
|
||
|
||
cpx #8
|
||
bcs .1
|
||
|
||
and whichbit,x
|
||
beq .8
|
||
bra .2
|
||
|
||
.1 lda gbuf+$21 MIN_VERSION
|
||
and whichbit-8,x
|
||
beq .8
|
||
|
||
.2 lda gbuf+4,x
|
||
jsr XDOS.ToLower
|
||
bra L3A95
|
||
|
||
.8 .FIN
|
||
lda gbuf+4,x next char
|
||
|
||
L3A95 cmp pathbuf,y
|
||
bne L3A90 if not the same.
|
||
|
||
inx check next char
|
||
iny
|
||
dec namcnt
|
||
bpl L3A92 if more to compare.
|
||
|
||
clc match found
|
||
XDOS.CheckVolName.RTS
|
||
rts
|
||
*--------------------------------------
|
||
logvcb ldx vcbptr previously logged in volume?
|
||
lda vcbbuf,x (acc = 0?)
|
||
beq logvcb1 no, go prepare vcb.
|
||
|
||
jsr cmpvcb does vcb match vol read?
|
||
bcc XDOS.CheckVolName.RTS yes, do not disturb.
|
||
|
||
logvcb1 ldy #$1F zero out vcb entry
|
||
|
||
L3AB2 stz vcbbuf,x
|
||
inx
|
||
dey
|
||
bpl L3AB2
|
||
|
||
jsr tstsos make sure it's an xdos disk
|
||
bcs XDOS.CheckVolName.RTS if not, return carry set.
|
||
|
||
jsr tstdupvol does a duplicate with open files
|
||
bcs L3B04 already exist? branch if yes.
|
||
|
||
lda gbuf+4 move volume name to vcb.
|
||
and #$0F strip root marker
|
||
tay
|
||
pha
|
||
ora vcbptr
|
||
tax
|
||
|
||
L3ACE .DO LOWERCASE=1
|
||
jsr XDOS.GetVolNameCharGBufY
|
||
.ELSE
|
||
lda gbuf+4,y
|
||
.FIN
|
||
sta vcbbuf,x
|
||
dex
|
||
dey
|
||
bne L3ACE
|
||
|
||
pla get length again
|
||
sta vcbbuf,x and save.
|
||
|
||
lda devnum last device used.
|
||
sta vcbbuf+16,x save device # and
|
||
lda gbuf+41 total # of blocks on this unit.
|
||
sta vcbbuf+18,x
|
||
lda gbuf+42
|
||
sta vcbbuf+19,x
|
||
lda bloknml save address of root directory.
|
||
sta vcbbuf+22,x
|
||
lda bloknml+1
|
||
sta vcbbuf+23,x
|
||
lda gbuf+39 save address of the 1st bitmap.
|
||
sta vcbbuf+26,x
|
||
lda gbuf+40
|
||
sta vcbbuf+27,x
|
||
|
||
L3B04 clc indicate logged if possible
|
||
rts
|
||
*--------------------------------------
|
||
cmpvcb lda gbuf+4 with name in directory.
|
||
and #$0F
|
||
cmp vcbbuf,x are they the same length?
|
||
stx xvcbptr (see rev note #23)
|
||
bne L3B1E if not the same.
|
||
|
||
tay
|
||
ora xvcbptr
|
||
tax
|
||
|
||
L3B18 .DO LOWERCASE=1
|
||
jsr XDOS.GetVolNameCharGBufY
|
||
.ELSE
|
||
lda gbuf+4,y
|
||
.FIN
|
||
|
||
cmp vcbbuf,x
|
||
|
||
L3B1E sec anticipate different names.
|
||
bne L3B26 if not the same.
|
||
|
||
dex
|
||
dey
|
||
bne L3B18
|
||
|
||
clc indicate match.
|
||
|
||
L3B26 ldx xvcbptr offset to start of vcb (rev note #23)
|
||
rts
|
||
*--------------------------------------
|
||
tstdupvol lda #$00 check for other logged in volumes with the same name.
|
||
L3B2C tax
|
||
jsr cmpvcb
|
||
bcs L3B41 if no match.
|
||
lda vcbbuf+17,x test for any open files.
|
||
bmi L3B4B cannot look at this volume.
|
||
lda #$00 take duplicate offline if no open files
|
||
sta vcbbuf,x
|
||
sta vcbbuf+16,x
|
||
beq L3B49 ok to log in new volume.
|
||
L3B41 txa index to next vcb
|
||
clc
|
||
and #$E0 strip odd stuff.
|
||
adc #$20 inc to next entry.
|
||
bcc L3B2C branch if more to check
|
||
L3B49 clc
|
||
rts
|
||
|
||
L3B4B sta duplflag duplicate has been found.
|
||
stx vcbentry save pointer to conflicting vcb.
|
||
sec error.
|
||
rts
|
||
*--------------------------------------
|
||
tstfrblk ldx vcbptr test if enough free blocks available for request.
|
||
lda vcbbuf+21,x check if proper count for this volume.
|
||
ora vcbbuf+20,x
|
||
bne L3BAD branch if count is non-zero.
|
||
|
||
tkfrecnt jsr cntbms get # of bitmaps
|
||
sta bmcnt and save.
|
||
stz scrtch start count at 0
|
||
stz scrtch+1
|
||
lda #$FF mark 'first free' temp as unknown
|
||
sta nofree
|
||
jsr upbmap update volume bitmap.
|
||
bcs L3BC1 if error.
|
||
ldx vcbptr get address of 1st bitmap
|
||
lda vcbbuf+26,x
|
||
sta bloknml
|
||
lda vcbbuf+27,x
|
||
sta bloknml+1
|
||
L3B81 jsr rdgbuf use general buffer for temp space to
|
||
bcs L3BC1 count free blocks (bits).
|
||
jsr count
|
||
dec bmcnt was that the last bitmap?
|
||
bmi L3B96 if so, go change fcb so not done again.
|
||
inc bloknml
|
||
bne L3B81
|
||
inc bloknml+1
|
||
bra L3B81
|
||
L3B96 ldx vcbptr mark which block had 1st free space
|
||
lda nofree
|
||
bmi L3BBE if no free space was found.
|
||
sta vcbbuf+28,x update the free count.
|
||
lda scrtch+1
|
||
sta vcbbuf+21,x update volume control byte.
|
||
lda scrtch
|
||
sta vcbbuf+20,x
|
||
L3BAD lda vcbbuf+20,x compare total available free blocks
|
||
sec on this volume.
|
||
sbc reql
|
||
lda vcbbuf+21,x
|
||
sbc reqh
|
||
bcc L3BBE
|
||
clc
|
||
rts
|
||
|
||
L3BBE lda #MLI.E.VOLFULL
|
||
sec
|
||
L3BC1 rts
|
||
|
||
count ldy #$00
|
||
|
||
L3BC4 lda gbuf,y bit pattern.
|
||
beq L3BCC don't count
|
||
jsr cntfree
|
||
L3BCC lda gbuf+$100,y do both pages with same loop
|
||
beq L3BD4
|
||
jsr cntfree
|
||
L3BD4 iny
|
||
bne L3BC4 loop until all 512 bytes counted.
|
||
bit nofree has 1st block w/free space been found?
|
||
bpl L3BEE if yes.
|
||
lda scrtch test to see if any blocks were counted
|
||
ora scrtch+1
|
||
beq L3BEE branch if none counted.
|
||
jsr cntbms get total # of maps.
|
||
sec subtract countdown from total bitmaps
|
||
sbc bmcnt
|
||
sta nofree
|
||
L3BEE rts
|
||
|
||
cntfree asl count the # of bits in this byte
|
||
bcc L3BFA
|
||
inc scrtch
|
||
bne L3BFA
|
||
inc scrtch+1
|
||
L3BFA ora #$00
|
||
bne cntfree loop until all bits counted
|
||
rts
|
||
cntbms ldx vcbptr
|
||
ldy vcbbuf+19,x return the # of bitmaps
|
||
lda vcbbuf+18,x possible with the total count
|
||
bne L3C0B found in the vcb.
|
||
dey adj for bitmap block boundary
|
||
L3C0B tya
|
||
lsr divide by 16. the result is
|
||
lsr the # of bitmaps.
|
||
lsr
|
||
lsr
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/PRODOS.FX/PRODOS.S.XDOS.B
|
||
LOAD USR/SRC/PRODOS.FX/PRODOS.S
|
||
ASM
|