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