1: / putw/putc -- write words/characters on output file 2: / 3: / fcreat -- create an output file for use by put(w|c) 4: / 5: / calling sequences -- 6: / 7: / mov $filename,r0 8: / jsr r5,fcreat; ioptr 9: / 10: / on return ioptr is set up for use by put or error 11: / bit is set if file could not be created. 12: / 13: / mov(b) thing,r0 14: / jsr r5,put(w|c)1; ioptr 15: / 16: / the character or word is written out. 17: / 18: / jsr r5,flush; ioptr 19: / 20: / the buffer is fled. 21: / 22: 23: .globl putc, putw, flush, fcreat 24: 25: fcreat: 26: mov r1,-(sp) 27: mov (r5)+,r1 28: mov r0,0f 29: sys 0; 9f 30: .data 31: 9: 32: sys creat; 0:..; 666 33: .text 34: bes 1f 35: mov r0,(r1)+ 36: 2: 37: clr (r1)+ 38: clr (r1)+ 39: mov (sp)+,r1 40: rts r5 41: 1: 42: mov $-1,(r1)+ 43: mov (sp)+,r1 44: sec 45: rts r5 46: 47: .data 48: putw: 49: mov (r5),8f 50: mov (r5)+,9f 51: mov r0,-(sp) 52: jsr r5,putc; 8:.. 53: mov (sp)+,r0 54: swab r0 55: jsr r5,putc; 9:.. 56: rts r5 57: .text 58: 59: putc: 60: mov r1,-(sp) 61: mov (r5)+,r1 62: 1: 63: dec 2(r1) 64: bge 1f 65: mov r0,-(sp) 66: jsr pc,fl 67: mov (sp)+,r0 68: br 1b 69: 1: 70: movb r0,*4(r1) 71: inc 4(r1) 72: mov (sp)+,r1 73: rts r5 74: 75: flush: 76: mov r0,-(sp) 77: mov r1,-(sp) 78: mov (r5)+,r1 79: jsr pc,fl 80: mov (sp)+,r1 81: mov (sp)+,r0 82: rts r5 83: 84: fl: 85: mov r1,r0 86: add $6,r0 87: mov r0,-(sp) 88: mov r0,0f 89: mov 4(r1),0f+2 90: beq 1f 91: sub (sp),0f+2 92: mov (r1),r0 93: sys 0; 9f 94: .data 95: 9: 96: sys write; 0:..; .. 97: .text 98: 1: 99: mov (sp)+,4(r1) 100: mov $512.,2(r1) 101: rts pc