1: / fp1 -- floating point simulator
   2: 
   3: rti     = 2
   4: bpt     = 3
   5: fetchi  = 61.
   6: 
   7: m.ext = 200             / long mode bit
   8: m.lngi = 100            / long integer mode
   9: 
  10: .globl  fptrap, fpjsr, _reenter
  11: .globl  ac0, ac1, ac2, ac3
  12: 
  13: 2:
  14:         bpl     1f
  15:         jsr     pc,1f
  16:         bis     $10,sps
  17:         rts     pc
  18: 1:
  19:         bne     1f
  20:         jsr     pc,1f
  21:         bis     $4,sps
  22:         rts     pc
  23: 1:
  24:         bvc     1f
  25:         jsr     pc,1f
  26:         bis     $2,sps
  27:         rts     pc
  28: 1:
  29:         bcc     1f
  30:         jsr     pc,1f
  31:         bis     $1,sps
  32:         rts     pc
  33: 1:
  34:         mov     $140000,sps
  35:         rts     pc
  36: fpjsr:
  37:         jsr     pc,2b
  38:         mov     (sp),-(sp)
  39:         mov     sps,2(sp)
  40:         add     $2,(sp)
  41: fptrap:
  42:         dec     _reenter
  43:         bge     1f
  44:         4               / _reentered!
  45: 1:
  46:         mov     (sp)+,spc
  47:         mov     (sp)+,sps
  48:         mov     r0,sr0
  49:         mov     $sr1,r0
  50:         mov     r1,(r0)+
  51:         mov     r2,(r0)+
  52:         mov     r3,(r0)+
  53:         mov     r4,(r0)+
  54:         mov     r5,(r0)+
  55:         mov     sp,(r0)+
  56:         sub     $8,sp           / room for double push
  57:         mov     r0,-(sp)        / ???
  58:         mov     (r0),r0
  59:         sub     $2,r0
  60:         sys     fetchi
  61:         mov     r0,r5           / instruction
  62:         mov     (sp)+,r0        / ???
  63:         clr     trapins
  64:         mov     r5,r4
  65:         bic     $7777,r4
  66:         cmp     r4,$170000
  67:         beq     1f
  68:         jmp     badins
  69: lookahead:
  70:         add     $2,spc
  71:         mov     ssp,sp
  72:         sub     $8,sp
  73: 1:
  74:         bic     $100000,fpsr    / clear fp error
  75:         bic     $170000,r5
  76:         mov     r5,r4
  77:         bit     $7000,r4
  78:         bne     class3
  79:         bit     $700,r4
  80:         bne     class2
  81:         cmp     r4,$12
  82:         blos    1f
  83:         jmp     badins
  84: 1:
  85:         asl     r4
  86:         jmp     *1f(r4)
  87: 
  88:         .data
  89: 1:
  90:         i.cfcc          / 170000
  91:         i.setf          / 170001
  92:         i.seti          / 170002
  93:         badins
  94:         badins
  95:         badins
  96:         badins
  97:         badins
  98:         badins
  99:         i.setd          / 170011
 100:         i.setl          / 170012
 101:         .text
 102: 
 103: class2:
 104:         cmp     r5,$400
 105:         bge     1f
 106:         mov     $0f,r1
 107:         jsr     pc,fsrc
 108:         .data
 109: 0:      mod0rx; mod242
 110:         .text
 111:         br      2f
 112: 1:
 113:         mov     $0f,r1
 114:         jsr     pc,fsrc
 115:         .data
 116: 0:      mod0f; mod24f
 117:         .text
 118: 2:
 119:         mov     r3,r5
 120:         asl     r4
 121:         asl     r4
 122:         clrb    r4
 123:         swab    r4
 124:         asl     r4
 125:         jsr     pc,*1f(r4)
 126:         jmp     sret
 127: 
 128:         .data
 129: 1:
 130:         badins          / 1700xx
 131:         i.ldfps         / 1701xx
 132:         i.stfps         / 1702xx
 133:         badins          / 1703xx - stst
 134:         i.clrx          / 1704xx
 135:         i.tstx          / 1705xx
 136:         i.absx          / 1706xx
 137:         i.negx          / 1707xx
 138:         .text
 139: 
 140: class3:
 141:         cmp     r5,$5000
 142:         blt     1f
 143:         mov     r5,r2
 144:         clrb    r2
 145:         cmp     r2,$6400
 146:         blt     2f
 147:         sub     $1400,r2
 148: 2:
 149:         cmp     r2,$5000
 150:         bne     2f
 151:         mov     $0f,r1
 152:         jsr     pc,fsrc
 153:         .data
 154: 0:      mod0rx; mod242
 155:         .text
 156:         br      3f
 157: 2:
 158:         cmp     r2,$5400
 159:         bne     2f
 160:         mov     $0f,r1
 161:         jsr     pc,fsrc
 162:         .data
 163: 0:      mod0ra; mod24i
 164:         .text
 165:         br      3f
 166: 2:
 167:         mov     $0f,r1
 168:         jsr     pc,fsrc
 169:         .data
 170: 0:      mod0f; mod24d
 171:         .text
 172:         br      3f
 173: 1:
 174:         mov     $0f,r1
 175:         jsr     pc,fsrc
 176:         .data
 177: 0:      mod0f; mod24f
 178:         .text
 179: 3:
 180:         jsr     pc,freg
 181:         mov     r2,r5
 182:         clrb    r4
 183:         swab    r4
 184:         asl     r4
 185:         jsr     pc,*1f(r4)
 186:         br      sret
 187: 
 188:         .data
 189: 1:
 190:         badins          / 1700xx
 191:         badins          / 1704xx
 192:         i.mulx          / 1710xx
 193:         i.modx          / 1714xx
 194:         i.addx          / 1720xx
 195:         i.ldx           / 1724xx
 196:         i.subx          / 1730xx
 197:         i.cmpx          / 1734xx
 198:         i.stx           / 1740xx
 199:         i.divx          / 1744xx
 200:         i.stexp         / 1750xx
 201:         i.stcxj         / 1754xx
 202:         i.stcxy         / 1760xx
 203:         i.ldexp         / 1764xx
 204:         i.ldcjx         / 1770xx
 205:         i.ldcyx         / 1774xx
 206:         .text
 207: 
 208: i.cfcc:
 209:         mov     fpsr,r0
 210:         bic     $!17,r0
 211:         mov     r0,sps
 212:         br      ret
 213: 
 214: i.setf:
 215:         bic     $m.ext,fpsr
 216:         br      ret
 217: 
 218: i.setd:
 219:         bis     $m.ext,fpsr
 220:         br      ret
 221: 
 222: i.seti:
 223:         bic     $m.lngi,fpsr
 224:         br      ret
 225: 
 226: i.setl:
 227:         bis     $m.lngi,fpsr
 228:         br      ret
 229: 
 230: badins:
 231:         inc     trapins
 232:         br      ret
 233: 
 234: sret:
 235:         mov     $fpsr,r0
 236:         bic     $17,(r0)
 237:         tst     (r5)
 238:         bpl     1f
 239:         bis     $10,(r0)
 240:         br      ret
 241: 1:
 242:         bne     ret
 243:         bis     $4,(r0)
 244: 
 245: ret:
 246:         tst     trapins
 247:         bne     1f
 248:         mov     spc,r0
 249:         sys     fetchi
 250:         mov     r0,r5
 251:         mov     r5,r4
 252:         bic     $7777,r4
 253:         cmp     $170000,r4
 254:         jeq     lookahead
 255: 1:
 256:         mov     $sr1,r0
 257:         mov     (r0)+,r1
 258:         mov     (r0)+,r2
 259:         mov     (r0)+,r3
 260:         mov     (r0)+,r4
 261:         mov     (r0)+,r5
 262:         mov     (r0)+,sp
 263:         mov     sr0,r0
 264:         mov     sps,-(sp)
 265:         mov     spc,-(sp)
 266:         tst     trapins
 267:         bne     1f
 268:         inc     _reenter
 269:         rti
 270: 1:
 271:         bpt
 272: 
 273: freg:
 274:         mov     r5,r2
 275:         bic     $!300,r2
 276:         asr     r2
 277:         asr     r2
 278:         asr     r2
 279:         add     $ac0,r2
 280:         rts     pc
 281: 
 282: fsrc:
 283:         mov     r5,r3
 284:         bic     $!7,r3                  / register
 285:         asl     r3
 286:         add     $sr0,r3
 287:         mov     r5,r0
 288:         bic     $!70,r0                 / mode
 289:         asr     r0
 290:         asr     r0
 291:         jmp     *1f(r0)
 292: 
 293:         .data
 294: 1:
 295:         mod0
 296:         mod1
 297:         mod2
 298:         mod3
 299:         mod4
 300:         mod5
 301:         mod6
 302:         mod7
 303:         .text
 304: 
 305: mod24f:
 306:         mov     $4,r0
 307:         bit     $m.ext,fpsr
 308:         beq     1f
 309:         add     $4,r0
 310: 1:
 311:         rts     pc
 312: 
 313: mod24d:
 314:         mov     $8,r0
 315:         bit     $m.ext,fpsr
 316:         beq     1f
 317:         sub     $4,r0
 318: 1:
 319:         rts     pc
 320: 
 321: mod242:
 322:         mov     $2,r0
 323:         rts     pc
 324: 
 325: mod24i:
 326:         mov     $2,r0
 327:         bit     $m.lngi,fpsr
 328:         beq     1f
 329:         add     $2,r0
 330: 1:
 331:         rts     pc
 332: 
 333: mod0:
 334:         jmp     *(r1)+
 335: 
 336: mod0f:
 337:         sub     $sr0,r3                 / get fp ac
 338:         cmp     r3,$6*2
 339:         bhis    badi1
 340:         asl     r3
 341:         asl     r3
 342:         add     $ac0,r3
 343:         tst     (r1)+
 344:         rts     pc
 345: 
 346: mod0ra:
 347:         bit     $m.lngi,fpsr
 348:         bne     badi1
 349: 
 350: mod0r:
 351:         cmp     r3,$ssp
 352:         bhis    badi1
 353: mod0rx:
 354:         tst     (r1)+
 355:         rts     pc
 356: 
 357: mod1:
 358:         cmp     r3,$spc
 359:         beq     badi1
 360:         mov     (r3),r3
 361:         br      check
 362: 
 363: mod2:
 364:         cmp     r3,$spc
 365:         bne     1f
 366: /  $n
 367:         mov     (r3),r0
 368:         sys     fetchi
 369:         mov     r0,pctmp
 370:         mov     $2,r0
 371:         add     r0,(r3)
 372:         mov     $pctmp,r3
 373:         br      check
 374: /  (rn)+
 375: 1:
 376:         mov     (r3),-(sp)
 377:         jsr     pc,*2(r1)
 378:         add     r0,(r3)
 379:         mov     (sp)+,r3
 380:         br      check
 381: 
 382: mod3:
 383:         cmp     r3,$spc
 384:         bne     1f
 385: /  *$n
 386:         mov     r0,-(sp)
 387:         mov     (r3),r0
 388:         sys     fetchi
 389:         add     $2,(r3)
 390:         mov     r0,r3
 391:         mov     (sp)+,r0
 392:         br      check
 393: /  *(rn)+
 394: 1:
 395:         mov     *(r3),-(sp)
 396:         add     $2,(r3)
 397:         mov     (sp)+,r3
 398:         br      check
 399: 
 400: mod4:
 401:         cmp     r3,$spc         / test pc
 402:         beq     badi1
 403:         jsr     pc,*2(r1)
 404:         sub     r0,(r3)
 405:         mov     (r3),r3
 406:         br      check
 407: 
 408: mod5:
 409:         cmp     r3,$spc
 410:         beq     badi1
 411:         sub     $2,(r3)
 412:         mov     *(r3),r3
 413:         br      check
 414: 
 415: mod6:
 416:         mov     r0,-(sp)
 417:         mov     spc,r0
 418:         sys     fetchi
 419:         add     $2,spc
 420:         add     (r3),r0         /shouldn't happen separate i and d !!!
 421:         mov     r0,r3
 422:         mov     (sp)+,r0
 423:         br      check
 424: 
 425: mod7:
 426:         jsr     pc,mod6
 427:         mov     (r3),r3
 428:         br      check
 429: 
 430: badi1:
 431:         jmp     badins
 432: 
 433: check:
 434:         bit     $1,r3
 435:         bne     badi1
 436:         rts     pc
 437: 
 438: setab:
 439:         mov     $asign,r0
 440:         jsr     pc,seta
 441:         mov     r3,r2
 442:         mov     $bsign,r0
 443: 
 444: seta:
 445:         clr     (r0)
 446:         mov     (r2)+,r1
 447:         mov     r1,-(sp)
 448:         beq     1f
 449:         blt     2f
 450:         inc     (r0)+
 451:         br      3f
 452: 2:
 453:         dec     (r0)+
 454: 3:
 455:         bic     $!177,r1
 456:         bis     $200,r1
 457:         br      2f
 458: 1:
 459:         clr     (r0)+
 460: 2:
 461:         mov     r1,(r0)+
 462:         mov     (r2)+,(r0)+
 463:         bit     $m.ext,fpsr
 464:         beq     2f
 465:         mov     (r2)+,(r0)+
 466:         mov     (r2)+,(r0)+
 467:         br      3f
 468: 2:
 469:         clr     (r0)+
 470:         clr     (r0)+
 471: 3:
 472:         mov     (sp)+,r1
 473:         asl     r1
 474:         clrb    r1
 475:         swab    r1
 476:         sub     $200,r1
 477:         mov     r1,(r0)+        / exp
 478:         rts     pc
 479: 
 480: norm:
 481:         mov     $areg,r0
 482:         mov     (r0)+,r1
 483:         mov     r1,-(sp)
 484:         mov     (r0)+,r2
 485:         bis     r2,(sp)
 486:         mov     (r0)+,r3
 487:         bis     r3,(sp)
 488:         mov     (r0)+,r4
 489:         bis     r4,(sp)+
 490:         bne     1f
 491:         clr     asign
 492:         rts     pc
 493: 1:
 494:         bit     $!377,r1
 495:         beq     1f
 496:         clc
 497:         ror     r1
 498:         ror     r2
 499:         ror     r3
 500:         ror     r4
 501:         inc     (r0)
 502:         br      1b
 503: 1:
 504:         bit     $200,r1
 505:         bne     1f
 506:         asl     r4
 507:         rol     r3
 508:         rol     r2
 509:         rol     r1
 510:         dec     (r0)
 511:         br      1b
 512: 1:
 513:         mov     r4,-(r0)
 514:         mov     r3,-(r0)
 515:         mov     r2,-(r0)
 516:         mov     r1,-(r0)
 517:         rts     pc

Defined functions

badi1 defined in line 430; used 7 times
badins defined in line 230; used 13 times
check defined in line 433; used 9 times
class2 defined in line 103; used 1 times
  • in line 80
class3 defined in line 140; used 1 times
  • in line 78
fetchi defined in line 5; used 5 times
fpjsr declared in line 10; defined in line 36; used 1 times
  • in line 10
fptrap declared in line 10; defined in line 41; used 1 times
  • in line 10
freg defined in line 273; used 1 times
fsrc defined in line 282; used 6 times
i.cfcc defined in line 208; used 1 times
  • in line 90
i.setd defined in line 218; used 1 times
  • in line 99
i.setf defined in line 214; used 1 times
  • in line 91
i.seti defined in line 222; used 1 times
  • in line 92
i.setl defined in line 226; used 1 times
lookahead defined in line 69; used 1 times
m.ext defined in line 7; used 5 times
m.lngi defined in line 8; used 4 times
mod0 defined in line 333; used 1 times
mod0f defined in line 336; used 3 times
mod0r defined in line 350; never used
mod0ra defined in line 346; used 1 times
mod0rx defined in line 353; used 2 times
mod1 defined in line 357; used 1 times
mod2 defined in line 363; used 1 times
mod242 defined in line 321; used 2 times
mod24d defined in line 313; used 1 times
mod24f defined in line 305; used 2 times
mod24i defined in line 325; used 1 times
mod3 defined in line 382; used 1 times
mod4 defined in line 400; used 1 times
mod5 defined in line 408; used 1 times
mod6 defined in line 415; used 2 times
mod7 defined in line 425; used 1 times
norm defined in line 480; never used
ret defined in line 245; used 8 times
seta defined in line 444; used 1 times
setab defined in line 438; never used
sret defined in line 234; used 2 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 484
Valid CSS Valid XHTML 1.0 Strict