1: / strip -- strip relocation and symbols
   2: 
   3:         mov     (sp)+,argc
   4:         tst     (sp)+
   5:         br      loop
   6: unloop:
   7:         sys     unlink; s.tmp
   8: loop:
   9:         dec     argc
  10:         bgt     1f
  11:         sys     exit
  12: 1:
  13:         mov     (sp)+,r4
  14:         mov     r4,0f
  15:         sys     open; 0:..; 0
  16:         bec     1f
  17:         jsr     r5,mesg; <open error: \0>; .even
  18:         br      loop
  19: 1:
  20:         mov     r0,fi
  21:         mov     $'a,r1
  22: 1:
  23:         movb    r1,s.tmp+8
  24:         sys     stat; s.tmp; buf
  25:         bec     2f
  26:         sys     creat; s.tmp; 400
  27:         bec     1f
  28: 2:
  29:         inc     r1
  30:         cmp     r1,$'z
  31:         blos    1b
  32:         jsr     r5,mesg; <can't create temp file for \0>; .even
  33:         sys     exit
  34: 1:
  35:         mov     r0,fo
  36:         clr     buf
  37:         mov     fi,r0
  38:         sys     read; buf; 512.
  39:         mov     r0,r3
  40:         cmp     buf,magic
  41:         beq     1f
  42:         cmp     buf,magic1
  43:         beq     1f
  44:         cmp     buf,magic2
  45:         beq     1f
  46:         jsr     r5,mesg; <improper format: \0>; .even
  47:         br      unloop
  48: 1:
  49:         mov     buf+2,r2
  50:         add     buf+4,r2
  51:         add     $20,r2
  52:         clr     r1
  53:         clr     buf+10
  54:         mov     $1,buf+16               / no reloc bits flag
  55: 1:
  56:         mov     r2,0f
  57:         sub     r1,0f
  58:         cmp     0f,r3
  59:         blos    2f
  60:         mov     r3,0f
  61: 2:
  62:         mov     fo,r0
  63:         sys     write; buf; 0:..
  64:         add     0b,r1
  65:         cmp     r1,r2
  66:         bhis    1f
  67:         mov     fi,r0
  68:         sys     read; buf; 512.
  69:         mov     r0,r3
  70:         bne     1b
  71:         jsr     r5,mesg; <unexpected EOF: \0>; .even
  72: 1:
  73:         mov     fo,r0
  74:         sys     close
  75:         mov     fi,r0
  76:         sys     close
  77:         mov     r4,0f
  78:         sys     creat; 0:..; 0          / same mode as before
  79:         bec     1f
  80:         jsr     r5,mesg; <can't rewrite: \0>; .even
  81:         jmp     unloop
  82: 1:
  83:         mov     r0,fo
  84:         sys     open; s.tmp; 0
  85:         bec     1f
  86:         jsr     r5,mesg; <can't read temp file for: \0>; .even
  87:         sys     exit
  88: 1:
  89:         mov     r0,fi
  90: 1:
  91:         mov     fi,r0
  92:         sys     read; buf; 512.
  93:         mov     r0,0f
  94:         beq     1f
  95:         mov     fo,r0
  96:         sys     write; buf; 0:..
  97:         br      1b
  98: 1:
  99:         mov     fi,r0
 100:         sys     close
 101:         mov     fo,r0
 102:         sys     close
 103:         jmp     unloop
 104: 
 105: mesg:
 106:         movb    (r5)+,ch
 107:         beq     1f
 108:         mov     $1,r0
 109:         sys     write; ch; 1
 110:         br      mesg
 111: 1:
 112:         inc     r5
 113:         bic     $1,r5
 114:         mov     r4,r1
 115: 1:
 116:         movb    (r1)+,ch
 117:         beq     1f
 118:         mov     $1,r0
 119:         sys     write; ch; 1
 120:         br      1b
 121: 1:
 122:         mov     $1,r0
 123:         sys     write; qnl; 1
 124:         rts     r5
 125: 
 126: s.tmp:
 127:         </tmp/stma\0>
 128: qnl:
 129:         <\n>
 130:         .even
 131: magic:  407
 132: magic1: 410
 133: magic2: 411
 134: 
 135: .bss
 136: fi:     .=.+2
 137: fo:     .=.+2
 138: argc:   .=.+2
 139: buf:    .=.+512.
 140: ch:     .=.+2

Defined functions

loop defined in line 8; used 2 times
  • in line 5, 18
magic defined in line 131; used 1 times
  • in line 40
magic1 defined in line 132; used 1 times
  • in line 42
magic2 defined in line 133; used 1 times
  • in line 44
mesg defined in line 105; used 7 times
qnl defined in line 128; used 1 times
s.tmp defined in line 126; used 5 times
unloop defined in line 6; used 3 times

Defined variables

argc defined in line 138; used 2 times
  • in line 3, 9
buf defined in line 139; used 14 times
ch defined in line 140; used 4 times
fi defined in line 136; used 7 times
fo defined in line 137; used 6 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 286
Valid CSS Valid XHTML 1.0 Strict