Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/pd.asm @ 1211:f54f04a78c54
Rodney Hamilton fixes
author | boisy |
---|---|
date | Mon, 23 Jun 2003 17:45:27 +0000 |
parents | bb618bed0bdc |
children | 84ea83668304 |
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 * |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
6 * Ed. Comments Who YY/MM/DD |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
7 * ------------------------------------------------------------------ |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
8 * 1 From Tandy OS-9 Level One VR 02.00.00 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
9 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
10 nam p[wx]d |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
11 ttl Print work/execution directory |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
12 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
13 * 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
|
14 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
15 ifp1 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
16 use defsfile |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
17 use rbfdefs |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
18 endc |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
19 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
20 tylg set Prgrm+Objct |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
21 atrv set ReEnt+rev |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
22 rev set $01 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
23 edition set 1 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
24 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
25 mod eom,name,tylg,atrv,start,size |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
26 |
924 | 27 org 0 |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
28 fildes rmb 1 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
29 bufptr rmb 2 |
950 | 30 dotdotfd rmb 3 LSN of .. |
31 dotfd rmb 3 LSN of . | |
924 | 32 ddcopy rmb 5 |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
33 dentry rmb 160 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
34 buffer rmb 1 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
35 sttbuf rmb 282 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
36 size equ . |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
37 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
38 IFNE PXD |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
39 name fcs /pxd/ |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
40 ELSE |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
41 IFNE PWD |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
42 name fcs /pwd/ |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
43 ENDC |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
44 ENDC |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
45 fcb edition |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
46 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
47 IFNE PXD |
1166 | 48 badnam fcc "pxd" |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
49 ELSE |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
50 IFNE PWD |
1166 | 51 badnam fcc "pwd" |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
52 ENDC |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
53 ENDC |
1166 | 54 fcc ": bad name in path" |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
55 fcb C$CR |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
56 dotdot fcc "." |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
57 dot fcc "." |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
58 cr fcb C$CR |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
59 rdmsg fcc "read error" |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
60 fcb C$CR |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
61 |
950 | 62 start leax >buffer,u point X to buffer |
63 lda #C$CR get CR | |
64 sta ,x store at start of buffer | |
65 stx <bufptr store buffer pointer | |
66 leax >dot,pcr point to '.' | |
67 bsr open open directory | |
68 sta <fildes save path | |
69 lbsr rdtwo read '.' and '..' entries | |
70 ldd <dotdotfd get 24 bit LSN of .. | |
924 | 71 std <ddcopy |
72 lda <dotdotfd+2 | |
950 | 73 sta <ddcopy+2 and save copy |
74 L0052 bsr AtRoot are we at root? | |
75 beq L0079 branch if so | |
76 leax >dotdot,pcr else point to '..' | |
77 bsr chdir change directory | |
78 lda <fildes get path to previous dir | |
79 os9 I$Close close it | |
80 bcs Exit branch if error | |
81 leax >dot,pcr point X to new current dir | |
82 bsr open open it | |
83 bsr rdtwo read . and .. entires of this dir | |
84 bsr FindMtch search for match | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
85 bsr L00E2 |
924 | 86 ldd <dotdotfd |
87 std <ddcopy | |
88 lda <dotdotfd+2 | |
89 sta <ddcopy+2 | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
90 bra L0052 |
950 | 91 L0079 lbsr GetDevNm get device name |
92 ldx <bufptr point to buffer | |
93 ldy #$0081 get bytes to write | |
94 lda #$01 to stdout | |
95 os9 I$WritLn write | |
96 lda <fildes get path | |
97 os9 I$Close close | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
98 clrb |
950 | 99 Exit os9 F$Exit and exit |
100 | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
101 IFNE PXD |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
102 chdir lda #DIR.+EXEC.+READ. |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
103 ELSE |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
104 IFNE PWD |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
105 chdir lda #DIR.+READ. |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
106 ENDC |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
107 ENDC |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
108 os9 I$ChgDir |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
109 rts |
950 | 110 |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
111 IFNE PXD |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
112 open lda #DIR.+EXEC.+READ. |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
113 ELSE |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
114 IFNE PWD |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
115 open lda #DIR.+READ. |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
116 ENDC |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
117 ENDC |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
118 os9 I$Open |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
119 rts |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
120 |
950 | 121 * Read directory entry |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
122 read32 lda <fildes |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
123 leax dentry,u |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
124 ldy #DIR.SZ |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
125 os9 I$Read |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
126 rts |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
127 |
950 | 128 FindMtch lda <fildes get path to current dir |
129 bsr read32 read entry | |
130 bcs CantRead branch if error | |
131 leax dentry,u point to entry buffer | |
132 leax <DIR.FD,x point X to FD LSN | |
133 leay ddcopy,u point Y to copy of LSN | |
134 bsr attop compare the two | |
135 bne FindMtch keep reading until we find match | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
136 rts |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
137 |
950 | 138 * Compare 3 bytes at X and Y |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
139 attop ldd ,x++ |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
140 cmpd ,y++ |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
141 bne L00C5 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
142 lda ,x |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
143 cmpa ,y |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
144 L00C5 rts |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
145 |
950 | 146 AtRoot leax dotdotfd,u point X at .. entry |
147 leay dotfd,u point Y at . entry | |
148 bsr attop check if we're at the top | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
149 rts |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
150 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
151 rdtwo bsr read32 * read "." from directory |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
152 ldd <dentry+DIR.FD |
924 | 153 std <dotfd |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
154 lda <dentry+DIR.FD+2 |
924 | 155 sta <dotfd+2 |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
156 bsr read32 * read ".." from directory |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
157 ldd <dentry+DIR.FD |
924 | 158 std <dotdotfd |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
159 lda <dentry+DIR.FD+2 |
924 | 160 sta <dotdotfd+2 |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
161 rts |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
162 |
950 | 163 * Get name from directory entry |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
164 L00E2 leax dentry,u |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
165 prsnam os9 F$PrsNam |
950 | 166 bcs IlglName |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
167 ldx <bufptr |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
168 L00EB lda ,-y |
950 | 169 anda #$7F mask hi bit |
170 sta ,-x save | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
171 decb |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
172 bne L00EB |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
173 lda #PDELIM |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
174 sta ,-x |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
175 stx <bufptr |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
176 rts |
950 | 177 |
178 GetDevNm lda <fildes | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
179 ldb #SS.DevNm |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
180 leax >sttbuf,u |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
181 os9 I$GetStt |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
182 bsr prsnam |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
183 rts |
950 | 184 |
185 IlglName leax >badnam,pcr | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
186 bra wrerr |
950 | 187 |
188 CantRead leax >rdmsg,pcr | |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
189 wrerr lda #$02 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
190 os9 I$WritLn |
950 | 191 os9 F$Exit |
689
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
192 |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
193 emod |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
194 eom equ * |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
195 end |
92b575ffa143
Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff
changeset
|
196 |