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

Defined functions

badi1 defined in line 338; used 7 times
badins defined in line 169; used 13 times
check defined in line 341; used 7 times
class2 defined in line 66; used 1 times
  • in line 43
class3 defined in line 95; used 1 times
  • in line 41
fptrap declared in line 9; defined in line 12; used 1 times
  • in line 9
freg defined in line 202; used 1 times
fsrc defined in line 211; used 6 times
i.cfcc defined in line 147; used 1 times
  • in line 53
i.setd defined in line 157; used 1 times
  • in line 62
i.setf defined in line 153; used 1 times
  • in line 54
i.seti defined in line 161; used 1 times
  • in line 55
i.setl defined in line 165; used 1 times
  • in line 63
m.ext defined in line 6; used 5 times
m.lngi defined in line 7; used 4 times
mod0 defined in line 262; used 1 times
mod0f defined in line 265; used 3 times
mod0r defined in line 279; never used
mod0ra defined in line 275; used 1 times
mod0rx defined in line 282; used 2 times
mod1 defined in line 286; used 1 times
mod2 defined in line 292; used 1 times
mod242 defined in line 250; used 2 times
mod24d defined in line 242; used 1 times
mod24f defined in line 234; used 2 times
mod24i defined in line 254; used 1 times
mod3 defined in line 305; used 1 times
mod4 defined in line 311; used 1 times
mod5 defined in line 319; used 1 times
mod6 defined in line 326; used 2 times
mod7 defined in line 333; used 1 times
norm defined in line 389; never used
ret defined in line 184; used 8 times
seta defined in line 353; used 1 times
setab defined in line 347; never used
sret defined in line 173; used 2 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 450
Valid CSS Valid XHTML 1.0 Strict