changeset 1452:32b27b6792b6

fprsnam.asm has been back-ported from Level 2
author boisy
date Thu, 11 Dec 2003 23:00:04 +0000
parents 3e5e54b2a01a
children 5dbf908c1483
files level1/modules/kernel.asm level1/modules/kernel/fprsnam.asm
diffstat 2 files changed, 184 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/level1/modules/kernel.asm	Thu Dec 11 22:59:15 2003 +0000
+++ b/level1/modules/kernel.asm	Thu Dec 11 23:00:04 2003 +0000
@@ -688,7 +688,8 @@
          bsr   EatSpace
          cmpa  #PDELIM                 pathlist char?
          beq   L049C                   branch if so
-         lbsr  L074D                   parse name
+*         lbsr  L074D                   parse name
+         lbsr  ParseNam                parse name
          bcs   L049D                   return if error
          ldu   <D.ModDir
 L045B    pshs  u,y,b
@@ -1079,62 +1080,64 @@
 L073B    leas  $05,s
          puls  pc,u,y,x,b,a
 
-FPrsNam  ldx   R$X,u
-         bsr   L074D
-         std   R$D,u
-         bcs   L0749
-         stx   R$X,u
-L0749    sty   R$Y,u
-         rts
-L074D    lda   ,x
-         cmpa  #PDELIM                 pathlist char?
-         bne   L0755                   branch if not
-         leax  1,x                     go past pathlist char
-L0755    leay  ,x
-         clrb
-         lda   ,y+
-         anda  #$7F
-         bsr   L0792
-         bcs   L0772
-L0760    incb
-         lda   -1,y
-         bmi   L076F                   hi bit set on this char, done
-         lda   ,y+
-         anda  #$7F
-         bsr   IllChar
-         bcc   L0760
-         lda   ,-y
-L076F    andcc #^Carry
-         rts
-L0772    cmpa  #C$COMA                 comma?
-         bne   L0778
-L0776    lda   ,y+
-L0778    cmpa  #C$SPAC                 space?
-         beq   L0776
-         lda   ,-y
-         comb
-         ldb   #E$BNam
-         rts
+         
+         use   krnl/fprsnam.asm
+*FPrsNam  ldx   R$X,u
+*         bsr   L074D
+*         std   R$D,u
+*         bcs   L0749
+*         stx   R$X,u
+*L0749    sty   R$Y,u
+*         rts
+*L074D    lda   ,x
+*         cmpa  #PDELIM                 pathlist char?
+*         bne   L0755                   branch if not
+*         leax  1,x                     go past pathlist char
+*L0755    leay  ,x
+*         clrb
+*         lda   ,y+
+*         anda  #$7F
+*         bsr   L0792
+*         bcs   L0772
+*L0760    incb
+*         lda   -1,y
+*         bmi   L076F                   hi bit set on this char, done
+*         lda   ,y+
+*         anda  #$7F
+*         bsr   IllChar
+*         bcc   L0760
+*         lda   ,-y
+*L076F    andcc #^Carry
+*         rts
+*L0772    cmpa  #C$COMA                 comma?
+*         bne   L0778
+*L0776    lda   ,y+
+*L0778    cmpa  #C$SPAC                 space?
+*         beq   L0776
+*         lda   ,-y
+*         comb
+*         ldb   #E$BNam
+*         rts
 
 * check for illegal characters in a pathlist
-IllChar  cmpa  #C$PERD                 period?
-         beq   L07C9                   branch if so
-         cmpa  #'0                     zero?
-         bcs   L07A2                   branch if less than
-         cmpa  #'9                     number?
-         bls   L07C9                   branch if lower/same
-         cmpa  #'_                     underscore?
-         beq   L07C9                   branch if so
-L0792    cmpa  #'A                     A?
-         bcs   L07A2                   branch if less than
-         cmpa  #'Z                     Z?
-         bls   L07C9                   branch if less or equal
-         cmpa  #'a                     a?
-         bcs   L07A2                   branch if lower
-         cmpa  #'z                     z?
-         bls   L07C9                   branch if less or equal
-L07A2    orcc  #Carry
-         rts
+*IllChar  cmpa  #C$PERD                 period?
+*         beq   L07C9                   branch if so
+*         cmpa  #'0                     zero?
+*         bcs   L07A2                   branch if less than
+*         cmpa  #'9                     number?
+*         bls   L07C9                   branch if lower/same
+*         cmpa  #'_                     underscore?
+*         beq   L07C9                   branch if so
+*L0792    cmpa  #'A                     A?
+*         bcs   L07A2                   branch if less than
+*         cmpa  #'Z                     Z?
+*         bls   L07C9                   branch if less or equal
+*         cmpa  #'a                     a?
+*         bcs   L07A2                   branch if lower
+*         cmpa  #'z                     z?
+*         bls   L07C9                   branch if less or equal
+*L07A2    orcc  #Carry
+*         rts
 
 FCmpNam  ldb   R$B,u
          leau  R$X,u
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/level1/modules/kernel/fprsnam.asm	Thu Dec 11 23:00:04 2003 +0000
@@ -0,0 +1,126 @@
+**************************************************
+* System Call: F$PrsNam
+*
+* Function: Parse a path name
+*
+* Modification to allow '-' in filenames by WG
+*
+* Input:  X = Address of pathlist
+*
+* Output: X = Updated past optional "/" character
+*         Y = Address of last character of pathlist + 1
+*         B = Length of pathlist
+*
+* Error:  CC = C bit set; B = error code
+*
+FPrsNam  equ   *
+         IFGT  Level-1
+         ldx   <D.Proc		proc desc
+         leay  <P$DATImg,x	Y=DAT image ptr
+         ENDC
+         ldx   R$X,u		X=name string
+         bsr   ParseNam		get it and length
+         std   R$D,u		return length in D
+         bcs   L073E		..err
+         stx   R$X,u		and X at name begin
+         abx			plus len
+L073E    stx   R$Y,u		return Y=end of name ptr
+         rts			end.
+
+* Parse name
+ParseNam equ   *
+         IFGT  Level-1
+         pshs  y		save DAT image pointer
+         lbsr  AdjBlk0		go find map block...
+         pshs  x,y		save X offset within block and Y block pointer
+         bsr   GoGetAXY		go get byte at X in block Y...
+         ELSE
+         pshs  x		save X offset
+         lda   ,x+
+         ENDC
+         cmpa  #'.		is the first character a period?
+         bne   IsSlash		no, do proper first character checking
+         IFGT  Level-1
+         lbsr  L0AC8		do a LDAXY, without changing X or Y
+         ELSE
+         lda   ,x
+         ENDC
+         bsr   ChkFirst		is the next character non-period?
+         lda   #'.		restore the period character the LDAXY destroyed
+         bcc   Do.Loop		if NON-period character, skip 1st char checks
+
+IsSlash  cmpa  #PDELIM		is it a slash?
+         bne   NotSlash		no, go keep X offset and block Y...
+         bsr   GetChar		go get character...
+NotSlash bsr   ChkFirst		go check if valid first character...
+         bcs   NotValid		not valid, go get next name start offset in X...
+Do.Loop  clrb			initialize character counter
+LastLoop incb			add one character
+         tsta			last character in name string?
+         bmi   LastChar		yes, go return valid...
+         IFGT  Level-1
+         bsr   GoGetAXY		go get next character...
+         ELSE
+         lda   ,x+
+         ENDC
+         bsr   ChkValid		go check if valid character...
+         bcc   LastLoop		valid, go check if last character...
+LastChar andcc #^Carry
+         bra   RtnValid
+
+GetChar
+         stx   2,s          save current offset over old offset
+         IFGT  Level-1
+         sty   4,s          save current block pointer over old block pointer
+GoGetAXY lbra  LDAXY        go get byte at X in block Y in A,  & return
+         ELSE
+         lda   ,x+
+         rts
+         ENDC
+
+NextLoop bsr   GetChar      go get character...
+NotValid cmpa  #',          comma?
+         beq   NextLoop     yes, go get next character...
+         cmpa  #C$SPAC      space?
+         beq   NextLoop     yes, go get next character...
+         comb               error, set Carry
+         ldb   #E$BNam      'Bad Name' error
+RtnValid equ   *
+         IFGT  Level-1
+         puls  x,y          recover offset & pointer
+         bra   L0720        go do a similar exit routine
+         ELSE
+         puls  x            recover offset
+         rts
+         ENDC
+
+ChkFirst pshs  a            save character
+         anda  #$7F         drop msbit
+         bra   ChkRst       skip dash for first character check
+
+* Determine if character in A is a valid filename character
+ChkValid pshs  a            save character
+         anda  #$7F         drop msbit
+         cmpa  #'.          period?
+         beq   ValidChr     yes, go return valid character...
+ChkRest  cmpa  #'-          is it a dash?
+         beq   ValidChr     yes, it's valid      
+ChkRst   cmpa  #'z          greater than "z"?
+         bhi   InvalidC     yes, go return invalid character...
+         cmpa  #'a          greater than or equal to "a"?
+         bhs   ValidChr     yes, go return valid character...
+         cmpa  #'_          underscore?
+         beq   ValidChr     yes, go return valid character...
+         cmpa  #'Z          greater than "Z"?
+         bhi   InvalidC     yes, go return invalid character...
+         cmpa  #'A          greater than or equal to "A"?
+         bhs   ValidChr     yes, go return valid character...
+         cmpa  #'9          greater than "9"?
+         bhi   InvalidC     yes, go return invalid character...
+         cmpa  #'0          greater than or equal to "0"?
+         bhs   ValidChr     yes, go return valid character...
+         cmpa  #'$          dollar symbol?
+         beq   ValidChr     yes, go return valid character...
+InvalidC coma               invalid character, set carry
+ValidChr puls  a,pc
+