Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/printerr.asm @ 2152:74fb212cb659
Changelog comes from higher up
author | boisy |
---|---|
date | Wed, 14 May 2008 02:13:22 +0000 |
parents | 84ea83668304 |
children |
rev | line source |
---|---|
26 | 1 ******************************************************************** |
2 * Printerr - OS-9 Level One printerr routine | |
3 * | |
4 * $Id$ | |
5 * | |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
6 * Edt/Rev YYYY/MM/DD Modified by |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
7 * Comment |
26 | 8 * ------------------------------------------------------------------ |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
9 * 6 ????/??/?? |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
10 * From Tandy OS-9 Level One VR 02.00.00. |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
11 * |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
12 * 7 2002/07/13 Boisy G. Pitre |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
13 * Changed /D0 to /DD. |
26 | 14 |
0 | 15 nam Printerr |
16 ttl OS-9 Level One printerr routine | |
17 | |
18 ifp1 | |
19 use defsfile | |
20 endc | |
21 | |
22 tylg set Prgrm+Objct | |
23 atrv set ReEnt+rev | |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
24 rev set $00 |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
196
diff
changeset
|
25 edition set 7 |
0 | 26 |
27 mod eom,name,tylg,atrv,start,size | |
28 | |
825 | 29 org 0 |
860 | 30 s.erpath rmb 1 |
31 s.flpath rmb 1 | |
32 s.errcod rmb 1 | |
33 rmb 2 | |
34 s.buffer rmb 81 | |
0 | 35 size equ . |
36 | |
37 name fcs /Printerr/ | |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
196
diff
changeset
|
38 fcb edition |
0 | 39 |
196 | 40 ErrFile fcc "/DD/SYS/ERRMSG" |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
196
diff
changeset
|
41 fcb C$CR |
921
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
860
diff
changeset
|
42 * fcc ",,,,,,,,,,,," |
0 | 43 |
44 ErrMsg fcc "Error #" | |
45 fcb $FF | |
46 | |
47 SysSVC fcb F$PErr | |
48 fdb FPErr-*-2 | |
49 fcb $80 | |
50 | |
825 | 51 start clra any module |
52 leax <name,pcr point to name | |
53 os9 F$Link link one extra time | |
54 bcs error branch if error | |
55 leay <SysSVC,pcr point to system service table | |
56 os9 F$SSvc add it to system calls | |
57 clrb clear carry | |
58 error os9 F$Exit and exit | |
0 | 59 |
825 | 60 FPErr ldx <D.Proc get current process pointer |
61 lda P$PATH+2,x get stderr path | |
62 beq Exit2 branch if not open | |
860 | 63 leas <-size,s else make room on stack |
825 | 64 ldb R$B,u get error code |
65 leau ,s point U to save area | |
860 | 66 sta s.erpath,u store path |
67 stb s.errcod,u store error code | |
825 | 68 bsr PErrOrg print error as originally done |
69 lda #READ. read access mode | |
70 leax >ErrFile,pcr point to error file | |
71 os9 I$Open open path to it | |
860 | 72 sta s.flpath,u save path to file |
825 | 73 bcs Exit1 branch if error |
74 bsr FindErr attempt to find line that matches error code | |
75 bcs Close if error, close file and return to OS-9 | |
76 bne Close | |
860 | 77 NxtLine bsr WriteLn else write line |
825 | 78 bsr ReadLine read next line |
79 bcs Close branch if error | |
80 ldb ,x get first byte of line just read | |
81 cmpb #'0 number? | |
860 | 82 bcs NxtLine branch if not |
83 Close lda s.flpath,u get path | |
825 | 84 os9 I$Close close path to error file |
860 | 85 Exit1 leas <size,s clean stack |
825 | 86 Exit2 clrb clear carry |
87 rts and return to OS-9 | |
0 | 88 |
825 | 89 FindErr bsr ReadLine read line |
860 | 90 bcs FindRts branch if error |
91 bsr ASC2Byte get error number | |
825 | 92 cmpa #'0 |
93 bcc FindErr | |
860 | 94 cmpb s.errcod,u same as error? |
825 | 95 bne FindErr branch if not |
860 | 96 FindRts rts |
0 | 97 |
98 * read a line from the error file | |
860 | 99 ReadLine lda s.flpath,u get path number of file |
100 leax s.buffer,u point X to buffer | |
825 | 101 ldy #80 max 80 chars |
102 os9 I$ReadLn read line | |
0 | 103 rts |
104 | |
825 | 105 PErrOrg leax >ErrMsg,pcr point X to error header |
860 | 106 leay s.buffer,u point Y to buffer area |
825 | 107 lda ,x+ get byte at X |
108 CopyLoop sta ,y+ and store it at Y | |
109 lda ,x+ get byte... | |
110 bpl CopyLoop while hi bit not set in A | |
860 | 111 ldb s.errcod,u get error number |
825 | 112 lda #$2F start out just below '0 |
860 | 113 Hundreds inca increment A |
114 subb #100 subtract | |
115 bcc Hundreds continue if carry clear | |
825 | 116 sta ,y+ else store as character |
117 lda #$3A start out just beyond '9 | |
860 | 118 Tens deca decrement A |
825 | 119 addb #10 add 10 to B |
860 | 120 bcc Tens continue if carry clear |
825 | 121 sta ,y+ save A |
122 tfr b,a transfer | |
123 adda #$30 add '0 | |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
196
diff
changeset
|
124 ldb #C$CR |
0 | 125 std ,y+ |
860 | 126 leax s.buffer,u point X at buffer |
825 | 127 WriteLn ldy #80 max string len |
860 | 128 lda s.erpath,u get stderr path |
825 | 129 os9 I$WritLn write it out |
0 | 130 rts |
131 | |
860 | 132 ASC2Byte clrb clear B |
133 ASC2BLp lda ,x+ get byte from X | |
825 | 134 suba #'0 make 8 bit integer |
135 cmpa #$09 compare against 9 | |
860 | 136 bhi ASC2BEx branch if greater |
825 | 137 pshs a else save A |
138 lda #10 multiply by 10 | |
139 mul do it | |
140 addb ,s+ add on stack | |
860 | 141 bcc ASC2BLp if carry clear, do it again |
142 ASC2BEx lda -1,x load byte | |
825 | 143 rts return |
0 | 144 |
145 emod | |
146 eom equ * | |
147 end | |
148 |