1: / nlist -- extract values from name list
   2: /
   3: 
   4: /	nlist(file, list);
   5: /
   6: .globl  _nlist
   7: 
   8: _nlist:
   9:         mov     r5,-(sp)
  10:         mov     sp,r5
  11:         mov     4(r5),0f
  12:         mov     6(r5),r1
  13:         mov     r2,-(sp)
  14: 
  15:         mov     r1,r0
  16: 1:
  17:         tst     (r0)
  18:         beq     1f
  19:         add     $8.,r0
  20:         clr     (r0)+
  21:         clr     (r0)+                   / initialize to undefined
  22:         br      1b
  23: 1:
  24:         sys     0; 9f
  25: .data
  26: 9:
  27:         sys     open; 0:..; 0
  28: .text
  29:         bes     done
  30:         mov     r0,r2
  31:         sys     read; buf; 20
  32:         cmp     r0,$20
  33:         bne     cdone
  34:         mov     buf+4,count                     / assume older a.out
  35:         mov     buf+2,0f
  36:         cmp     buf,$405
  37:         beq     1f
  38:         mov     buf+8.,count                    / now assume newer
  39:         mov     buf+2,r0                        / txt
  40:         add     buf+4,r0                        / data
  41:         cmp     buf+16,$1                       / relocation?
  42:         beq     4f
  43:         asl     r0                              / txt+data reloc
  44: 4:
  45:         add     $20,r0                          / header
  46:         mov     r0,0f
  47:         cmp     buf,$411
  48:         beq     1f
  49:         cmp     buf,$410
  50:         beq     1f
  51:         cmp     buf,$407
  52:         bne     cdone
  53: 1:
  54:         mov     r2,r0
  55:         sys     0; 9f
  56: .data
  57: 9:
  58:         sys     seek; 0:..; 0
  59: .text
  60: 
  61: 1:
  62:         sub     $12.,count
  63:         blt     cdone
  64:         mov     r2,r0
  65:         sys     read; buf; 12.
  66:         cmp     r0,$12.
  67:         bne     cdone
  68:         mov     r1,r0
  69: 
  70: 2:
  71:         tst     (r0)
  72:         beq     1b
  73:         cmp     (r0),buf
  74:         bne     1f
  75:         cmp     2(r0),buf+2
  76:         bne     1f
  77:         cmp     4(r0),buf+4
  78:         bne     1f
  79:         cmp     6(r0),buf+6
  80:         bne     1f
  81:         mov     buf+8.,8.(r0)
  82:         mov     buf+10.,10.(r0)
  83: 1:
  84:         add     $12.,r0
  85:         br      2b
  86: 
  87: cdone:
  88:         mov     r2,r0
  89:         sys     close
  90: 
  91: done:
  92:         mov     (sp)+,r2
  93:         mov     (sp)+,r5
  94:         rts     pc
  95: 
  96: .bss
  97: buf:    .=.+20
  98: count:  .=.+2

Defined functions

_nlist declared in line 6; defined in line 8; used 2 times
cdone defined in line 87; used 4 times
done defined in line 91; used 1 times
  • in line 29

Defined variables

buf defined in line 97; used 18 times
count defined in line 98; used 3 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 510
Valid CSS Valid XHTML 1.0 Strict