mirror of
https://github.com/ksherlock/minix.fst.git
synced 2024-12-27 06:29:15 +00:00
313 lines
3.5 KiB
Plaintext
313 lines
3.5 KiB
Plaintext
include 'gsos.equ'
|
|
include 'minix.equ'
|
|
include 'records.equ'
|
|
|
|
include 'fst.equ'
|
|
|
|
include 'fst.macros'
|
|
|
|
include 'M16.Debug'
|
|
|
|
|
|
;
|
|
; VolumeGS / Volume call.
|
|
;
|
|
; check if the disk is ours. create a VCR or mark it active.
|
|
;
|
|
|
|
import id_disk
|
|
|
|
my_dp record dp.__end
|
|
|
|
src ds.l 1
|
|
dest ds.l 1
|
|
length ds.w 1
|
|
|
|
IF *>=$d4 THEN
|
|
AERROR 'dp -- too large.'
|
|
ENDIF
|
|
|
|
endr
|
|
|
|
import do_file_sys_id
|
|
import do_ignore
|
|
|
|
entry do_block_size
|
|
entry do_free_blocks
|
|
entry do_total_blocks
|
|
entry do_vol_name_0
|
|
entry do_vol_name_1
|
|
|
|
volume procname export
|
|
|
|
with dp
|
|
with dev_parms
|
|
with fst_parms
|
|
|
|
stz tool_error
|
|
|
|
lda fst_parms.dev1_num
|
|
; if no device, find a volume by name...
|
|
beq no_dev
|
|
|
|
jsr id_disk
|
|
bcc got_it
|
|
cmp #dup_volume
|
|
beq dup
|
|
sec
|
|
rtl
|
|
|
|
dup
|
|
; this is a duplicate volume.
|
|
; return the name (and only the name), but also return the error.
|
|
|
|
lda <call_class
|
|
beq dup_0
|
|
|
|
dup_1
|
|
ldy #VolumeRecGS.volName
|
|
jsr do_vol_name_1
|
|
bcs exit
|
|
lda #dup_volume
|
|
bra exit
|
|
|
|
dup_0
|
|
ldy #VolumeRec.volName
|
|
jsr do_vol_name_0
|
|
bcs exit
|
|
lda #dup_volume
|
|
bra exit
|
|
|
|
|
|
got_it
|
|
|
|
; init common volume name parameters here...
|
|
with my_dp
|
|
ldy #vcr.vname.length
|
|
lda [my_vcr],y
|
|
sta length
|
|
|
|
lda #vcr.vname.text
|
|
clc
|
|
adc my_vcr
|
|
sta src
|
|
lda #0
|
|
adc my_vcr+2
|
|
sta src+2
|
|
endwith
|
|
|
|
lda <call_class
|
|
beq class0
|
|
|
|
|
|
class1
|
|
lda [param_blk_ptr] ; pcount
|
|
dec a
|
|
asl a ; x 2
|
|
asl a ; x 4
|
|
tax
|
|
dispatch volume_dcb_1
|
|
lda tool_error
|
|
cmp #1
|
|
rtl
|
|
|
|
class0
|
|
ldx #volume_dcb_0_size-4
|
|
dispatch volume_dcb_0
|
|
lda tool_error
|
|
|
|
exit
|
|
cmp #1
|
|
rtl
|
|
|
|
|
|
no_dev
|
|
lda #unknown_vol
|
|
sec
|
|
rtl
|
|
|
|
volume_dcb_0
|
|
with VolumeRec
|
|
dc.w deviceName, do_ignore
|
|
dc.w volName, do_vol_name_0
|
|
dc.w totalBlocks, do_total_blocks
|
|
dc.w freeBlocks, do_free_blocks
|
|
dc.w fileSysID, do_file_sys_id
|
|
endwith
|
|
volume_dcb_0_size equ *-volume_dcb_0
|
|
|
|
volume_dcb_1
|
|
with VolumeRecGS
|
|
dc.w devName, do_ignore
|
|
dc.w volName, do_vol_name_1
|
|
dc.w totalBlocks, do_total_blocks
|
|
dc.w freeBlocks, do_free_blocks
|
|
dc.w fileSysID, do_file_sys_id
|
|
dc.w blockSize, do_block_size
|
|
dc.w characteristics, do_ignore
|
|
dc.w deviceID, do_ignore
|
|
endwith
|
|
endp
|
|
|
|
|
|
|
|
do_block_size proc
|
|
|
|
with dp
|
|
with fst_parms
|
|
|
|
lda #1024
|
|
sta [param_blk_ptr],y
|
|
rts
|
|
endp
|
|
|
|
do_total_blocks proc
|
|
; total blocks = nzones.
|
|
|
|
; should this ask the driver?
|
|
|
|
with dp
|
|
with fst_parms
|
|
|
|
phy ; save
|
|
|
|
ldy #vcr.super.nzones
|
|
lda [my_vcr],y
|
|
|
|
ply
|
|
sta [param_blk_ptr],y
|
|
rts
|
|
|
|
endp
|
|
|
|
|
|
do_free_blocks proc
|
|
; load the zmaps and count them up...
|
|
; someday.
|
|
with fst_parms
|
|
|
|
lda #0
|
|
sta [param_blk_ptr],y
|
|
rts
|
|
endp
|
|
|
|
do_vol_name_0 proc
|
|
; store the volume name (class 0)
|
|
|
|
with fst_parms
|
|
with dp, my_dp
|
|
|
|
; length and src are valid.
|
|
|
|
lda [param_blk_ptr],y
|
|
sta dest
|
|
iny
|
|
iny
|
|
lda [param_blk_ptr],y
|
|
sta dest+2
|
|
|
|
|
|
|
|
|
|
; length should be in the range of 1-30.
|
|
short m
|
|
lda length
|
|
sta [dest]
|
|
long m
|
|
|
|
lda dest
|
|
clc
|
|
adc #1
|
|
sta dest
|
|
lda dest+2
|
|
adc #0
|
|
sta dest+2
|
|
|
|
|
|
short m
|
|
ldy length
|
|
dey
|
|
beq done
|
|
bmi exit8 ; should never happen.
|
|
@loop
|
|
lda [src],y
|
|
sta [dest],y
|
|
dey
|
|
bne @loop
|
|
done
|
|
; uses / as a separator
|
|
lda #'/'
|
|
sta [dest]
|
|
|
|
exit8
|
|
long m
|
|
|
|
clc
|
|
rts
|
|
|
|
endp
|
|
|
|
do_vol_name_1 procname
|
|
|
|
with fst_parms
|
|
with dp, my_dp
|
|
|
|
|
|
lda [param_blk_ptr],y
|
|
sta dest
|
|
iny
|
|
iny
|
|
lda [param_blk_ptr],y
|
|
sta dest+2
|
|
|
|
|
|
; check the length.
|
|
lda [dest]
|
|
sec
|
|
sbc #4
|
|
bmi error
|
|
|
|
cmp length
|
|
; branch after length stored...
|
|
|
|
lda length
|
|
ldy #2
|
|
sta [dest],y
|
|
|
|
; carry still set from cmp
|
|
bcc error
|
|
|
|
lda #4
|
|
clc
|
|
adc dest
|
|
sta dest
|
|
lda #0
|
|
adc dest+2
|
|
sta dest+2
|
|
|
|
ldy length
|
|
beq done
|
|
dey
|
|
short m
|
|
@loop
|
|
lda [src],y
|
|
sta [dest],y
|
|
dey
|
|
bpl @loop
|
|
long m
|
|
done
|
|
clc
|
|
rts
|
|
|
|
|
|
error
|
|
lda #buff_too_small
|
|
sta tool_error
|
|
sec
|
|
rts
|
|
|
|
endp
|
|
|
|
end
|
|
|