1: / 2: / BUILT IN FUNCTIONS 3: / 4: _LLIMIT: 5: add $4.,sp 6: return 7: _ARGC: 8: mov _argc,-(sp) 9: sxt -(sp) 10: return 11: _ARGV: 12: bne 1f 13: mov (lc)+,r3 14: 1: 15: mov (sp)+,r1 16: mov (sp)+,r0 17: blt 9f 18: cmp r0,_argc 19: bge 9f 20: add r0,r0 21: add _argv,r0 22: mov (r0),r0 23: inc r3 24: br 3f 25: 1: 26: movb (r0)+,r2 27: bne 2f 28: dec r0 29: mov $' ,r2 30: 2: 31: movb r2,(r1)+ 32: 3: 33: sob r3,1b 34: return 35: 9: 36: mov $EARGV,_perrno 37: error EARGV 38: _SCLCK: 39: mov $6,-(sp) 40: br 1f 41: _CLCK: 42: mov $2,-(sp) 43: 1: 44: sub $16.,sp 45: mov sp,0f 46: sys indir; 1f 47: mov sp,r0 48: add 16.(sp),r0 49: mov (r0),r0 50: add $18.,sp 51: mul $1000.,r0 52: mov r1,-(sp) 53: mov r0,-(sp) 54: movif (sp)+,fr0 55: mov $HZ,-(sp) 56: sxt -(sp) 57: movif (sp)+,fr1 58: divf fr1,fr0 59: movfi fr0,-(sp) 60: return 61: .data 62: 1: 63: sys times; 0:.. 64: .text 65: _DATE: 66: _TIME: 67: asr r0 68: bic $!377,r0 69: mov r0,-(sp) 70: jsr pc,_pdattim 71: cmp (sp)+,(sp)+ 72: return 73: _SEED: 74: mov (sp)+,r0 75: mov (sp)+,r1 76: mov _seed+2,-(sp) 77: mov _seed,-(sp) 78: mov r0,_seed 79: mov r1,_seed+2 80: return 81: _RANDOM: 82: movif _seed,fr0 83: mulf _randa,fr0 84: addf _randc,fr0 85: movf fr0,fr2 86: modf _randim,fr2 87: movf fr2,(sp) 88: mulf _randm,fr2 89: movfi fr2,_seed 90: return 91: _DISPOSE: 92: tst (sp) 93: beq 1f 94: jsr pc,_free 95: 1: 96: tst (sp)+ 97: return 98: _NEW: 99: bne 1f 100: mov (lc)+,r3 101: 1: 102: mov r3,-(sp) 103: jsr pc,_alloc 104: tst (sp)+ 105: mov r0,*(sp)+ 106: return 107: _EXPO: 108: movf (sp)+,fr0 109: movei fr0,-(sp) 110: sxt -(sp) 111: return 112: _ATAN: 113: seti 114: jsr pc,_atan 115: setl 116: movf fr0,(sp) 117: return 118: _COS: 119: seti 120: jsr pc,_cos 121: setl 122: movf fr0,(sp) 123: return 124: _EXP: 125: seti 126: jsr pc,_exp 127: setl 128: movf fr0,(sp) 129: return 130: _LN: 131: tstf (sp) 132: cfcc 133: ble 9f 134: seti 135: jsr pc,_log 136: setl 137: movf fr0,(sp) 138: return 139: 9: 140: mov $ELN,_perrno 141: error ELN 142: _SIN: 143: seti 144: jsr pc,_sin 145: setl 146: movf fr0,(sp) 147: return 148: _SQRT: 149: movf (sp),fr0 150: cfcc 151: bmi 9f 152: seti 153: jsr pc,_sqrt 154: setl 155: movf fr0,(sp) 156: return 157: 9: 158: mov $ESQRT,_perrno 159: error ESQRT 160: _CHR4: 161: tst (sp)+ 162: bne 1f 163: _CHR2: 164: cmp (sp),$177 165: bhi 1f 166: return 167: 1: 168: mov $ECHR,_perrno 169: error ECHR 170: _ODD4: 171: tst (sp)+ 172: _ODD2: 173: bic $!1,(sp) 174: return 175: _PRED2: 176: dec (sp) 177: return 178: _PRED4: 179: sub $1,2(sp) 180: sbc (sp) 181: return 182: _PRED24: 183: sub $1,(sp) 184: sxt -(sp) 185: return 186: _STLIM: 187: mov (sp)+,r0 188: bge 1f 189: tst (sp)+ 190: return 191: 1: 192: mov (sp)+,r1 193: sub _stcnt+2,r1 194: sbc r0 195: sub _stcnt,r0 196: ashc $0,r0 197: bge 1f 198: mov $ESTLIM,_perrno 199: error ESTLIM 200: 1: 201: mov r0,_stlim 202: mov r1,_stlim+2 203: return 204: _SUCC2: 205: inc (sp) 206: return 207: _SUCC4: 208: add $1,2(sp) 209: adc (sp) 210: return 211: _SUCC24: 212: add $1,(sp) 213: sxt -(sp) 214: return 215: _ROUND: 216: movf (sp)+,fr0 217: cfcc 218: bmi 1f 219: addf $HALF,fr0 220: br 2f 221: 1: 222: subf $HALF,fr0 223: 2: 224: movfi fr0,-(sp) 225: return 226: _TRUNC: 227: movf (sp)+,fr0 228: movfi fr0,-(sp) 229: return 230: _UNDEF: 231: add $8,sp 232: clr -(sp) 233: return 234: / 235: / pack(a,i,z) 236: / 237: / with: a: array[m..n] of t 238: / z: packed array[u..v] of t 239: / 240: / semantics: for j := u to v do 241: / z[j] := a[j-u+i]; 242: / 243: / need to check: 244: / 1. i >= m 245: / 2. i+(v-u) <= n (i.e. i-m <= (n-m)-(v-u)) 246: / 247: / on stack: lv(z), lv(a), rv(i) (len 2) 248: / 249: / move w(t)*(v-u+1) bytes from lv(a)+w(t)*(i-m) to lv(z) 250: / 251: _PACK: 252: bne 1f 253: mov (lc)+,r3 254: 1: 255: mov $pack,reta 256: / 257: / check conditions 1 and 2 258: / 259: pakunp: 260: mov 4(sp),r1 261: sub (lc)+,r1 / m 262: blt 9f 263: cmp r1,(lc)+ / (n-m)-(u-v) 264: bgt 9f 265: mul r3,r1 266: mov (sp)+,r0 267: add (sp)+,r1 268: tst (sp)+ 269: mov (lc)+,r3 270: inc r3 271: jmp *reta 272: unpack: 273: mov r0,r2 274: mov r1,r0 275: mov r2,r1 276: br pack 277: 1: 278: movb (r1)+,(r0)+ 279: pack: 280: sob r3,1b 281: return 282: / 283: / unpack(z,a,i) 284: / 285: / with: z and a as in pack 286: / 287: / semantics: for j := u to v do 288: / a[j-u+i] := z[j] 289: / 290: _UNPACK: 291: bne 1f 292: mov (lc)+,r3 293: 1: 294: mov $unpack,reta 295: br pakunp 296: 9: 297: cmp reta,$pack 298: beq 1f 299: mov $EUNPACK,_perrno 300: error EUNPACK 301: 1: 302: mov $EPACK,_perrno 303: error EPACK 304: _WCLCK: 305: sys time 306: mov r1,-(sp) 307: mov r0,-(sp) 308: return