1: / putw/putc -- write words/characters on output file
   2: 
   3:         .globl  _putc, _putw, _fflush, _fcreat
   4:         .globl  _werflg
   5:         .comm   _errno,2
   6: 
   7: _fcreat:
   8:         mov     r5,-(sp)
   9:         mov     sp,r5
  10:         mov     6(r5),r1
  11:         mov     pc,(r1)         / a putatively illegal file desc.
  12:         mov     $0644,-(sp)
  13:         mov     4(r5),-(sp)
  14:         jsr     pc,_creat
  15:         cmp     (sp)+,(sp)+
  16:         tst     r0
  17:         bmi     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:         tst     4(r1)
  70:         beq     1f
  71:         mov     4(r1),-(sp)
  72:         sub     r0,(sp)
  73:         mov     r0,-(sp)
  74:         mov     (r1),-(sp)
  75:         jsr     pc,_write
  76:         add     $6,sp
  77:         tst     r0
  78:         bpl     1f
  79:         mov     r0,_werflg
  80: 1:
  81:         mov     (sp)+,4(r1)
  82:         mov     $512.,2(r1)
  83:         rts     pc
  84: 
  85: badret:
  86:         mov     r5,sp
  87:         mov     (sp)+,r5
  88:         rts     pc
  89: 
  90: goodret:
  91:         clr     _errno
  92:         mov     (sp)+,r5
  93:         rts     pc
  94: .bss
  95: _werflg:.=.+2

Defined functions

_fcreat declared in line 3; defined in line 7; used 1 times
  • in line 3
_putc declared in line 3; defined in line 44; used 3 times
_putw declared in line 3; defined in line 23; used 1 times
  • in line 3
badret defined in line 85; used 1 times
  • in line 17
fl defined in line 65; used 4 times
goodret defined in line 90; used 4 times

Defined variables

_errno defined in line 5; used 1 times
  • in line 91
_werflg declared in line 4; defined in line 95; used 2 times
  • in line 4, 79
Last modified: 1987-03-13
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2649
Valid CSS Valid XHTML 1.0 Strict