annotate 3rdparty/p2mods/os9p3_perr.asm @ 686:ed3ad5db6af4

Made source enhnacements
author boisy
date Mon, 30 Dec 2002 02:20:51 +0000
parents 1f8438c88938
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
2 * O S 9 p 3 . a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 * -- printerr functionality for Level II
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 * AUTHOR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
6 * Peter E. Durham
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
7 * The New Wentworth Timesharing System
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
8 * summer: 6 Twin Brook Circle school: Quincy House D-24
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
9 * Andover, MA 01810 58 Plympton St.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
10 * (617) 475-4243 Cambridge, MA 02138
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
11 * (617) 498-3209
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12 * cis: 73177,1215 delphi: PEDXING
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
13 * unix: harvard!husc4!durham_2 intnet: durham_2@husc4.harvard.edu
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
15 * VERSION
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16 * 01.00.00 (PED) 87/06/23 -- First release
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18 * COPYRIGHT (C) 1987 by Peter Durham
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19 * Permission is given to all members of the OS-9 community to use,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20 * modify, and share this program for their personal enjoyment.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21 * Commercial use of this program, which was written for fun to share with
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22 * the community, is prohibited without the consent of the author.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23 * Please share any extensions or modifications with the author, who
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24 * would be interested in hearing about them.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
26 * NOTE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
27 * Quick poll... how does the above sound as a copyright notice? Clearly,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28 * authors like to share their work while maintaining some control on it.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 * And it doesn't seem fair for someone else to make $ from something
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
30 * someone else made for fun. I think the above conditions are what most
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
31 * people want. Let me know what you think.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
33 * NOTE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
34 * The inspiration for this utility was the os9p3 example in
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
35 * the Tandy Level II manual. Tandy deserves praise for
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36 * including examples such as this one in their manuals.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38 * NOTE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
39 * There is something funny about OS9p3 modules... some versions
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
40 * are not liked, others are. When developing this module, often
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
41 * a version would fail... but if I added a "leas 0,s" right before
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42 * the "rts" in PrinBuf, it would work! Probably the location and
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
43 * operation are not significant. This version here has never failed
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
44 * to boot on my system; however, if it does on yours (or you change
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
45 * it), try putting such things in.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
46 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
47 * NOTE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
48 * For those people who just can't have enough... OS9p3 will look for
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 * a module called OS9p4, and link to it, and execute it. Thanks to
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
50 * Kev for this idea. Now we can keep additions to the kernel in nice
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
51 * separate chunks. (How long 'til OS9p11 comes around...?)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
52 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53 nam OS9p3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54 ttl Printerr functionality for Level II
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55 opt w79
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
56 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 * C o n s t a n t s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
58 * (so we don't need a level II DEFS file)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
59 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 * Service calls
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
62 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
63
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
64 ifp1
4
1f8438c88938 added defsfile, changed source to use that defsfile
boisy
parents: 0
diff changeset
65 use defsfile
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 * C o d e
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71 * Module header
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73 Type set Systm ;System module, 6809 object code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74 Revs set Reent+1 ;Sharable, first revision
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75 edition set 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 mod OS9End,OS9Name,Type,Revs,Entry,256
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78 OS9Name fcs "OS9p3" ;Name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 fcb edition
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 * Initialization routine and table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 Entry equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 leay SvcTbl,pcr ;Get address of table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 os9 F$SSvc ;Install services in table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 lda #Type ;Get system module type for OS9p4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
87 leax P4Name,pcr ;Get name for OS9p4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
88 os9 F$Link ;Try to link to it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 bcs Exit ;If not found, exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90 jsr ,y ;Go execute it!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
91 Exit rts ;Return to os9p2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 SvcTbl equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
93 fcb F$PErr ;System call number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
94 fdb PErr-*-2 ;Offset to code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95 fcb $80 ;End of table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97 * The new F$Perr service call
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
100 * Data (in user space!)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
102 BufLen equ 80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
103 Buf rmb BufLen
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
104 HunDig equ Buf+7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
105 TenDig equ Buf+8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
106 OneDig equ Buf+9
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
107 DataMem equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
108 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
109 * FUNCTION PErr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
110 * PURPOSE Top level routine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111 * REGISTERS B = Error code (after Setup)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
112 * U = User memory area (after Setup)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
113 * Y = User process descriptor (after Setup)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 * A = Error file path number (after OpenFil)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
115 * X = Pointer to strings
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
116 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117 PErr equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
118 bsr Setup ;Go set up registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
119 leax ErrMsg,pcr ;Get pointer to "Error #000"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
120 bsr MoveBuf ;Go copy it over
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
121 bsr WritNum ;Go copy the number into it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
122 lbsr PrinMsg ;Go print the message
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
123 bcs PErrBye ;If error, abort
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
124 leax FilNam,pcr ;Get pointer to "/dd/sys/errmsg"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
125 bsr MoveBuf ;Go copy it over
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
126 lbsr OpenFil ;Go open the file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
127 bcs PErrBye ;If error, abort
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
128 Loop lbsr RdBuf ;Go read a line from the file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
129 bcs Error ;If error, print CR, and abort
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
130 pshs b ;Save error code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
131 pshs b ;Save error code again for compare
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
132 bsr CalcNum ;What number is on this line?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
133 cmpb ,s+ ;Is this line the right line?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
134 puls b ;Restore error code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
135 bne Loop ;If not right line, loop again
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
136 lbsr PrinBuf ;If right line, write line out
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137 bra Close ;Done, so close the file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 Error lbsr DoCR ;Go print a carriage return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139 Close lbsr ClosFil ;Go close the file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140 PErrBye rts ;Return from system call
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
141 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
142 * FUNCTION SetUp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
143 * PURPOSE Sets up registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
144 * GIVES B = Error code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
145 * U = Pointer to data memory on user stack in user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
146 * Y = Pointer to user process descriptor in system space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
147 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
148 SetUp equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
149 ldb R$B,u ;Get error code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150 ldy D.Proc ;Get user's process descriptor
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151 ldu P$SP,y ;Get user's stack pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152 leau -DataMem,u ;Reserve a little space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
153 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
154 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
155 * FUNCTION MoveBuf
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
156 * PURPOSE Copies string to user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
157 * TAKES X = location of string in system space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
158 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
159 MoveBuf equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
160 pshs u,y,d ;Save registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
161 lda D.SysTsk ;Get system process task number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
162 ldb P$Task,y ;Get user process task number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 leau Buf,u ;Get pointer to destination buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 ldy #BufLen ;Copy BufLen characters over (extras, oh well)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
165 os9 F$Move ;Move string to user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
166 puls d,y,u,pc ;Restore registers and return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
167 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
168 * FUNCTION WriteNum
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
169 * PURPOSE Puts the ASCII value of the error code in user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
170 * TAKES B = error code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
171 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
172 WritNum equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
173 pshs x,d ;Save registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
174 clra ;Start A as 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
175 Huns cmpb #100 ;Is B >= 100?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
176 blo HunDone ;If not, go do Tens
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
177 inca ;Increment hundreds digit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
178 subb #100 ;Subtract 100 from B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
179 bra Huns ;Go do again
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
180 HunDone leax HunDig,u ;Where to put digit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
181 bsr WritDig ;Go put it there
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
182 clra ;Start A again as 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
183 Tens cmpb #10 ;Is B >= 10?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
184 blo TenDone ;If not, go do Ones
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
185 inca ;Increment hundreds digit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
186 subb #10 ;Subtract 10 from B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
187 bra Tens ;Go do again
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
188 TenDone leax TenDig,u ;Where to put digit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
189 bsr WritDig ;Go put it there
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
190 tfr b,a ;Get ones digit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
191 leax OneDig,u ;Where to put digit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
192 bsr WritDig ;Go put it there
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
193 puls d,x,pc ;Restore registers and return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
194 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
195 * FUNCTION WritDig
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
196 * PURPOSE Copy digit into user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
197 * TAKES A = digit to copy (not in ASCII yet)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
198 * X = where to put digit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
200 WritDig equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
201 pshs d ;Save registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
202 adda #'0 ;Convert A to ASCII
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
203 ldb P$Task,y ;Get task number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
204 os9 F$StABX ;Write that digit to user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
205 puls d,pc ;Restore registers and return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
206 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
207 * FUNCTION CalcNum
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
208 * PURPOSE Converts ASCII number in user space to binary
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
209 * TAKES Buf (in user space) = ASCII number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
210 * GIVES B = number converted
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
211 * X = points to first nonnumeric character
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
212 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
213 CalcNum equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
214 pshs a ;Save register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
215 leax Buf,u ;Get pointer to buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
216 clrb ;Set accumulator to zero
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
217 NextDig bsr LoadDig ;Get digit from user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
218 suba #'0 ;Convert to binary; is it less than zero?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
219 bmi CalcBye ;If so, return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
220 cmpa #9 ;Is the digit more than nine?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
221 bhi CalcBye ;If so, return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
222 pshs a ;Save the digit while we multiply
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
223 lda #10 ;Multiply current number by 10
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
224 mul ;Do it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
225 addb ,s+ ;Add new digit to number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
226 leax 1,x ;Advance X to next digit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
227 bra NextDig ;Go get the next digit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
228 CalcBye puls a,pc ;Restore register and return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
229 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
230 * FUNCTION LoadDig
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
231 * PURPOSE Get digit from user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
232 * TAKES X = pointer to digit in user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
233 * GIVES A = digit in user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
234 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
235 LoadDig equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
236 pshs b ;Save register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
237 ldb P$Task,y ;Get user process task number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
238 os9 F$LdABX ;Get digit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
239 puls b,pc ;Restore register and return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
240 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
241 * FUNCTION PrinMsg
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
242 * PURPOSE Prints out the Error #xxx message
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
243 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
244 PrinMsg equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
245 pshs y,x,a ;Save registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
246 lda P$Path+2,y ;Get StdErr path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
247 leax Buf,u ;Get pointer to message
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
248 ldy #ErrLen ;Maximum ErrLen characters to print
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
249 os9 I$Write ;Write out error message
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
250 puls a,x,y,pc ;Restore registers and return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
251 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
252 * FUNCTION DoCR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
253 * PURPOSE Prints a carriage return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
254 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
255 DoCR equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
256 pshs x,d ;Save registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
257 ldb P$Task,y ;Get user task number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
258 lda #$0D ;Load A with a CR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
259 leax Buf,u ;Get pointer to buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
260 os9 F$StABX ;Move the CR to the buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
261 bsr PrinBuf ;Go print it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
262 puls d,x,pc ;Restore registers and return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
263 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
264 * FUNCTION PrinBuf
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
265 * PURPOSE Prints out the string from user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
266 * TAKES X (in user space) = String to print
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
267 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
268 PrinBuf equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
269 pshs y,a ;Save registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
270 lda P$Path+2,y ;Get StdErr path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
271 ldy #BufLen ;Maximum BufLen characters to print
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
272 os9 I$WritLn ;Write out message
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
273 puls a,y,pc ;Restore registers and return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
274 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
275 * FUNCTION RdBuf
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
276 * PURPOSE Reads in a string from file to user space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
277 * TAKES A = path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
278 * GIVES Buf (in user space) = String read in
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
279 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
280 RdBuf equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
281 pshs y,x ;Save registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
282 leax Buf,u ;Get pointer to buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
283 ldy #BufLen ;Maximum BufLen characters to read
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
284 os9 I$ReadLn ;Read in line from file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
285 puls x,y,pc ;Restore registers and return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
286 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
287 * FUNCTION OpenFil
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
288 * PURPOSE Open path to error message file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
289 * TAKES Buf (in user space) = name of file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
290 * GIVES A = Path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
291 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
292 OpenFil equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
293 pshs x ;Save register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
294 lda #READ. ;Open path for read access
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
295 leax Buf,u ;Get pointer to string
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
296 os9 I$Open ;Open path
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
297 puls x,pc ;Restore registers and return A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
298 *+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
299 * FUNCTION ClosFil
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
300 * PURPOSE Close path to error message file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
301 * TAKES A = Path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
302 *-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
303 ClosFil equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
304 os9 I$Close ;Close file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
305 rts ;Return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
306 P4Name fcc "OS9p4"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
307 fcb $D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
308 ErrMsg fcc "Error #000"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
309 ErrLen equ *-ErrMsg
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
310 FilNam fcc "/dd/sys/errmsg"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
311 fcb $D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
312 FilLen equ *-FilNam
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
313 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
314 OS9End equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
315 end