1: / putw/putc -- write words/characters on output file 2: 3: .globl _putc, _putw, _fflush, _fcreat 4: .globl cerror 5: .comm _errno,2 6: 7: _fcreat: 8: mov r5,-(sp) 9: mov sp,r5 10: mov 4(r5),0f 11: mov 6(r5),r1 12: mov pc,(r1) / a putatively illegal file desc. 13: sys 0; 9f 14: .data 15: 9: sys creat; 0:..; 666 16: .text 17: bes badret 18: mov r0,(r1)+ 19: clr (r1)+ 20: clr (r1)+ 21: br goodret 22: 23: _putw: 24: mov r5,-(sp) 25: mov sp,r5 26: mov 6(r5),r1 27: dec 2(r1) 28: bge 1f 29: jsr pc,fl 30: dec 2(r1) 31: 1: 32: movb 4(r5),*4(r1) 33: inc 4(r1) 34: dec 2(r1) 35: bge 1f 36: jsr pc,fl 37: dec 2(r1) 38: 1: 39: movb 5(r5),*4(r1) 40: inc 4(r1) 41: mov 4(r5),r0 42: br goodret 43: 44: _putc: 45: mov r5,-(sp) 46: mov sp,r5 47: mov 6(r5),r1 48: dec 2(r1) 49: bge 1f 50: jsr pc,fl 51: dec 2(r1) 52: 1: 53: mov 4(r5),r0 54: movb r0,*4(r1) 55: inc 4(r1) 56: br goodret 57: 58: _fflush: 59: mov r5,-(sp) 60: mov sp,r5 61: mov 4(r5),r1 62: jsr pc,fl 63: br goodret 64: 65: fl: 66: mov r1,r0 67: add $6,r0 68: mov r0,-(sp) 69: mov r0,0f 70: mov 4(r1),0f+2 71: beq 1f 72: sub r0,0f+2 73: mov (r1),r0 74: sys 0; 9f 75: .data 76: 9: sys write; 0:..; .. 77: .text 78: 1: 79: mov (sp)+,4(r1) 80: mov $512.,2(r1) 81: rts pc 82: 83: badret: 84: jmp cerror 85: 86: goodret: 87: clr _errno 88: mov (sp)+,r5 89: rts pc