vcr now stores the volume name with a leading :. This simplifies everything (except vstrcmp)

This commit is contained in:
Kelvin Sherlock 2015-08-25 10:59:46 -04:00
parent 62726712c6
commit 51f637d4a4
4 changed files with 79 additions and 45 deletions

View File

@ -554,36 +554,44 @@ vstrcmp procname
import target:GSString32
; case-sensitive strcmp for volume name
;
; target does not have a leading :
; vcr.vname has a leading :
;
with dp
ldx #0
ldy #2
lda target.length
inc a ; + 1 for :
ldy #vcr.vname.length
lda [my_vcr],y
beq fail
cmp target.length
cmp [my_vcr],y
bne fail
tax
dex
lda #vcr.vname.text
clc
adc #vcr.vname.text-1
tya
adc target.length
tay
ldx target.length
dex
short m
@loop
lda [my_vcr],y
cmp target.text,x
lda target.text,x
cmp [my_vcr],y
bne fail8
dey
dex
bpl @loop
;success
long m
clc
rts
fail8
long m
fail

View File

@ -126,6 +126,13 @@ build_vcr procname
; for now, volume hard coded as 'minix'.
;
; todo --
; offset 128 $6502 (magic word)
; 130 (minix) volume name, terminated w/ 0
; 14 chars for minix, 30 chars for linux.
;
with v1
with dp
@ -283,7 +290,7 @@ exit
rts
default_name
str.w 'minix'
str.w ':minix'
endp

View File

@ -118,11 +118,32 @@ open_dcb_1
build_fcr proc
with dp
import target:GSString32
; use vcr.vname. this is only needed for device-relative paths, anyhow.
; can vcr be invalidated? copy vcr.vname to target, just in case.
ldy #vcr.vname.length
lda [my_vcr],y
sta target.length
ldx #0
ldy #vcr.vname.text
vcr_vname
@loop
lda [my_vcr],y
sta target.text,x
iny
iny
inx
inx
cpx target.length
bcc @loop
; build filename string...
lda #fcr.__sizeof
ldx #minix_str
ldy #^minix_str
ldx #target
ldy #^target
jsl alloc_fcr
bcc @ok
lda #out_of_mem
@ -172,7 +193,7 @@ build_fcr proc
ldx #v1_inode.__sizeof - 2
ldy #fcr.disk_inode.__end - 2
fcr_inode
@loop
lda disk_inode,x
sta [my_fcr],y
@ -185,8 +206,6 @@ build_fcr proc
clc
rts
minix_str str.w ':minix'
endp

View File

@ -213,31 +213,41 @@ do_vol_name_0 proc
sta dest+2
; length should be in the range of 1-30.
lda length
inc a
ora #'/'<<8 ; pstring
sta [dest]
lda #2
; length should be in the range of 1-30.
short m
lda length
sta [dest]
long m
lda dest
clc
adc dest
adc #1
sta dest
lda #0
adc dest+2
lda dest+2
adc #0
sta dest+2
ldy length
beq done
dey
short m
ldy length
dey
beq done
bmi exit8 ; should never happen.
@loop
lda [src],y
sta [dest],y
dey
bpl @loop
long m
bne @loop
done
; uses / as a separator
lda #'/'
sta [dest]
exit8
long m
clc
rts
@ -263,25 +273,17 @@ do_vol_name_1 procname
sbc #4
bmi error
dec a ; - 1 for leading :
cmp length
; branch after length stored...
lda length
inc a
ldy #2
sta [dest],y
; carry still set from cmp
bcc error
ldy #4
short m
lda #':'
sta [dest],y
long m
lda #5
lda #4
clc
adc dest
sta dest
@ -310,8 +312,6 @@ error
sec
rts
;defaultName str.w ':minix'
endp
end