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