1: / getw/getc -- get words/characters from input file
   2: / fopen -- open a file for use by get(c|w)
   3: 
   4: indir = 0
   5: 
   6: .globl  _getc, _getw, _fopen
   7: .globl  cerror
   8: .comm   _errno,2
   9: 
  10: _fopen:
  11:         mov     r5,-(sp)
  12:         mov     sp,r5
  13:         mov     4(r5),0f
  14:         sys     0; 9f
  15:         .data
  16: 9:      sys     open; 0:..; 0
  17:         .text
  18:         bes     badret
  19:         mov     6(r5),r1
  20:         mov     r0,(r1)+
  21:         clr     (r1)+
  22:         clr     r0
  23:         mov     (sp)+,r5
  24:         rts     pc
  25: 
  26: _getw:
  27:         clr     _errno
  28:         mov     r5,-(sp)
  29:         mov     sp,r5
  30:         mov     4(r5),r1
  31:         sub     $2,2(r1)
  32:         bge     1f
  33:         cmp     2(r1),$-1
  34:         blt     2f
  35:         movb    *4(r1),-(sp)
  36:         jsr     pc,fill
  37:         mov     4(r1),r0
  38:         br      3f
  39: 2:
  40:         jsr     pc,fill
  41:         dec     2(r1)
  42: 1:
  43:         mov     4(r1),r0
  44:         movb    (r0)+,-(sp)
  45: 3:
  46:         movb    (r0)+,1(sp)
  47:         mov     r0,4(r1)
  48:         mov     (sp)+,r0
  49:         mov     (sp)+,r5
  50:         rts     pc
  51: 
  52: _getc:
  53:         mov     r5,-(sp)
  54:         mov     sp,r5
  55:         mov     4(r5),r1
  56:         dec     2(r1)
  57:         bge     1f
  58:         jsr     pc,fill
  59: 1:
  60:         clr     r0
  61:         bisb    *4(r1),r0
  62:         inc     4(r1)
  63:         mov     (sp)+,r5
  64:         rts     pc
  65: 
  66: fill:
  67:         mov     r1,r0
  68:         add     $6,r0
  69:         mov     r0,0f
  70:         mov     r0,4(r1)
  71:         mov     (r1),r0
  72:         sys     0; 9f
  73: .data
  74: 9:      sys     read; 0:..; 512.
  75: .text
  76:         bes     badret
  77:         dec     r0
  78:         bmi     badret
  79:         mov     r0,2(r1)
  80:         rts     pc
  81: 
  82: badret:
  83:         jmp     cerror

Defined functions

_fopen declared in line 6; defined in line 10; used 1 times
  • in line 6
_getc declared in line 6; defined in line 52; used 3 times
_getw declared in line 6; defined in line 26; used 1 times
  • in line 6
badret defined in line 82; used 3 times
fill defined in line 66; used 3 times
indir defined in line 4; never used

Defined variables

Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 719
Valid CSS Valid XHTML 1.0 Strict