Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/pd.asm @ 3132:9bb0c42d9fc6
Rename remaining Makefiles to makefile for consistency
author | Neal Crook <foofoobedoo@gmail.com> |
---|---|
date | Fri, 13 Jan 2017 19:52:26 +0000 |
parents | 1b7bc08e2e25 |
children |
rev | line source |
---|---|
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
1 ******************************************************************** |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
2 * p[wx]d - Print work/execution directory |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
3 * |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
4 * $Id$ |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
5 * |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1166
diff
changeset
|
6 * Edt/Rev YYYY/MM/DD Modified by |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1166
diff
changeset
|
7 * Comment |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
8 * ------------------------------------------------------------------ |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1166
diff
changeset
|
9 * 1 ????/??/?? |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1166
diff
changeset
|
10 * From Tandy OS-9 Level One VR 02.00.00. |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
11 |
2022 | 12 NAM p[wx]d |
13 TTL Print work/execution directory | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
14 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
15 * Disassembled 98/09/10 23:50:10 by Disasm v1.6 (C) 1988 by RML |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
16 |
2022 | 17 IFP1 |
18 USE defsfile | |
19 ENDC | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
20 |
2022 | 21 tylg SET Prgrm+Objct |
22 atrv SET ReEnt+rev | |
23 rev SET $00 | |
24 edition SET 1 | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
25 |
2022 | 26 MOD eom,name,tylg,atrv,start,size |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
27 |
2022 | 28 ORG 0 |
29 fildes RMB 1 | |
30 bufptr RMB 2 | |
31 dotdotfd RMB 3 LSN of .. | |
32 dotfd RMB 3 LSN of . | |
33 ddcopy RMB 5 | |
34 dentry RMB 160 | |
35 buffer RMB 1 | |
36 sttbuf RMB 282 | |
37 size EQU . | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
38 |
2022 | 39 IFNE PXD |
40 name FCS /pxd/ | |
41 ELSE | |
42 IFNE PWD | |
43 name FCS /pwd/ | |
44 ENDC | |
45 ENDC | |
46 FCB edition | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
47 |
2022 | 48 IFNE PXD |
49 badnam FCC "pxd" | |
50 ELSE | |
51 IFNE PWD | |
52 badnam FCC "pwd" | |
53 ENDC | |
54 ENDC | |
55 FCC ": bad name in path" | |
56 FCB C$CR | |
57 dotdot FCC "." | |
58 dot FCC "." | |
59 cr FCB C$CR | |
60 rdmsg FCC "read error" | |
61 FCB C$CR | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
62 |
2022 | 63 start leax buffer,u point X to buffer |
64 lda #C$CR get CR | |
65 sta ,x store at start of buffer | |
66 stx <bufptr store buffer pointer | |
67 leax dot,pcr point to '.' | |
68 bsr open open directory | |
69 sta <fildes save path | |
70 lbsr rdtwo read '.' and '..' entries | |
71 ldd <dotdotfd get 24 bit LSN of .. | |
72 std <ddcopy | |
73 lda <dotdotfd+2 | |
74 sta <ddcopy+2 and save copy | |
75 pdloop | |
76 * Inlined the atroot routine - BGP 03/09/06 | |
77 leax dotdotfd,u point X at .. entry | |
78 leay dotfd,u point Y at . entry | |
79 bsr attop check if we're at the top | |
80 beq there branch if so | |
81 leax dotdot,pcr else point to '..' | |
82 * Inlined the chdir routine - BGP 03/09/06 | |
83 IFNE PXD | |
84 lda #DIR.+EXEC.+READ. | |
85 ELSE | |
86 IFNE PWD | |
87 lda #DIR.+READ. | |
88 ENDC | |
89 ENDC | |
90 os9 I$ChgDir | |
91 lda <fildes get path to previous dir | |
92 os9 I$Close close it | |
93 bcs exit branch if error | |
94 leax dot,pcr point X to new current dir | |
95 bsr open open it | |
96 bsr rdtwo read . and .. entires of this dir | |
97 bsr findmtch search for match | |
98 bsr prsent | |
99 ldd <dotdotfd | |
100 std <ddcopy | |
101 lda <dotdotfd+2 | |
102 sta <ddcopy+2 | |
103 bra pdloop | |
104 there | |
105 * Inlined the getdevnm routine - BGP 03/09/06 | |
106 lda <fildes | |
107 ldb #SS.DevNm | |
108 leax sttbuf,u | |
109 os9 I$GetStt | |
110 bsr prsnam | |
950 | 111 |
2022 | 112 ldx <bufptr point to buffer |
113 ldy #$0081 get bytes to write | |
114 lda #$01 to stdout | |
115 os9 I$WritLn write | |
116 lda <fildes get path | |
117 os9 I$Close close | |
118 clrb | |
119 exit bra exit1 | |
950 | 120 |
2022 | 121 IFNE PXD |
122 open lda #DIR.+EXEC.+READ. | |
123 ELSE | |
124 IFNE PWD | |
125 open lda #DIR.+READ. | |
126 ENDC | |
127 ENDC | |
128 os9 I$Open | |
129 rts | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
130 |
950 | 131 * Read directory entry |
2022 | 132 readent lda <fildes |
133 leax dentry,u | |
134 ldy #DIR.SZ | |
135 os9 I$Read | |
136 rts | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
137 |
2022 | 138 findmtch lda <fildes get path to current dir |
139 bsr readent read entry | |
140 bcs cantread branch if error | |
141 leax dentry,u point to entry buffer | |
142 leax <DIR.FD,x point X to FD LSN | |
143 leay ddcopy,u point Y to copy of LSN | |
144 bsr attop compare the two | |
145 bne FindMtch keep reading until we find match | |
146 rts | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
147 |
950 | 148 * Compare 3 bytes at X and Y |
2022 | 149 attop ldd ,x++ |
150 cmpd ,y++ | |
151 bne L00C5 | |
152 lda ,x | |
153 cmpa ,y | |
154 L00C5 rts | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
155 |
2022 | 156 rdtwo bsr readent * read "." from directory |
157 ldd <dentry+DIR.FD | |
158 std <dotfd | |
159 lda <dentry+DIR.FD+2 | |
160 sta <dotfd+2 | |
161 bsr readent * read ".." from directory | |
162 ldd <dentry+DIR.FD | |
163 std <dotdotfd | |
164 lda <dentry+DIR.FD+2 | |
165 sta <dotdotfd+2 | |
166 rts | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
167 |
950 | 168 * Get name from directory entry |
2022 | 169 prsent leax dentry,u |
170 prsnam os9 F$PrsNam | |
171 bcs IlglName | |
172 ldx <bufptr | |
173 prsloop lda ,-y | |
174 anda #$7F mask hi bit | |
175 sta ,-x save | |
176 decb | |
177 bne prsloop | |
178 lda #PDELIM | |
179 sta ,-x | |
180 stx <bufptr | |
181 rts | |
950 | 182 |
2022 | 183 IlglName leax badnam,pcr |
184 bra wrerr | |
950 | 185 |
2022 | 186 cantread leax rdmsg,pcr |
187 wrerr lda #$02 | |
188 os9 I$WritLn | |
189 exit1 os9 F$Exit | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
190 |
2022 | 191 EMOD |
192 eom EQU * | |
193 END | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
194 |