1: / qsort interfact to c
   2: 
   3: /	qsort(from, to)
   4: 
   5: .globl  _qsort
   6: _qsort:
   7:         mov     2(sp),r1
   8:         mov     4(sp),r2
   9:         jsr     pc,qsort
  10:         rts     pc
  11: 
  12: 
  13: qsort:
  14:         mov     r2,r3
  15:         sub     r1,r3
  16:         cmp     r3,$4
  17:         ble     done
  18:         asr     r3
  19:         bic     $3,r3
  20:         add     r1,r3
  21:         mov     r1,-(sp)
  22:         mov     r2,-(sp)
  23: 
  24: loop:
  25:         cmp     r1,r3
  26:         bhis    loop1
  27:         cmp     (r1),(r3)
  28:         bgt     loop1
  29:         add     $4,r1
  30:         br      loop
  31: 
  32: loop1:
  33:         cmp     r2,r3
  34:         blos    1f
  35:         sub     $4,r2
  36:         mov     r2,r0
  37:         cmp     (r0),(r3)
  38:         bge     loop1
  39: 
  40:         mov     (r1),r0
  41:         mov     (r2),(r1)+
  42:         mov     r0,(r2)+
  43:         mov     (r1),r0
  44:         mov     (r2),(r1)
  45:         mov     r0,(r2)
  46:         cmp     -(r1),-(r2)
  47:         cmp     r1,r3
  48:         bne     loop
  49:         mov     r2,r3
  50:         br      loop
  51: 
  52: 1:
  53:         cmp     r1,r3
  54:         beq     1f
  55:         mov     (r1),r0
  56:         mov     (r2),(r1)+
  57:         mov     r0,(r2)+
  58:         mov     (r1),r0
  59:         mov     (r2),(r1)
  60:         mov     r0,(r2)
  61:         cmp     -(r1),-(r2)
  62:         mov     r1,r3
  63:         br      loop1
  64: 
  65: 1:
  66:         mov     (sp)+,r2
  67:         mov     r3,-(sp)
  68:         mov     r3,r1
  69:         add     $4,r1
  70:         jsr     pc,qsort
  71:         mov     (sp)+,r2
  72:         mov     (sp)+,r1
  73:         br      qsort
  74: 
  75: done:
  76:         rts     pc
  77: 
  78:         rti = 2
  79: 
  80: /	itinit()
  81: 
  82: .globl  _itinit
  83: .globl  _intrp, _term
  84: .globl  _signal
  85: 
  86: _itinit:
  87:         mov     $1,-(sp)
  88:         mov     $1,-(sp)
  89:         jsr     pc,_signal
  90:         cmp     (sp)+,(sp)+
  91:         bit     $1,r0
  92:         bne     1f
  93:         mov     $_onhup,-(sp)
  94:         mov     $1,-(sp)
  95:         jsr     pc,_signal
  96:         cmp     (sp)+,(sp)+
  97: 1:
  98: 
  99:         mov     $1,-(sp)
 100:         mov     $2,-(sp)
 101:         jsr     pc,_signal
 102:         cmp     (sp)+,(sp)+
 103:         bit     $1,r0
 104:         bne     1f
 105:         mov     $onint,-(sp)
 106:         mov     $2,-(sp)
 107:         jsr     pc,_signal
 108:         cmp     (sp)+,(sp)+
 109: 1:
 110:         mov     $1,-(sp)
 111:         mov     $3,-(sp)
 112:         jsr     pc,_signal
 113:         cmp     (sp)+,(sp)+
 114:         rts     pc
 115: 
 116: .globl  _onhup
 117: _onhup:
 118:         mov     $1,-(sp)
 119:         mov     $1,-(sp)
 120:         jsr     pc,_signal
 121:         cmp     (sp)+,(sp)+
 122:         mov     $1,-(sp)
 123:         mov     $2,-(sp)
 124:         jsr     pc,_signal
 125:         cmp     (sp)+,(sp)+
 126:         mov     $1,-(sp)
 127:         mov     $3,-(sp)
 128:         jsr     pc,_signal
 129:         cmp     (sp)+,(sp)+
 130:         jmp     _term
 131: 
 132: onint:
 133:         mov     r0,-(sp)
 134:         mov     $onint,-(sp)
 135:         mov     $2,-(sp)
 136:         jsr     pc,_signal
 137:         cmp     (sp)+,(sp)+
 138:         inc     _intrp
 139:         mov     (sp)+,r0
 140:         rts     pc
 141: 
 142: /	t = clock()
 143: 
 144: .globl  _clock
 145: .globl  _time
 146: _clock:
 147:         clr     -(sp)
 148:         jsr     pc,_time
 149:         tst     (sp)+
 150:         mov     r0,-(sp)
 151:         mov     r1,-(sp)
 152:         sub     t+2,r1
 153:         sbc     r0
 154:         sub     t,r0
 155:         mov     r1,r0
 156:         mov     (sp)+,t+2
 157:         mov     (sp)+,t
 158:         rts     pc
 159: 
 160: .bss
 161: t:      .=.+4

Defined functions

_clock declared in line 144; defined in line 146; used 4 times
_itinit declared in line 82; defined in line 86; used 2 times
_onhup declared in line 116; defined in line 117; used 8 times
_qsort declared in line 5; defined in line 6; used 6 times
done defined in line 75; used 1 times
  • in line 17
loop defined in line 24; used 3 times
loop1 defined in line 32; used 4 times
onint defined in line 132; used 2 times
qsort defined in line 13; used 3 times

Defined variables

t defined in line 161; used 4 times
Last modified: 1987-08-04
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1064
Valid CSS Valid XHTML 1.0 Strict