Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/kernel/fprsnam.asm @ 3109:118cd9951d24
Small fixups in level 3 boot script
And add it and the boot list to the coco3 build.
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sun, 28 Feb 2016 22:48:32 +0100 |
parents | e09712b0cad1 |
children |
rev | line source |
---|---|
1452 | 1 ************************************************** |
2 * System Call: F$PrsNam | |
3 * | |
4 * Function: Parse a path name | |
5 * | |
6 * Modification to allow '-' in filenames by WG | |
7 * | |
8 * Input: X = Address of pathlist | |
9 * | |
10 * Output: X = Updated past optional "/" character | |
11 * Y = Address of last character of pathlist + 1 | |
12 * B = Length of pathlist | |
13 * | |
14 * Error: CC = C bit set; B = error code | |
15 * | |
16 IFGT Level-1 | |
1458
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
17 |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
18 FPrsNam ldx <D.Proc proc desc |
1452 | 19 leay <P$DATImg,x Y=DAT image ptr |
20 ldx R$X,u X=name string | |
21 bsr ParseNam get it and length | |
22 std R$D,u return length in D | |
23 bcs L073E ..err | |
24 stx R$X,u and X at name begin | |
25 abx plus len | |
26 L073E stx R$Y,u return Y=end of name ptr | |
27 rts end. | |
28 | |
29 * Parse name | |
30 ParseNam equ * | |
31 pshs y save DAT image pointer | |
32 lbsr AdjBlk0 go find map block... | |
33 pshs x,y save X offset within block and Y block pointer | |
34 bsr GoGetAXY go get byte at X in block Y... | |
35 cmpa #'. is the first character a period? | |
36 bne IsSlash no, do proper first character checking | |
37 lbsr L0AC8 do a LDAXY, without changing X or Y | |
38 bsr ChkFirst is the next character non-period? | |
39 lda #'. restore the period character the LDAXY destroyed | |
40 bcc Do.Loop if NON-period character, skip 1st char checks | |
41 | |
42 IsSlash cmpa #PDELIM is it a slash? | |
43 bne NotSlash no, go keep X offset and block Y... | |
44 bsr GetChar go get character... | |
45 NotSlash bsr ChkFirst go check if valid first character... | |
46 bcs NotValid not valid, go get next name start offset in X... | |
47 Do.Loop clrb initialize character counter | |
48 LastLoop incb add one character | |
49 tsta last character in name string? | |
50 bmi LastChar yes, go return valid... | |
51 bsr GoGetAXY go get next character... | |
52 bsr ChkValid go check if valid character... | |
53 bcc LastLoop valid, go check if last character... | |
54 LastChar andcc #^Carry | |
55 bra RtnValid | |
56 | |
57 GetChar | |
58 stx 2,s save current offset over old offset | |
59 sty 4,s save current block pointer over old block pointer | |
60 GoGetAXY lbra LDAXY go get byte at X in block Y in A, & return | |
61 | |
62 NextLoop bsr GetChar go get character... | |
63 NotValid cmpa #', comma? | |
64 beq NextLoop yes, go get next character... | |
65 cmpa #C$SPAC space? | |
66 beq NextLoop yes, go get next character... | |
67 comb error, set Carry | |
68 ldb #E$BNam 'Bad Name' error | |
69 RtnValid equ * | |
70 puls x,y recover offset & pointer | |
71 bra L0720 go do a similar exit routine | |
72 | |
73 ChkFirst pshs a save character | |
74 anda #$7F drop msbit | |
75 bra ChkRst skip dash for first character check | |
76 | |
77 * Determine if character in A is a valid filename character | |
78 ChkValid pshs a save character | |
79 anda #$7F drop msbit | |
80 cmpa #'. period? | |
81 beq ValidChr yes, go return valid character... | |
82 ChkRest cmpa #'- is it a dash? | |
83 beq ValidChr yes, it's valid | |
84 ChkRst cmpa #'z greater than "z"? | |
85 bhi InvalidC yes, go return invalid character... | |
86 cmpa #'a greater than or equal to "a"? | |
87 bhs ValidChr yes, go return valid character... | |
88 cmpa #'_ underscore? | |
89 beq ValidChr yes, go return valid character... | |
90 cmpa #'Z greater than "Z"? | |
91 bhi InvalidC yes, go return invalid character... | |
92 cmpa #'A greater than or equal to "A"? | |
93 bhs ValidChr yes, go return valid character... | |
94 cmpa #'9 greater than "9"? | |
95 bhi InvalidC yes, go return invalid character... | |
96 cmpa #'0 greater than or equal to "0"? | |
97 bhs ValidChr yes, go return valid character... | |
98 cmpa #'$ dollar symbol? | |
99 beq ValidChr yes, go return valid character... | |
100 InvalidC coma invalid character, set carry | |
101 ValidChr puls a,pc | |
102 | |
1458
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
103 ELSE |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
104 |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
105 FPrsNam ldx R$X,u |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
106 bsr ParseNam |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
107 std R$D,u |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
108 bcs L0749 |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
109 stx R$X,u |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
110 L0749 sty R$Y,u |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
111 rts |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
112 ParseNam lda ,x |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
113 cmpa #PDELIM pathlist char? |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
114 bne L0755 branch if not |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
115 leax 1,x go past pathlist char |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
116 L0755 leay ,x |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
117 clrb |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
118 lda ,y+ |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
119 anda #$7F |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
120 bsr ChkRest |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
121 bcs L0772 |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
122 L0760 incb |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
123 lda -1,y |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
124 bmi L076F hi bit set on this char, done |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
125 lda ,y+ |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
126 anda #$7F |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
127 bsr ChkFirst |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
128 bcc L0760 |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
129 lda ,-y |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
130 L076F andcc #^Carry |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
131 rts |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
132 L0772 cmpa #C$COMA comma? |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
133 bne L0778 |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
134 L0776 lda ,y+ |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
135 L0778 cmpa #C$SPAC space? |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
136 beq L0776 |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
137 lda ,-y |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
138 comb |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
139 ldb #E$BNam |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
140 rts |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
141 |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
142 * check for illegal characters in a pathlist |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
143 ChkFirst cmpa #C$PERD period? |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
144 beq L07C9 branch if so |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
145 ChkRest cmpa #'0 zero? |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
146 bcs L07A2 branch if less than |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
147 cmpa #'9 number? |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
148 bls L07C9 branch if lower/same |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
149 cmpa #'_ underscore? |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
150 beq L07C9 branch if so |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
151 cmpa #'A A? |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
152 bcs L07A2 branch if less than |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
153 cmpa #'Z Z? |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
154 bls L07C9 branch if less or equal |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
155 cmpa #'a a? |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
156 bcs L07A2 branch if lower |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
157 cmpa #'z z? |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
158 bls L07C9 branch if less or equal |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
159 L07A2 orcc #Carry |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
160 rts |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
161 |
e09712b0cad1
Reverted back to Level 1 F$PrsNam, fixed to allow _ and 0-9 as first chars
boisy
parents:
1452
diff
changeset
|
162 ENDC |