1: / sum -- check sum file
   2: 
   3:         mov     (sp)+,r3
   4:         tst     (sp)+
   5: loop:   dec     r3
   6:         bgt     1f
   7:         sys     exit
   8: 1:
   9:         clr     bcnt
  10:         mov     (sp)+,0f
  11:         sys     open; 0:..; 0
  12:         bec     3f
  13:         mov     $1,r0
  14:         sys     write; 1f; 2f-1f
  15:         br      loop
  16: 1:      <oprd\n>
  17: 2:      .even
  18: 3:      mov     r0,r1
  19:         clr     r5
  20: 1:
  21:         mov     r1,r0
  22:         sys     read; buf; 512.
  23:         bes     err
  24:         tst     r0
  25:         beq     print
  26:         inc     bcnt
  27:         mov     $buf,r2
  28: 2:
  29:         movb    (r2)+,r4
  30:         add     r4,r5
  31:         adc     r5
  32:         sob     r0,2b
  33:         br      1b
  34: 
  35: err:
  36:         mov     $1,r0
  37:         sys     write; 1f; 2
  38: 
  39: print:
  40:         jsr     pc,decml
  41:         mov     $1,r0
  42:         sys     write; bl; 1
  43:         mov     bcnt,r5
  44:         jsr     pc,decml
  45:         mov     $1,r0
  46:         sys     write; nl; 1
  47:         mov     r1,r0
  48:         sys     close
  49:         br      loop
  50: 1:      <? >
  51: nl:     <\n>
  52: bl:     < >
  53:         .even
  54: 
  55: decml:
  56:         mov     r0,-(sp)
  57:         mov     r1,-(sp)
  58:         mov     r5,r1
  59:         jsr     pc,1f
  60:         mov     (sp)+,r1
  61:         mov     (sp)+,r0
  62:         rts     pc
  63: 
  64: 1:
  65:         clr     r0
  66:         dvd     $10.,r0
  67:         mov     r1,-(sp)
  68:         mov     r0,r1
  69:         beq     1f
  70:         jsr     pc,1b
  71: 1:
  72:         mov     (sp)+,ch
  73:         add     $'0,ch
  74:         mov     $1,r0
  75:         sys     write; ch; 1
  76:         rts     pc
  77: 
  78: .bss
  79: ch:     .=.+2
  80: bcnt:   .=.+2
  81: buf: .=.+512.

Defined functions

bl defined in line 52; used 1 times
  • in line 42
decml defined in line 55; used 2 times
err defined in line 35; used 1 times
  • in line 23
loop defined in line 5; used 2 times
nl defined in line 51; used 1 times
  • in line 46
print defined in line 39; used 1 times
  • in line 25

Defined variables

bcnt defined in line 80; used 3 times
buf defined in line 81; used 2 times
ch defined in line 79; used 3 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 284
Valid CSS Valid XHTML 1.0 Strict