home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / 2014.11.minnie.tuhs.org.tar / minnie.tuhs.org / UnixArchive / PDP-11 / Trees / V6 / usr / source / s5 / putchr.s < prev    next >
Text File  |  1975-05-14  |  585b  |  56 lines

  1. / C library -- putchar
  2.  
  3.     .globl    _putchar,_flush
  4.     .globl    _fout
  5.  
  6. _putchar:
  7.     mov    r5,-(sp)
  8.     mov    sp,r5
  9.     mov    _fout+4,r0
  10.     bne    1f
  11.     jsr    pc,fl
  12.     mov    _fout+4,r0
  13. 1:
  14.     movb    4(r5),(r0)+
  15.     beq    1f
  16.     inc    _fout+4
  17.     dec    _fout+2
  18.     bgt    1f
  19.     jsr    pc,fl
  20. 1:
  21.     mov    4(r5),r0
  22.     mov    (sp)+,r5
  23.     rts    pc
  24.  
  25. _flush:
  26.     mov    r5,-(sp)
  27.     mov    sp,r5
  28.     jsr    pc,fl
  29.     mov    (sp)+,r5
  30.     rts    pc
  31.  
  32. fl:
  33.     mov    _fout+4,r0
  34.     beq    1f
  35.     sub    $_fout+6,r0
  36.     mov    r0,0f
  37.     mov    _fout,r0
  38.     bne    2f
  39.     inc    r0
  40. 2:
  41.     sys    0; 9f
  42. .data
  43. 9:    sys    write; _fout+6; 0:..
  44. .text
  45. 1:
  46.     mov    $_fout+6,_fout+4
  47.     mov    $512.,_fout+2
  48.     cmp    _fout,$2
  49.     bhi    1f
  50.     mov    $1,_fout+2
  51. 1:
  52.     rts    pc
  53.  
  54. .bss
  55. _fout:    .=.+518.
  56.