|
|
1.1 root 1: #
2: # Copyright (c) 1979 Regents of the University of California
3: #
4: # char sccsid[] = "@(#)31write.s 4.1 10/10/80";
5: #
6: # WRITE OPERATIONS
7: #
8: _PUT:
9: incl r10
10: bbc $fWRITE,FUNIT(r7),ewriteit
11: pushl FBUF(r7) #stream
12: pushl $1 #number of items
13: pushl FSIZE(r7) #item size
14: pushl r7 #ptr to data
15: calls $4,_fwrite
16: movl FBUF(r7),r5 #ptr to FILE
17: bbs $ioERR,FLAG(r5),ewrite
18: jmp (r8)
19:
20: _WRITEF:
21: cvtbl (r10)+,r5 #r5 has number of longword arguements
22: bbc $fWRITE,FUNIT(r7),ewriteit
23: calls r5,_fprintf #output formatted data
24: movl FBUF(r7),r5 #ptr to FILE
25: bbs $ioERR,FLAG(r5),ewrite
26: jmp (r8)
27:
28: _WRITEC:
29: incl r10
30: bbc $fWRITE,FUNIT(r7),ewriteit
31: pushl FBUF(r7) #stream
32: pushl 4(sp) #push data
33: calls $3,_fputc
34: movl FBUF(r7),r5
35: bbs $ioERR,FLAG(r5),ewrite #check for I/O error
36: jmp (r8)
37: ewriteit:
38: movw $EWRITEIT,_perrno
39: jbr error
40: ewrite:
41: movw $EWRITE,_perrno
42: jbr error
43:
44: _WRITES:
45: incl r10
46: bbc $fWRITE,FUNIT(r7),ewriteit
47: calls $4,_fwrite #output string
48: movl FBUF(r7),r5 #ptr to FILE
49: bbs $ioERR,FLAG(r5),ewrite
50: jmp (r8)
51:
52: _WRITLN:
53: incl r10
54: aobleq LLIMIT(r7),LCOUNT(r7),l3101
55: movw $ELLIMIT,_perrno
56: jbr error
57: l3101:
58: bbc $fWRITE,FUNIT(r7),ewriteit
59: pushl FBUF(r7) #stream
60: pushl $linefeed #push a linefeed
61: calls $2,_fputc
62: movl FBUF(r7),r5
63: bbs $ioERR,FLAG(r5),ewrite #check for I/O error
64: jmp (r8)
65:
66: _PAGE:
67: incl r10
68: bbc $fWRITE,FUNIT(r7),ewriteit
69: pushl FBUF(r7) #stream
70: pushl $formfeed #push a formfeed
71: calls $2,_fputc
72: movl FBUF(r7),r5
73: jbs $ioERR,FLAG(r5),ewrite #check for I/O error
74: jmp (r8)
75:
76: _NAM:
77: incl r10
78: addl3 (r10)+,ap,r6 #r6 points to scalar name list
79: movl (sp)+,r3 #r3 has data value
80: cmpw r3,(r6)+ #check for value out of range
81: bgequ enamrng
82: movzwl (r6)[r3],r4 #r4 has string index
83: pushab (r6)[r4] #push string ptr
84: jmp (r8)
85: enamrng:
86: movw $ENAMRNG,_perrno
87: jbr error
88: _MAX:
89: cvtbl (r10)+,r0 #r0 has width value
90: bneq l3105
91: movzwl (r10)+,r0
92: l3105:
93: movzwl (r10)+,r1 #r1 has minimum width value
94: movl (sp),r2 #r2 has requested width
95: blss efmt #check for negative values
96: subl2 r0,r2 #shave down value
97: cmpl r1,r2 #check for below minimum width
98: bleq l3106
99: movl r1,(sp) #force to be at least minimum width
100: jmp (r8)
101: l3106:
102: movl r2,(sp) #set to reduced value
103: jmp (r8)
104: efmt:
105: movw $EFMTSIZE,_perrno
106: jbr error
107: _MIN:
108: cvtbl (r10)+,r0 #r0 has width value
109: bneq l3107
110: movzwl (r10)+,r0
111: l3107:
112: cmpl (sp),r0 #check for greater than max allowed
113: blss l3108
114: movl r0,(sp) #use smaller value
115: l3108:
116: jmp (r8)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.