1: / time -- prints out system times
   2: 
   3: times = 43.
   4: 
   5:         cmp     (sp),$1
   6:         bgt     1f
   7:         sys     exit
   8: 1:
   9:         sys     time
  10:         mov     r1,ltbuf
  11:         jsr     pc,execarg
  12:         sys     time
  13:         sub     ltbuf,r1
  14:         sys     times; ltbuf
  15:         mov     r1,r0
  16:         mul     $60.,r0
  17:         mov     r0,ltbuf
  18:         mov     r1,ltbuf+2
  19:         jsr     r5,mesg; <\nreal\0>; .even
  20:         mov     $ltbuf,r2
  21:         jsr     r5,ptime
  22:         jsr     r5,mesg; <user\0>; .even
  23:         jsr     r5,ptime
  24:         jsr     r5,mesg; <sys \0>; .even
  25:         jsr     r5,ptime
  26:         sys     exit
  27: 
  28: execarg:
  29:         sys     fork
  30:                 br newproc
  31:         bec     2f
  32:         jsr     r5,mesg; <Try again.\n\0>; .even
  33:         sys     exit
  34: 2:
  35:         mov     r0,r2
  36:         sys     signal; 2; 1
  37: 2:
  38:         sys     wait
  39:         cmp     r0,r2
  40:         bne     2b
  41:         bit     $377,r1
  42:         beq     1f
  43:         jsr     r5,mesg; <Command terminated abnormally.\n\0>; .even
  44:         clr     r0
  45:         sys     seek; 0; 2
  46: 1:
  47:         rts     pc
  48: 
  49: newproc:
  50:         tst     (sp)+
  51:         mov     (sp)+,r0
  52:         tst     (sp)+
  53:         mov     $ibuf,r1
  54:         mov     $end,r2
  55: 1:
  56:         mov     (sp)+,r3
  57:         mov     r2,(r1)+
  58: 2:
  59:         movb    (r3)+,(r2)+
  60:         bne     2b
  61:         dec     r0
  62:         cmp     r0,$1
  63:         bgt     1b
  64:         clr     (r1)+
  65:         mov     $end,r1
  66:         sys     exec; end; ibuf
  67:         cmp     $8,r0
  68:         beq     rcom
  69:         mov     $end-10.,r0
  70:         mov     $"x/,(r0)+
  71:         mov     $"us,(r0)+
  72:         mov     $"r/,(r0)+
  73:         mov     $"bi,(r0)+
  74:         mov     $"n/,(r0)+
  75:         mov     $end-5,r1
  76:         sys     exec; end-5; ibuf
  77:         cmp     $8,r0
  78:         beq     rcom
  79:         mov     $end-9,r1
  80:         sys     exec; end-9.; ibuf
  81:         cmp     $8,r0
  82:         bne     1f
  83: rcom:
  84:         mov     r1,ibuf
  85:         mov     $shname+5,ibuf-2
  86:         sys     exec ; shname ; ibuf-2
  87: 1:
  88:         jsr     r5,mesg; <Command not found.\n\0>; .even
  89:         clr     r0
  90:         sys     seek; 0; 2
  91:         sys     exit
  92: 
  93: printd:
  94:         mov     $tbuf+4,r4
  95:         jsr     r5,tdiv; 10.
  96:         jsr     r5,tdiv; 10.
  97:         jsr     r5,tdiv; 10.
  98:         jsr     r5,tdiv; 10.
  99: 1:
 100:         cmpb    (r4),$'0
 101:         bne     1f
 102:         movb    $' ,(r4)+
 103:         cmp     r4,$tbuf+3
 104:         bne     1b
 105: 1:
 106:         mov     $2,r0
 107:         sys     write; tbuf; 4
 108:         rts     pc
 109: 
 110: ptime:
 111:         mov     (r2)+,r0
 112:         mov     (r2)+,r1
 113:         div     $3600.,r0
 114:         mov     r0,-(sp)
 115:         clr     r0
 116:         div     $60.,r0
 117:         mov     r1,clicks
 118:         mov     $tbuf+9.,r4
 119:         jsr     r5,tdiv; 10.
 120:         jsr     r5,tdiv; 6.
 121:         movb    $':,-(r4)
 122:         mov     (sp)+,r0
 123:         jsr     r5,tdiv; 10.
 124:         jsr     r5,tdiv; 6.
 125:         movb    $':,-(r4)
 126:         jsr     r5,tdiv; 10.
 127:         jsr     r5,tdiv; 10.
 128:         jsr     r5,tdiv; 10.
 129: 1:
 130:         cmpb    (r4),$'0
 131:         beq     2f
 132:         cmpb    (r4),$':
 133:         bne     1f
 134: 2:
 135:         movb    $' ,(r4)+
 136:         cmp     r4,$tbuf+8.
 137:         bne     1b
 138: 1:
 139:         mov     $2,r0
 140:         sys     write; tbuf; 9.
 141:         jsr     r5,mesg; <.\0>; .even
 142:         mov     clicks,r1
 143:         clr     r0
 144:         div     $6,r0
 145:         add     $'0,r0
 146:         mov     r0,ch
 147:         mov     $2,r0
 148:         sys     write; ch; 1
 149:         jsr     r5,mesg; <\n\0>; .even
 150:         rts     r5
 151: 
 152: tdiv:
 153:         mov     r1,-(sp)
 154:         mov     r0,r1
 155:         clr     r0
 156:         div     (r5)+,r0
 157:         add     $'0,r1
 158:         movb    r1,-(r4)
 159:         mov     (sp)+,r1
 160:         rts     r5
 161: 
 162: mesg:
 163:         movb    (r5)+,ch
 164:         beq     2f
 165:         mov     $2,r0
 166:         sys     write; ch; 1
 167:         br      mesg
 168: 2:
 169:         inc     r5
 170:         bic     $1,r5
 171:         rts     r5
 172: 
 173: ch:     .=.+1
 174: .even
 175: .bss
 176: 
 177: clicks: .=.+2
 178:         .=.+2
 179: ibuf:   .=.+50.
 180: tbuf:   .=.+10.
 181: ltbuf:  .=.+16.
 182: end:    .=.+1000.
 183: 
 184: .data
 185: shname: </bin/sh\0>
 186: .even

Defined functions

ch defined in line 173; used 4 times
execarg defined in line 28; used 1 times
  • in line 11
mesg defined in line 162; used 9 times
newproc defined in line 49; used 1 times
  • in line 30
printd defined in line 93; never used
ptime defined in line 110; used 3 times
rcom defined in line 83; used 2 times
tdiv defined in line 152; used 11 times
times defined in line 3; used 1 times
  • in line 14

Defined variables

clicks defined in line 177; used 2 times
end defined in line 182; used 8 times
ibuf defined in line 179; used 7 times
ltbuf defined in line 181; used 6 times
shname defined in line 185; used 2 times
tbuf defined in line 180; used 6 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 297
Valid CSS Valid XHTML 1.0 Strict