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

View File

@ -126,6 +126,13 @@ build_vcr procname
; for now, volume hard coded as 'minix'. ; 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 v1
with dp with dp
@ -283,7 +290,7 @@ exit
rts rts
default_name default_name
str.w 'minix' str.w ':minix'
endp endp

View File

@ -118,11 +118,32 @@ open_dcb_1
build_fcr proc build_fcr proc
with dp 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... ; build filename string...
lda #fcr.__sizeof lda #fcr.__sizeof
ldx #minix_str ldx #target
ldy #^minix_str ldy #^target
jsl alloc_fcr jsl alloc_fcr
bcc @ok bcc @ok
lda #out_of_mem lda #out_of_mem
@ -172,7 +193,7 @@ build_fcr proc
ldx #v1_inode.__sizeof - 2 ldx #v1_inode.__sizeof - 2
ldy #fcr.disk_inode.__end - 2 ldy #fcr.disk_inode.__end - 2
fcr_inode
@loop @loop
lda disk_inode,x lda disk_inode,x
sta [my_fcr],y sta [my_fcr],y
@ -185,8 +206,6 @@ build_fcr proc
clc clc
rts rts
minix_str str.w ':minix'
endp endp

View File

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