|
|
1.1 ! root 1: # ! 2: # 31write.s ! 3: # ! 4: # WRITE OPERATIONS ! 5: # ! 6: _PUT: ! 7: incl r10 ! 8: bbc $fWRITE,FUNIT(r7),ewriteit ! 9: pushl FBUF(r7) #stream ! 10: pushl $1 #number of items ! 11: pushl FSIZE(r7) #item size ! 12: pushl r7 #ptr to data ! 13: calls $4,_fwrite ! 14: cleanup: ! 15: movl FBUF(r7),r5 #ptr to FILE ! 16: bbs $ioERR,FLAG(r5),ewrite ! 17: cmpl r7,$stdout #check for output to stdout ! 18: bneq l3101 ! 19: tstw _bufopt #check for buffering on stdout ! 20: bneq l3101 ! 21: pushl r5 #if unbuffered then flush ! 22: calls $1,_fflush ! 23: l3101: ! 24: jmp (r8) ! 25: ewriteit: ! 26: movw $EWRITEIT,_perrno ! 27: jbr error ! 28: ewrite: ! 29: movw $EWRITE,_perrno ! 30: jbr error ! 31: ! 32: _WRITEF: ! 33: cvtbl (r10)+,r6 #r6 has length of format string ! 34: cvtwl (r10)+,r5 #r5 has number of longword arguements ! 35: fentry: ! 36: bbc $fWRITE,FUNIT(r7),ewriteit ! 37: pushal (sp)[r5] #addr of format string ! 38: pushl FBUF(r7) #stream ! 39: addl2 $2,r5 #r5 has total number of arguements ! 40: calls r5,_fprintf #output formatted data ! 41: addl2 r6,sp #pop format string ! 42: jbr cleanup ! 43: ! 44: _WRITLN: ! 45: aobleq LLIMIT(r7),LCOUNT(r7),l3105 ! 46: movw $ELLIMIT,_perrno ! 47: jbr error ! 48: l3105: ! 49: movw $linefeed,-(sp) #push a linefeed ! 50: clrl r6 ! 51: cmpl r7,$stdout #check for flushing ! 52: bneq l3102 ! 53: cmpw $1,_bufopt #check for eoln flushing ! 54: bneq l3102 ! 55: incl r6 #set flush request ! 56: brb l3102 ! 57: _PAGE: ! 58: movw $formfeed,-(sp) #push a formfeed ! 59: _WRITEC: ! 60: clrl r6 ! 61: l3102: ! 62: incl r10 ! 63: jbc $fWRITE,FUNIT(r7),ewriteit ! 64: cvtwl (sp)+,r2 #hold data ! 65: pushl FBUF(r7) #stream ! 66: pushl r2 #push data ! 67: calls $2,_fputc ! 68: jlbc r6,cleanup #if no flush request, normal exit ! 69: movl FBUF(r7),r5 ! 70: jbs $ioERR,FLAG(r5),ewrite #check for I/O error ! 71: pushl r5 #flush ! 72: calls $1,_fflush ! 73: jmp (r8) ! 74: ! 75: _WRITES: ! 76: cvtbl (r10)+,r5 #r5 has length of format string ! 77: cvtwl (r10)+,r6 #r6 has length of data ! 78: sentry: ! 79: jbc $fWRITE,FUNIT(r7),ewriteit ! 80: addl2 sp,r6 #r6 pts to format string ! 81: pushl sp #ptr to data ! 82: pushl r6 #ptr to format string ! 83: addl2 r5,r6 #r6 points to cleared top of stack ! 84: pushl FBUF(r7) #stream ! 85: calls $3,_fprintf #output string ! 86: movl r6,sp #pop data and format string ! 87: jbr cleanup ! 88: ! 89: _WRITEB: ! 90: cvtbl (r10)+,r6 #r6 has length of format string ! 91: bentry: ! 92: jbc $fWRITE,FUNIT(r7),ewriteit ! 93: movw (sp)+,r0 #push addr of appropriate string ! 94: beql l3103 ! 95: pushal s_true ! 96: brb l3104 ! 97: l3103: ! 98: pushal s_false ! 99: l3104: ! 100: pushal 4(sp) #addr of format string ! 101: pushl FBUF(r7) #stream ! 102: calls $3,_fprintf #print boolean ! 103: addl2 r6,sp #pop format string ! 104: jbr cleanup ! 105: ! 106: s_true: .byte 't,'r,'u,'e,linefeed,0 ! 107: s_false:.byte 'f,'a,'l,'s,'e,linefeed,0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.