annotate level1/cmds/dsave.asm @ 1325:84ea83668304

Redid comments, reset all rev nibbles that weren't explictly set to 0
author boisy
date Thu, 04 Sep 2003 23:06:16 +0000
parents 8a0993b04c8a
children 9859ddd89ff8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ********************************************************************
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
2 * dsave - Multi-file copy utility
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 * $Id$
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 *
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
6 * Syntax: dsave [<opts>] <destpath>
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
7 * Opts :
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
8 * -b = include bootfile (doesn't work)
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
9 * -i = indent dir levels
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
10 * -l = only one dir level
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
11 * -m = omit makdirs
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
12 * -r = force rewrite on copy
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
13 * -s = alter copy mem size
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
14 * -v = verify copied files
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
15 *
1325
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 962
diff changeset
16 * Edt/Rev YYYY/MM/DD Modified by
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 962
diff changeset
17 * Comment
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18 * ------------------------------------------------------------------
1325
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 962
diff changeset
19 * 1 2003/01/11 Boisy G. Pitre
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 962
diff changeset
20 * Rewrote in assembly language.
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22 nam dsave
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
23 ttl Multi-file copy utility
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25 ifp1
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
26 use defsfile
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
27 use rbfdefs
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28 endc
200
e9ce43cc215e Made major changes to headers for consistency and identification
boisy
parents: 113
diff changeset
29
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
30 * Here are some tweakable options
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
31 DOHELP set 0 1 = include help info
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
32 INDENTSZ set 2 number of spaces to indent when -i is used
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
33 STACKSZ set 1024 estimated stack size in bytes
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
34 PARMSZ set 256 estimated parameter size in bytes
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
35
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
36 * Module header definitions
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37 tylg set Prgrm+Objct
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38 atrv set ReEnt+rev
1325
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 962
diff changeset
39 rev set $00
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
40 edition set 1
200
e9ce43cc215e Made major changes to headers for consistency and identification
boisy
parents: 113
diff changeset
41
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42 mod eom,name,tylg,atrv,start,size
200
e9ce43cc215e Made major changes to headers for consistency and identification
boisy
parents: 113
diff changeset
43
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
44 * Your utility's static storage vars go here
924
c155aac72190 Made cosmetic changes
boisy
parents: 200
diff changeset
45 org 0
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
46 * These vars are used by the base template and shouldn't be removed
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
47 parmptr rmb 2 pointer to our command line params
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
48 bufptr rmb 2 pointer to user expandable buffer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
49 bufsiz rmb 2 size of user expandable buffer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
50 * These vars are used for this example, it will probably change for you
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
51 dirlevel rmb 1 current directory level (0 = top)
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
52 *doexec rmb 1 execute flag
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
53 errcode rmb 1 error code storage
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
54 plistcnt rmb 1 command line pathlist count
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
55 doboot rmb 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
56 indent rmb 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
57 onelevel rmb 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
58 nomakdir rmb 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
59 rewrite rmb 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
60 cpymemsz rmb 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
61 doverify rmb 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
62 dstpath rmb 2 pointer to second (optional) pathlist on cmd line
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
63 lineptr rmb 2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
64 sopt rmb 1
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
65 ddbt rmb 3 copy of source disk's DD.BT from LSN0
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
66 * vars for pwd integrated code
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
67 fildes rmb 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
68 srcptr rmb 2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
69 dotdotfd rmb 3 LSN of ..
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
70 dotfd rmb 3 LSN of .
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
71 ddcopy rmb 3
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
72 bbuff rmb 64 -b= buffer
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
73 dentry rmb DIR.SZ*2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
74 srcpath rmb 128
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
75 buffend rmb 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
76 pathext rmb 256 extended part of source pathlist
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
77 devname rmb 32
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
78 cleartop equ . everything up to here gets cleared at start
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
79 direntbf rmb DIR.SZ
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
80 * Next is a user adjustable buffer with # modifier on command line.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
81 * Some utilities won't need this flexibility, some will.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
82 * Currently set up to be larger for Level 2 than Level 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
83 * Note: this buffer must come just before the stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
84 linebuff rmb 256
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
85 IFGT Level-1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
86 bigbuff rmb 8*1024 8K default buffer for Level 2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
87 ELSE
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
88 bigbuff rmb 512 512 byte default buffer for Level 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
89 ENDC
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
90 * Finally the stack for any PSHS/PULS/BSR/LBSRs that we might do
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
91 rmb STACKSZ+PARMSZ
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 size equ .
200
e9ce43cc215e Made major changes to headers for consistency and identification
boisy
parents: 113
diff changeset
93
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
94 * The utility name and edition goes here
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
95 name fcs /dsave/
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
96 fcb edition
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
97
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
98 * Place constant strings here
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
99 IFNE DOHELP
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
100 HlpMsg fcb C$LF
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
101 fcb C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
102 HlpMsgL equ *-HlpMsg
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
103 ENDC
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
104
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
105 UnkOpt fcc /unknown option: /
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
106 UnkOptL equ *-UnkOpt
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
107
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
108 ShlEko fcc "t"
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
109 CR fcb C$CR
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
110
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
111 Chd fcc "chd"
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
112 fcb C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
113
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
114 MakDir fcc "makdir"
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
115 fcb C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
116
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
117 Cmp fcc "cmp"
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
118 fcb C$CR
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
119
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
120 TMode fcc "tmode"
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
121 fcb C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
122 TPause fcc ".1 pause"
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
123 fcb C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
124 TNoPause fcc ".1 -pause"
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
125 fcb C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
126
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
127 Load fcc "load"
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
128 fcb C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
129
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
130 Unlink fcc "unlink"
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
131 fcb C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
132
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
133 Copy fcc "copy"
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
134 fcb C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
135
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
136 OS9Gen fcc "os9gen"
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
137 fcb C$CR
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
138
955
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
139 OS9Boot fcs "OS9Boot"
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
140
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
141 DotDot fcc "."
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
142 Dot fcc "."
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
143 fcb C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
144
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
145 * Here's how registers are set when this process is forked:
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
146 *
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
147 * +-----------------+ <-- Y (highest address)
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
148 * ! Parameter !
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
149 * ! Area !
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
150 * +-----------------+ <-- X, SP
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
151 * ! Data Area !
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
152 * +-----------------+
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
153 * ! Direct Page !
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
154 * +-----------------+ <-- U, DP (lowest address)
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
155 *
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
156 * D = parameter area size
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
157 * PC = module entry point abs. address
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
158 * CC = F=0, I=0, others undefined
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
159
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
160 * The start of the program is here.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
161 * Before any command line processing is done, we clear out
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
162 * our static memory from U to cleartop, then determine the
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
163 * size of our data area (minus the stack).
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
164 start pshs u,x save registers for later
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
165 leax cleartop,u point to end of area to zero out
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
166 IFNE H6309
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
167 subr u,x subtract U from X
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
168 tfr x,w and put X in W
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
169 clr ,-s put a zero on the stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
170 tfm s,u+ and use TFM to clear starting at U
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
171 leas 1,s clean up the stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
172 ELSE
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
173 pshs x save end pointer on stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
174 clrnxt clr ,u+ clear out
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
175 cmpu ,s done?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
176 bne clrnxt branch if not
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
177 leas 2,s else clear stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
178 ENDC
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
179 puls x,u and restore our earlier saved registers
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
180 leay bigbuff,u point Y to copy buffer offset in U
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
181 stx <parmptr save parameter pointer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
182 sty <bufptr save pointer to buffer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
183 tfr s,d place top of stack in D
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
184 IFNE H6309
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
185 subr y,d
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
186 ELSE
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
187 pshs y save Y on stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
188 subd ,s++ get size of space between copybuf and X
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
189 ENDC
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
190 subd #STACKSZ+PARMSZ subtract out our stack/param size
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
191 std <bufsiz size of our buffer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
192
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
193 * At this point we have determined our buffer space and saved pointers
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
194 * for later use. Now we will parse the command line for options that
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
195 * begin with a dash.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
196 * Note that X will NOT point to a space, but to either a CR (if no
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
197 * parameters were passed) or the first non-space character of the
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
198 * parameter.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
199 * Here we merely grab the byte at X into A and test for end of line,
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
200 * exiting if so. Utilities that don't require arguments should
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
201 * comment out the following three lines.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
202 lda ,x get first char
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
203 cmpa #C$CR CR?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
204 lbeq ShowHelp if so, no parameters... show help and exit
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
205 GetChar lda ,x+ get next character on cmd line
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
206 cmpa #C$CR CR?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
207 lbeq DoDSave if so, do whatever this utility does
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
208 cmpa #'- is it an option?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
209 beq GetDash if so, process it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
210 inc <plistcnt else must be a non-option argument (file)
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
211 lbsr SkipNSpc move past the argument
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
212 ChkDash lbsr SkipSpcs and any following spaces
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
213 bra GetChar start processing again
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
214 GetDash lda #C$SPAC get a space char
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
215 sta -1,x and wipe out the dash from the cmd line
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
216 GetDash2 ldd ,x+ load option char and char following
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
217 ora #$20 make lowercase
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
218 IsItB cmpa #'b is it this option?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
219 bne IsItE branch if not
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
220 sta <doboot
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
221 cmpb #'= = follows?
955
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
222 beq DoEqual
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
223 * -b alone, copy default bootfile name to bbuff
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
224 pshs x
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
225 leax OS9Boot,pcr
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
226 leay bbuff,u
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
227 lbsr StrCpy
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
228 lda #C$CR
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
229 sta ,y
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
230 bra IsItBEx
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
231 DoEqual leax 1,x move X past dash
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
232 pshs x
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
233 leay bbuff,u point to buffer
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
234 lbsr ParmCpy copy parameter from X to Y
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
235 lda #C$CR
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
236 sta ,y
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
237 lda #C$SPAC
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
238 IsItBLp sta ,-x
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
239 cmpx ,s
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
240 bne IsItBLp
955
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
241 IsItBEx puls x
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
242 bra FixCmdLn
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
243 IsItE equ *
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
244 * cmpa #'e is it this option?
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
245 * bne IsItI branch if not
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
246 * sta <doexec
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
247 * bra FixCmdLn
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
248 IsItI cmpa #'i is it this option?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
249 bne IsItL branch if not
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
250 sta <indent
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
251 bra FixCmdLn
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
252 IsItL cmpa #'l is it this option?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
253 bne IsItM branch if not
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
254 sta <onelevel
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
255 bra FixCmdLn
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
256 IsItM cmpa #'m is it this option?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
257 bne IsItR branch if not
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
258 sta <nomakdir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
259 bra FixCmdLn
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
260 IsItR cmpa #'r is it this option?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
261 bne IsItS branch if not
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
262 sta <rewrite
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
263 bra FixCmdLn
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
264 IsItS cmpa #'s is it this option?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
265 bne IsItV branch if not
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
266 * add code to parse memsize
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
267 pshs x
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
268 lbsr ASC2Byte
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
269 stb <sopt
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
270 lda #C$SPAC
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
271 SpcNext sta ,-x erase everything after -s
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
272 cmpx ,s
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
273 bne SpcNext
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
274 puls x
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
275 clrb
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
276 bra FixCmdLn
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
277 IsItV cmpa #'v is it this option?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
278 bne BadOpt branch if not
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
279 sta <doverify
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
280 FixCmdLn lda #C$SPAC get space
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
281 sta -$01,x and wipe out option character
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
282 cmpb #'0
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
283 lblt ChkDash start dash option processing again
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
284 lbra GetDash possibly another option following?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
285
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
286 * We branch here if we encounter an unknown option character
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
287 * A = bad option character
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
288 BadOpt leax UnkOpt,pcr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
289 ldy #UnkOptL
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
290 ldb #C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
291 pshs d save bad option and CR on stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
292 lda #$02 stderr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
293 os9 I$Write
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
294 leax ,s point X at option char on stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
295 os9 I$WritLn print option and CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
296 puls d clean up stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
297 lbra ShowHelp
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
298
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
299 * At this point options are processed.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
300 * We load X with our parameter pointer and go down the command line
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
301 * looking at each file to process (options have been wiped out with
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
302 * spaces)
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
303 *
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
304 * Note, the following two instructions may not be needed, depending on
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
305 * if your utility requires a non-option on the command line.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
306 DoDSave dec <plistcnt we should have only one path on cmdline
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
307 lbne ShowHelp if not, exit with error
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
308 ldx <parmptr get our parameter pointer off stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
309 lbsr SkipSpcs skip any leading spaces
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
310 stx <dstpath save dest path
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
311 lbsr SkipNSpc
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
312 lda #C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
313 sta ,x+
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
314
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
315 * Here we have src and possibly destination pathlist. Now we can
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
316 * start processing the dsave
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
317 leax linebuff,u
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
318 stx <lineptr reset line buffer pointer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
319
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
320 * Get entire pathlist to working directory
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
321 lbsr pwd
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
322 * Open source device as raw and obtain 24 bit LSN to bootfile
955
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
323 * ldd #$400D @ + CR
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
324 * pshs d save on stack
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
325 * leax ,s point X to stack
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
326 * lda #READ. read mode
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
327 * os9 I$Open open
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
328 * puls x clean stack
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
329 * lbcs Exit branch if error
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
330 * pshs a save path
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
331 * ldx #0000
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
332 * tfr u,y
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
333 * ldu #DD.BT
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
334 * os9 I$Seek seek to DD.BT in LSN0
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
335 * tfr y,u
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
336 * lbcs Exit
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
337 * leax ddbt,u point to buffer
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
338 * ldy #3 read 3 bytes at DD.BT
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
339 * os9 I$Read
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
340 * lbcs Exit exit of error
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
341 * puls a get path on stack
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
342 * os9 I$Close and close it
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
343
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
344 * Do dsave "pre" commands
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
345 lbsr DoEcho
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
346 ldx <dstpath point to source path
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
347 lbsr DoChd chd to it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
348 lbsr DoPauseOff
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
349 lbsr DoLoadCopy
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
350 tst <doverify
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
351 beq PreRecurse
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
352 lbsr DoLoadCmp
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
353
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
354 * Steps in processing files:
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
355 * 0. Open path to '.'
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
356 * 1. Read next directory entry
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
357 * 2. if directory encountered:
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
358 * a. chd entry
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
359 * b. bsr step 0
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
360 * c. chd ..
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
361 * 3. if eof, goto step 6
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
362 * 4. copy file to dest
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
363 * 5. goto 1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
364 * 6. Close path to source dir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
365
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
366 PreRecurse
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
367 leay buffend,u
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
368 bsr CopyDir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
369
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
370 * Do dsave "post" commands
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
371 tst <doverify
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
372 beq PostRecurse
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
373 lbsr DoUnlinkCmp
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
374 PostRecurse
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
375 lbsr DoUnlinkCopy
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
376 lbsr DoPauseOn
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
377
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
378 lbra ExitOk
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
379
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
380 CopyDir ldx <srcptr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
381 lda #DIR.+READ. permissions as DIR.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
382 os9 I$Open open directory
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
383 lbcs CopyRts branch if error
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
384 ldb #PDELIM
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
385 stb ,y+
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
386 pshs y
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
387 pshs a save path to .
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
388 pshs x,u save regs
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
389 ldx #$0000
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
390 ldu #DIR.SZ*2 seek past two dir entries
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
391 os9 I$Seek skip over . and .. entries of this dir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
392 puls x,u get saved regs
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
393 bcs Copy2Ex branch if error
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
394 FileLoop lda ,s get path to . on stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
395 ldy #DIR.SZ get size of directory entry
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
396 leax direntbf,u point to directory entry buffer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
397 os9 I$Read read directory entry
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
398 bcs Copy2Ex branch if error
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
399 tst ,x first byte at x... is it zero?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
400 beq FileLoop yep, empty dir entry
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
401 ldy 1,s get Y on stack
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
402 lbsr StrCpy
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
403 lda #C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
404 sta ,y
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
405 ldx <srcptr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
406 lda #DIR.+READ. open as directory
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
407 os9 I$Open open it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
408 bcs ItsAFile if error, it's not a dir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
409 os9 I$Close close it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
410 * Here, we know that the file we just opened and closed was a directory
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
411 ItsADir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
412 tst <onelevel do we ignore dirs?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
413 bne FileLoop branch if so
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
414 pshs y
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
415 ldx 3,s
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
416 lbsr DoMakDir makdir it
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
417 bcc ItsADir2
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
418 os9 F$PErr
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
419 ItsADir2 ldx 3,s
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
420 lbsr DoChd
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
421 bcs FileLoop if error, ignore dir
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
422 inc <dirlevel
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
423 puls y
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
424 bsr CopyDir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
425 leax DotDot,pcr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
426 lbsr DoChd
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
427 dec <dirlevel
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
428 bra FileLoop
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
429
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
430 * Here, we know that the file we just opened and closed was NOT a directory
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
431 ItsAFile tst <dirlevel are we at root level?
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
432 bne ItsAFile2 no, don't even do os9boot test
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
433 ldx 1,s else get ptr to current filename
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
434 lbsr BootCmp is it os9boot?
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
435 bcs ItsAFile2 no, copy away!
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
436 tst <doboot -b option specified?
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
437 beq FileLoop nope, ignore bootfile
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
438
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
439 * Here we have a file named OS9Boot in the top level directory
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
440 * We must os9gen the sucker
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
441 lbsr BuildOS9Gen
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
442 bra FileLoop
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
443
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
444 ItsAFile2
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
445 ldx 1,s
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
446 lbsr BuildCopy
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
447 tst <doverify verify on?
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
448 beq FileLoop branch if not
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
449 ldx 1,s
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
450 lbsr BuildCmp
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
451 bra FileLoop
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
452 Copy2Ex puls a get path to .
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
453 os9 I$Close close path
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
454 CopyEx leas 2,s
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
455 CopyRts rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
456
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
457 ShowHelp equ *
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
458 IFNE DOHELP
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
459 leax >HlpMsg,pcr point to help message
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
460 ldy #HlpMsgL get length
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
461 lda #INDENTSZ std error
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
462 os9 I$WritLn write it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
463 ENDC
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
464 ExitOk clrb clear carry
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
465 Exit os9 F$Exit and exit
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
466
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
467 * This routine counts the number of non-whitespace characters
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
468 * starting at X
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
469 *
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
470 * Entry:
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
471 * X = ptr to string (space, comma or CR terminated)
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
472 * Exit:
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
473 * Y = length of string
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
474 * X = ptr to byte after string
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
475 StrLen pshs a
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
476 ldy #$0000
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
477 StrLenLp lda ,x+
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
478 cmpa #C$SPAC
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
479 beq StrLenEx
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
480 cmpa #C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
481 beq StrLenEx
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
482 leay 1,y
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
483 bra StrLenLp
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
484 StrLenEx puls a,pc
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
485
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
486 * This routine copies a string of text from X to Y until
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
487 * a CR or hi bit char is encountered
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
488 *
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
489 * Entry:
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
490 * X = ptr to src string
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
491 * Y = ptr to dest string
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
492 * Exit:
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
493 * D = number of bytes copied
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
494 * X = ptr to char past src string
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
495 * Y = ptr to char past dest string
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
496 StrCpy pshs u
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
497 ldu #$0000
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
498 CopyFnLp lda ,x+
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
499 tfr a,b
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
500 anda #$7F
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
501 cmpa #C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
502 ble CopyFnEx
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
503 sta ,y+
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
504 leau 1,u
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
505 tstb
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
506 bpl CopyFnLp
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
507 CopyFnEx tfr u,d
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
508 puls u,pc
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
509
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
510 * Works like StrCpy, but stops if a space is encountered
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
511 ParmCpy pshs u
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
512 ldu #$0000
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
513 ParmFnLp lda ,x+
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
514 tfr a,b
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
515 anda #$7F
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
516 cmpa #C$SPAC
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
517 ble ParmFnEx
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
518 sta ,y+
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
519 leau 1,u
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
520 tstb
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
521 bpl ParmFnLp
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
522 ParmFnEx tfr u,d
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
523 puls u,pc
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
524
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
525 * Compare two filenames to see if they match
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
526 * X = filename to compare against OS9boot
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
527 BootCmp pshs y,x
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
528 lbsr StrLen get length of passed filename
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
529 puls x get pointer to passed filename
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
530 tfr y,d
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
531 leay OS9Boot,pcr
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
532 os9 F$CmpNam
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
533 puls y,pc
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
534
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
535 MakeUp cmpa #'a
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
536 blt MakeUpEx
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
537 cmpa #'z
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
538 bgt MakeUpEx
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
539 anda #$DF make uppercase
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
540 MakeUpEx rts
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
541
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
542 StrHCpy pshs u
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
543 ldu #$0000
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
544 HCpyFnLp lda ,x+
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
545 beq HCpyFnEx
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
546 tfr a,b
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
547 anda #$7F strip out possible hi bit
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
548 sta ,y+
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
549 leau 1,u
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
550 tstb test copy of byte in B
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
551 bpl HCpyFnLp if hi bit not set, keep going
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
552 * clr ,y+ add null byte at end
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
553 HCpyFnEx tfr u,d
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
554 puls u,pc
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
555
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
556 * This routine skip over spaces
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
557 *
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
558 * Entry:
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
559 * X = ptr to data to parse
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
560 * Exit:
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
561 * X = ptr to first non-whitespace char
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
562 * A = non-whitespace char
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
563 SkipSpcs lda ,x+
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
564 cmpa #C$SPAC
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
565 beq SkipSpcs
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
566 leax -1,x
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
567 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
568
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
569 * This routine skips over everything but spaces, commas and CRs
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
570 *
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
571 * Entry:
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
572 * X = ptr to data to parse
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
573 * Exit:
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
574 * X = ptr to first whitespace char
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
575 * A = whitespace char
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
576 SkipNSpc lda ,x+
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
577 cmpa #C$SPAC
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
578 beq EatOut
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
579 cmpa #C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
580 bne SkipNSpc
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
581 EatOut leax -1,x
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
582 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
583
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
584
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
585 * Entry: X = directory to make
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
586 DoMakDir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
587 tst <nomakdir do we do the makdir?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
588 bne Ret branch if not
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
589 pshs x
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
590 leax MakDir,pcr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
591 bsr CopyCmd
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
592 ldx ,s
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
593 bsr CopyParm
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
594 bsr WriteIt
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
595 puls x
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
596 * tst <doexec are we executing?
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
597 * beq Ret if not, just return
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
598 * lda #DIR.+PREAD.+PEXEC.+EXEC.+UPDAT.
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
599 * os9 I$MakDir
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
600 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
601
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
602 * Entry: X = path to chd to
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
603 DoChd
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
604 pshs x
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
605 leax Chd,pcr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
606 bsr CopyCmd
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
607 ldx ,s
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
608 bsr CopyParm
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
609 bsr WriteIt
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
610 puls x
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
611 * tst <doexec are we executing?
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
612 * beq Ret if not, just return
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
613 * lda #DIR.+READ.
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
614 * os9 I$ChgDir
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
615 * bcc Ret
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
616 * os9 F$PErr
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
617 Ret rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
618
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
619 WriteIt ldy #1024
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
620 lda #1
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
621 os9 I$WritLn
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
622 Rts rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
623
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
624 DoEcho equ *
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
625 * tst <doexec are we executing?
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
626 * bne Rts if so, ignore this shell command
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
627 leax ShlEko,pcr else point to shell echo command
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
628 bra WriteIt
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
629
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
630 * Copy command into linebuff and put space after it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
631 * Entry: X = pointer to command to copy to linebuff
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
632 CopyCmd leay linebuff,u and point Y to line buffer
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
633 * Do level indention if specified
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
634 tst <indent
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
635 beq CopyCmd3
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
636 lda <dirlevel
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
637 beq CopyCmd3
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
638 ldb #$02
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
639 mul
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
640 lda #C$SPAC
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
641 CopyCmd2 sta ,y+
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
642 decb
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
643 bne CopyCmd2
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
644 CopyCmd3 lbsr StrCpy copy command
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
645 lda #C$SPAC get space
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
646 sta ,y+ and store it after command in buff
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
647 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
648
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
649 DoPauseOn
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
650 leax TMode,pcr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
651 bsr CopyCmd
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
652 leax TPause,pcr get pause command
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
653 bsr CopyParm
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
654 bra WriteIt
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
655 * bra ExecCmd
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
656
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
657 * Copy parameters into linebuff and put CR after it, then write it out to stdout
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
658 CopyParm lbsr StrCpy copy it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
659 lda #C$CR
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
660 sta ,y+ and store CR after command in buff
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
661 leax linebuff,u
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
662 CPRts rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
663
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
664 * Entry: X = command to execute, with parameters
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
665 *ExecCmd tst <doexec
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
666 * beq CPRts
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
667 * lbsr SkipSpcs skip any leading spaces at X
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
668 * tfr x,y transfer command ptr to Y temporarily
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
669 * lbsr SkipNSpc skip command
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
670 * clr ,x+ clear white space char and move X
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
671 * pshs u save our statics
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
672 * tfr x,u move paramter pointer to Y
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
673 * tfr y,x move command ptr from Y back to X
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
674 * ldy #256
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
675 * clra
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
676 * os9 F$Fork
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
677 * os9 F$Wait
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
678 * bcc ExecRTS
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
679 * os9 F$PErr
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
680 *ExecRTS puls u,pc
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
681
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
682 DoPauseOff
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
683 leax TMode,pcr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
684 bsr CopyCmd
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
685 leax TNoPause,pcr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
686 bsr CopyParm
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
687 lbra WriteIt
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
688 * bra ExecCmd
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
689
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
690 DoLoadCmp
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
691 leax Load,pcr point to load command
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
692 bsr CopyCmd copy it to buffer
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
693 leax Cmp,pcr point to copy command
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
694 bsr CopyParm copy it to buffer
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
695 lbra WriteIt
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
696 * bra ExecCmd
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
697
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
698 DoUnlinkCmp
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
699 leax Unlink,pcr
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
700 lbsr CopyCmd
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
701 leax Cmp,pcr
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
702 bsr CopyParm
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
703 lbra WriteIt
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
704 * bra ExecCmd
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
705
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
706 DoLoadCopy
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
707 leax Load,pcr point to load command
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
708 lbsr CopyCmd copy it to buffer
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
709 leax Copy,pcr point to copy command
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
710 bsr CopyParm copy it to buffer
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
711 lbra WriteIt
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
712 * bra ExecCmd
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
713
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
714 DoUnlinkCopy
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
715 leax Unlink,pcr
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
716 lbsr CopyCmd
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
717 leax Copy,pcr
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
718 lbsr CopyParm
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
719 lbra WriteIt
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
720 * bra ExecCmd
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
721
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
722 BuildOS9Gen
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
723 pshs x
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
724 leax OS9Gen,pcr
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
725 lbsr CopyCmd
955
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
726 ldx <dstpath
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
727 lbsr StrCpy copy to buffer
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
728 * write file name, then CR
955
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
729 lda #C$CR get space
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
730 sta ,y+ and store it after command in buff
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
731 leax linebuff,u
942dd8e50006 -b now fully functional, as well as -b=
boisy
parents: 954
diff changeset
732 lbsr WriteIt
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
733 leax bbuff,u
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
734 lbsr WriteIt
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
735 leax CR,pc
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
736 lbsr WriteIt
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
737 puls x,pc
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
738
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
739 BuildCmp pshs x
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
740 leax Cmp,pcr
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
741 lbsr CopyCmd
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
742 bra BuildCopy3
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
743
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
744 BuildCopy
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
745 pshs x
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
746 leax Copy,pcr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
747 lbsr CopyCmd
962
8a0993b04c8a *** empty log message ***
boisy
parents: 955
diff changeset
748 ldb <sopt -s option specified?
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
749 beq BuildCopy2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
750 lda #'#
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
751 sta ,y+
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
752 lbsr Byte2ASC
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
753 ldd #$4B20 K'space'
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
754 std ,y++
962
8a0993b04c8a *** empty log message ***
boisy
parents: 955
diff changeset
755 BuildCopy2
8a0993b04c8a *** empty log message ***
boisy
parents: 955
diff changeset
756 tst <rewrite
8a0993b04c8a *** empty log message ***
boisy
parents: 955
diff changeset
757 beq BuildCopy3
8a0993b04c8a *** empty log message ***
boisy
parents: 955
diff changeset
758 ldd #$2D72 -r
8a0993b04c8a *** empty log message ***
boisy
parents: 955
diff changeset
759 std ,y++
8a0993b04c8a *** empty log message ***
boisy
parents: 955
diff changeset
760 lda #C$SPAC
8a0993b04c8a *** empty log message ***
boisy
parents: 955
diff changeset
761 sta ,y+
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
762 BuildCopy3
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
763 ldx <srcptr get source path from statics
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
764 lbsr StrCpy copy to buffer
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
765 lda #C$SPAC get space
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
766 sta ,y+ and store it after command in buff
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
767 puls x
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
768 lbsr StrCpy
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
769 lda #C$CR get space
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
770 sta ,y+ and store it after command in buff
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
771 leax linebuff,u
954
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
772 lbra WriteIt
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
773 * lbsr ExecCmd
9a075092f6ce -b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents: 953
diff changeset
774 * rts
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
775
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
776 * Code to get current working directory
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
777 pwd leax >buffend,u point X to buffer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
778 * lda #PDELIM get path delimiter
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
779 * sta ,x store at start of buffer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
780 stx <srcptr store buffer pointer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
781 leax >dot,pcr point to '.'
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
782 bsr open open directory
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
783 sta <fildes save path
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
784 lbsr rdtwo read '.' and '..' entries
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
785 ldd <dotdotfd get 24 bit LSN of ..
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
786 std <ddcopy
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
787 lda <dotdotfd+2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
788 sta <ddcopy+2 and save copy
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
789 L0052 bsr AtRoot are we at root?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
790 beq L0079 branch if so
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
791 leax >dotdot,pcr else point to '..'
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
792 bsr chdir change directory
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
793 lda <fildes get path to previous dir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
794 os9 I$Close close it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
795 lbcs Exit branch if error
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
796 leax >dot,pcr point X to new current dir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
797 bsr open open it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
798 bsr rdtwo read . and .. entires of this dir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
799 bsr FindMtch search for match
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
800 bsr L00E2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
801 ldd <dotdotfd
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
802 std <ddcopy
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
803 lda <dotdotfd+2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
804 sta <ddcopy+2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
805 bra L0052
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
806 L0079 lbsr GetDevNm get device name
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
807 lda <fildes get path
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
808 os9 I$Close close
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
809 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
810
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
811 chdir lda #DIR.+READ.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
812 os9 I$ChgDir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
813 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
814
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
815 open lda #DIR.+READ.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
816 os9 I$Open
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
817 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
818
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
819 * Read directory entry
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
820 read32 lda <fildes
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
821 leax dentry,u
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
822 ldy #DIR.SZ
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
823 os9 I$Read
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
824 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
825
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
826 FindMtch lda <fildes get path to current dir
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
827 bsr read32 read entry
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
828 lbcs pwdrts branch if error
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
829 leax dentry,u point to entry buffer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
830 leax <DIR.FD,x point X to FD LSN
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
831 leay ddcopy,u point Y to copy of LSN
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
832 bsr attop compare the two
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
833 bne FindMtch keep reading until we find match
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
834 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
835
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
836 * Compare 3 bytes at X and Y
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
837 attop ldd ,x++
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
838 cmpd ,y++
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
839 bne L00C5
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
840 lda ,x
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
841 cmpa ,y
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
842 L00C5 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
843
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
844 AtRoot leax dotdotfd,u point X at .. entry
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
845 leay dotfd,u point Y at . entry
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
846 bsr attop check if we're at the top
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
847 pwdrts rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
848
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
849 rdtwo bsr read32 * read "." from directory
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
850 ldd <dentry+DIR.FD
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
851 std <dotfd
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
852 lda <dentry+DIR.FD+2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
853 sta <dotfd+2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
854 bsr read32 * read ".." from directory
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
855 ldd <dentry+DIR.FD
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
856 std <dotdotfd
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
857 lda <dentry+DIR.FD+2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
858 sta <dotdotfd+2
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
859 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
860
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
861 * Get name from directory entry
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
862 L00E2 leax dentry,u
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
863 prsnam os9 F$PrsNam
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
864 lbcs pwdrts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
865 ldx <srcptr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
866 L00EB lda ,-y
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
867 anda #$7F mask hi bit
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
868 sta ,-x save
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
869 decb
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
870 bne L00EB
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
871 lda #PDELIM
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
872 sta ,-x
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
873 stx <srcptr
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
874 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
875
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
876 GetDevNm lda <fildes
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
877 ldb #SS.DevNm
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
878 leax >devname,u
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
879 os9 I$GetStt
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
880 bsr prsnam
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
881 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
882
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
883
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
884 * Entry: X = ptr to ASCII number
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
885 * Exit: B = byte value of ASCII number
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
886 ASC2Byte clrb clear B
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
887 ASC2BLp lda ,x+ get byte from X
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
888 cmpa #'0
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
889 blt ASC2BEx
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
890 suba #'0 make 8 bit integer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
891 cmpa #$09 compare against 9
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
892 bhi ASC2BEx branch if greater
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
893 pshs a else save A
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
894 lda #10 multiply by 10
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
895 mul do it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
896 addb ,s+ add on stack
953
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
897 bcc ASC2BLp if overflow clear, do it again
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
898 ASC2BEx
c8489e2f382d Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents: 951
diff changeset
899 * leax -1,x load byte
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
900 rts return
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
901
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
902 * Entry: Y = address to store number
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
903 * B = number to convert
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
904 Byte2ASC lda #$2F start A out just below $30 (0)
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
905 Hundreds inca inc it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
906 subb #100 subtract 100
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
907 bcc Hundreds if result >= 0, continue
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
908 cmpa #'0 zero?
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
909 beq Tens if so, don't add to buffer
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
910 sta ,y+ else save at U and inc.
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
911 Tens lda #$3A start A out just above $39 (9)
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
912 TensLoop deca dec it
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
913 addb #10 add 10
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
914 bcc TensLoop if carry clear, continue
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
915 sta ,y+ save 10's digit
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
916 addb #'0
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
917 stb ,y+ and 1's digit
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
918 rts
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
919
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
920 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
921 eom equ *
951
062d7f4e63b7 Start of new assembly dsave, still needs work
boisy
parents: 924
diff changeset
922 end