|
|
1.1 root 1: LL0:
2: .data
3: .set SBR,0
4: .set SLR,1
5: .set P0BR,2
6: .set P0LR,3
7: .set P1BR,4
8: .set P1LR,5
9: .set P2BR,6
10: .set P2LR,7
11: .set IPL,8
12: .set MAPEN,9
13: .set MME,9
14: .set TBIA,10
15: .set TBIS,11
16: .set DCK,12
17: .set CCK,13
18: .set PCBB,14
19: .set KSP,19
20: .set USP,20
21: .set CPMDCB,21
22: .set PADC,25
23: .set DCR,27
24: .set DC_ON,1
25: .set DC_OFF,2
26: .set TB_ON,256
27: .set TB_OFF,512
28: .align 2
29: .globl _ocnt
30: _ocnt:
31: .long 0
32: .align 2
33: .globl _icnt
34: _icnt:
35: .long 0
36: .text
37: .align 1
38: .globl _writec
39: _writec:
40: .word L15
41: #
42: # #include "definitions"
43: #
44: # /* I/O ROUTINES TO CPU2 CONSOLE */
45: #
46: # #define MAXC 1000 /* MAX 1000 chars per line */
47: # #define OUTADR 0x20000 /* Address of output buffer */
48: # #define INADR 0x20100 /* Address of input buffer */
49: #
50: # long ocnt = 0; /* Next location in output buffer */
51: # long icnt = 0; /* Next location in input buffer */
52: # extern long savvec7;
53: #
54: # writec(c) /* VERSION to run on the simmulator */
55: # char c;
56: # {
57: jbr L17
58: L18:
59: # putchar(c);
60: pushb 7(fp)
61: callf $8,_putchar
62: # }
63: ret
64: .set L15,0x0
65: L17:
66: jbr L18
67: .data
68: .text
69: .align 1
70: .globl _readc
71: _readc:
72: .word L21
73: #
74: # readc(c)
75: # char *c;
76: # { char *cptr;
77: jbr L23
78: L24:
79: #
80: # asm("mfpr $MME,_savvec7");
81: mfpr $MME,_savvec7
82: # savvec7 = savvec7 & 0x1;
83: andl3 $1,_savvec7,r0
84: movl r0,_savvec7
85: # asm("mtpr $0,$MME"); /* Disable MME */
86: mtpr $0,$MME
87: # cptr = (char *)(INADR+ icnt++);
88: addl3 $131328,_icnt,r0
89: movl r0,-56(fp)
90: incl _icnt
91: # *c = *cptr;
92: movb *-56(fp),*4(fp)
93: # asm("mtpr _savvec7,$MME"); /* Restore MME */
94: mtpr _savvec7,$MME
95: # }
96: ret
97: .set L21,0x0
98: L23:
99: subl3 $56,fp,sp
100: jbr L24
101: .data
102: .text
103: .align 1
104: .globl _writes
105: _writes:
106: .word L26
107: #
108: # writes(s)
109: # char *s;
110: # {
111: jbr L28
112: L29:
113: # putstr(s);
114: pushl 4(fp)
115: callf $8,_putstr
116: # }
117: ret
118: .set L26,0x0
119: L28:
120: jbr L29
121: .data
122: .text
123: .align 1
124: .globl _reads
125: _reads:
126: .word L32
127: #
128: # /* This function read a string of characters.
129: # calling sequence : nochar = reads(s);
130: # input argument : char *s;
131: # return value : no. of char read; excluding NULL or CR.
132: # */
133: # reads(s)
134: # char *s;
135: # { char *str;
136: jbr L34
137: L35:
138: # int ix;
139: #
140: # str = s;
141: movl 4(fp),-56(fp)
142: # for(ix=0;ix<ALINE;ix++)
143: clrl -60(fp)
144: L38:
145: cmpl -60(fp),$80
146: jgeq L37
147: # {
148: # readc(str);
149: pushl -56(fp)
150: callf $8,_readc
151: # if ((*str==NULL)||(*str==CR))
152: tstb *-56(fp)
153: jeql L9999
154: cmpb *-56(fp),$10
155: jneq L39
156: L9999:
157: # { *str = NULL;
158: clrb *-56(fp)
159: # break;
160: jbr L37
161: # }
162: # else str++;
163: L39:
164: incl -56(fp)
165: # }
166: L36:
167: incl -60(fp)
168: jbr L38
169: L37:
170: # icnt = 0; /* For simulator only */
171: clrl _icnt
172: #
173: # return(ix);
174: movl -60(fp),r0
175: ret
176: # }
177: ret
178: .set L32,0x0
179: L34:
180: subl3 $60,fp,sp
181: jbr L35
182: .data
183: .text
184: .align 1
185: .globl _writeh
186: _writeh:
187: .word L41
188: # /* This function read a string of HEX digit and
189: # convert it to integer value.
190: # calling sequence : stat = readh(ix);
191: # input parameter : long *ix;
192: # return value : (stat < 0) if error else (stat = 0);
193: # */
194: #
195: # /*
196: # readh(ix)
197: # long *ix;
198: # { char line[ALINE], *getnum(), *del;
199: # int nochar;
200: #
201: # if ( (nochar = reads(line)) > 8 ) return(-1);
202: # if ( (del = getnum(line,ix,del,HEX)) < 0 ) return(-1);
203: # else return(0);
204: # }
205: #
206: # */
207: #
208: #
209: #
210: # writeh(ix) /* 32 bits HEX */
211: # long ix;
212: # { long iy, temp, mask;
213: jbr L43
214: L44:
215: # int count;
216: # char c;
217: #
218: # iy=1; count = 28;
219: movl $1,-56(fp)
220: movl $28,-68(fp)
221: # mask = 0xf0000000;
222: movl $-268435456,-64(fp)
223: # while (mask)
224: L45:
225: tstl -64(fp)
226: jeql L46
227: # {
228: # c = ( (ix&mask) >> count )&0xf;
229: andl3 -64(fp),4(fp),r0
230: movl -68(fp),r1
231: shar r1,r0,r1
232: andl2 $15,r1
233: cvtlb r1,-69(fp)
234: # count -= 4;
235: subl2 $4,-68(fp)
236: # mask = mask >> 4;
237: shar $4,-64(fp),r0
238: movl r0,-64(fp)
239: # if (iy)
240: tstl -56(fp)
241: jeql L47
242: # { mask = 0xf000000;
243: movl $251658240,-64(fp)
244: # iy=0;
245: clrl -56(fp)
246: # }
247: # if ((c>=0)&&(c<=9)) c=c+'0';
248: L47:
249: tstb -69(fp)
250: jlss L48
251: cmpb -69(fp),$9
252: jgtr L48
253: cvtbl -69(fp),r0
254: addl2 $48,r0
255: cvtlb r0,-69(fp)
256: # else c=c+'7';
257: jbr L49
258: L48:
259: cvtbl -69(fp),r0
260: addl2 $55,r0
261: cvtlb r0,-69(fp)
262: L49:
263: # writec(c);
264: pushb -69(fp)
265: callf $8,_writec
266: # }
267: jbr L45
268: L46:
269: # }
270: ret
271: .set L41,0x0
272: L43:
273: subl3 $72,fp,sp
274: jbr L44
275: .data
276: .text
277: .align 1
278: .globl _writed
279: _writed:
280: .word L51
281: #
282: # /* This function read a string of DEC digit and
283: # convert it to integer value.
284: # calling sequence : stat = readd(ix);
285: # input parameter : long *ix;
286: # return value : (stat < 0) if error else (stat = 0);
287: # */
288: #
289: # /*
290: # readd(ix)
291: # long *ix;
292: # { char line[ALINE], *getnum(), *del;
293: # int nochar;
294: #
295: # if ( (nochar = reads(line)) > 11 ) return(-1);
296: # if ( (del = getnum(line,ix,del,DEC)) < 0 ) return(-1);
297: # else return(0);
298: # }
299: # */
300: #
301: #
302: # writed(ix) /* 32 bits DECIMAL */
303: # long ix;
304: # { char c;
305: jbr L53
306: L54:
307: # long div;
308: # float divi;
309: # int lead0;
310: #
311: # /*
312: # if (ix<0)
313: # { writes("********");
314: # return(0); }
315: # lead0 = 1;
316: # divi = 1000000000;
317: # div = divi;
318: # while (div)
319: # {
320: # c = (ix/div)+'0';
321: # ix = ix%div;
322: # divi = divi/10;
323: # div = divi;
324: # if ((c=='0')&&(lead0)) c=SPACE;
325: # else lead0 = 0;
326: # writec(c);
327: # }
328: # */
329: #
330: # }
331: ret
332: .set L51,0x0
333: L53:
334: subl3 $68,fp,sp
335: jbr L54
336: .data
337: #
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.