annotate level1/cmds/pd.asm @ 2022:1b7bc08e2e25

minor optimizations
author boisy
date Tue, 14 Mar 2006 04:08:56 +0000
parents 20841f236e32
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
12 NAM p[wx]d
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
17 IFP1
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
18 USE defsfile
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
21 tylg SET Prgrm+Objct
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
22 atrv SET ReEnt+rev
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
23 rev SET $00
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
28 ORG 0
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
29 fildes RMB 1
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
30 bufptr RMB 2
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
31 dotdotfd RMB 3 LSN of ..
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
32 dotfd RMB 3 LSN of .
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
33 ddcopy RMB 5
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
34 dentry RMB 160
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
35 buffer RMB 1
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
36 sttbuf RMB 282
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
39 IFNE PXD
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
40 name FCS /pxd/
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
41 ELSE
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
42 IFNE PWD
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
43 name FCS /pwd/
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
44 ENDC
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
45 ENDC
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
48 IFNE PXD
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
49 badnam FCC "pxd"
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
50 ELSE
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
51 IFNE PWD
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
52 badnam FCC "pwd"
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
53 ENDC
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
54 ENDC
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
55 FCC ": bad name in path"
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
56 FCB C$CR
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
57 dotdot FCC "."
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
58 dot FCC "."
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
59 cr FCB C$CR
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
60 rdmsg FCC "read error"
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
63 start leax buffer,u point X to buffer
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
64 lda #C$CR get CR
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
65 sta ,x store at start of buffer
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
66 stx <bufptr store buffer pointer
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
67 leax dot,pcr point to '.'
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
68 bsr open open directory
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
69 sta <fildes save path
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
70 lbsr rdtwo read '.' and '..' entries
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
71 ldd <dotdotfd get 24 bit LSN of ..
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
72 std <ddcopy
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
73 lda <dotdotfd+2
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
74 sta <ddcopy+2 and save copy
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
75 pdloop
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
76 * Inlined the atroot routine - BGP 03/09/06
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
77 leax dotdotfd,u point X at .. entry
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
78 leay dotfd,u point Y at . entry
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
79 bsr attop check if we're at the top
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
80 beq there branch if so
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
81 leax dotdot,pcr else point to '..'
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
82 * Inlined the chdir routine - BGP 03/09/06
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
83 IFNE PXD
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
84 lda #DIR.+EXEC.+READ.
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
85 ELSE
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
86 IFNE PWD
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
87 lda #DIR.+READ.
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
88 ENDC
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
89 ENDC
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
90 os9 I$ChgDir
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
91 lda <fildes get path to previous dir
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
92 os9 I$Close close it
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
93 bcs exit branch if error
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
94 leax dot,pcr point X to new current dir
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
95 bsr open open it
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
96 bsr rdtwo read . and .. entires of this dir
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
97 bsr findmtch search for match
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
98 bsr prsent
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
99 ldd <dotdotfd
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
100 std <ddcopy
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
101 lda <dotdotfd+2
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
102 sta <ddcopy+2
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
103 bra pdloop
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
104 there
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
105 * Inlined the getdevnm routine - BGP 03/09/06
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
106 lda <fildes
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
107 ldb #SS.DevNm
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
108 leax sttbuf,u
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
109 os9 I$GetStt
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
110 bsr prsnam
950
dbf9a6e913f4 Removed seemlingly useless code
boisy
parents: 924
diff changeset
111
2022
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
112 ldx <bufptr point to buffer
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
113 ldy #$0081 get bytes to write
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
114 lda #$01 to stdout
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
115 os9 I$WritLn write
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
116 lda <fildes get path
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
117 os9 I$Close close
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
118 clrb
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
119 exit bra exit1
950
dbf9a6e913f4 Removed seemlingly useless code
boisy
parents: 924
diff changeset
120
2022
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
121 IFNE PXD
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
122 open lda #DIR.+EXEC.+READ.
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
123 ELSE
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
124 IFNE PWD
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
125 open lda #DIR.+READ.
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
126 ENDC
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
127 ENDC
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
128 os9 I$Open
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
dbf9a6e913f4 Removed seemlingly useless code
boisy
parents: 924
diff changeset
131 * Read directory entry
2022
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
132 readent lda <fildes
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
133 leax dentry,u
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
134 ldy #DIR.SZ
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
135 os9 I$Read
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
138 findmtch lda <fildes get path to current dir
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
139 bsr readent read entry
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
140 bcs cantread branch if error
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
141 leax dentry,u point to entry buffer
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
142 leax <DIR.FD,x point X to FD LSN
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
143 leay ddcopy,u point Y to copy of LSN
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
144 bsr attop compare the two
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
145 bne FindMtch keep reading until we find match
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
dbf9a6e913f4 Removed seemlingly useless code
boisy
parents: 924
diff changeset
148 * Compare 3 bytes at X and Y
2022
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
149 attop ldd ,x++
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
150 cmpd ,y++
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
151 bne L00C5
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
152 lda ,x
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
153 cmpa ,y
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
156 rdtwo bsr readent * read "." from directory
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
157 ldd <dentry+DIR.FD
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
158 std <dotfd
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
159 lda <dentry+DIR.FD+2
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
160 sta <dotfd+2
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
161 bsr readent * read ".." from directory
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
162 ldd <dentry+DIR.FD
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
163 std <dotdotfd
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
164 lda <dentry+DIR.FD+2
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
165 sta <dotdotfd+2
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
dbf9a6e913f4 Removed seemlingly useless code
boisy
parents: 924
diff changeset
168 * Get name from directory entry
2022
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
169 prsent leax dentry,u
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
170 prsnam os9 F$PrsNam
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
171 bcs IlglName
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
172 ldx <bufptr
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
173 prsloop lda ,-y
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
174 anda #$7F mask hi bit
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
175 sta ,-x save
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
176 decb
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
177 bne prsloop
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
178 lda #PDELIM
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
179 sta ,-x
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
180 stx <bufptr
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
181 rts
950
dbf9a6e913f4 Removed seemlingly useless code
boisy
parents: 924
diff changeset
182
2022
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
183 IlglName leax badnam,pcr
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
184 bra wrerr
950
dbf9a6e913f4 Removed seemlingly useless code
boisy
parents: 924
diff changeset
185
2022
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
186 cantread leax rdmsg,pcr
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
187 wrerr lda #$02
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
188 os9 I$WritLn
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
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
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
191 EMOD
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
192 eom EQU *
1b7bc08e2e25 minor optimizations
boisy
parents: 1531
diff changeset
193 END
689
92b575ffa143 Folded pxd.asm and pwd.asm into pd.asm for simplicity since almost all code
boisy
parents:
diff changeset
194