src/emu/cpu/e132xs/e132xsop.c
| r0 | r1335 | |
| 1 | #define LOCAL_DECODE_INIT \ |
| 2 | struct regs_decode decode_state; \ |
| 3 | struct regs_decode *decode = &decode_state; \ |
| 4 | \ |
| 5 | /* clear 'current regs / flags' */ \ |
| 6 | decode->src = 0; \ |
| 7 | decode->dst = 0; \ |
| 8 | decode->src_value = 0; \ |
| 9 | decode->next_src_value = 0; \ |
| 10 | decode->dst_value = 0; \ |
| 11 | decode->next_dst_value = 0; \ |
| 12 | decode->sub_type = 0; \ |
| 13 | decode->extra.u = 0; \ |
| 14 | decode->src_is_local = 0; \ |
| 15 | decode->dst_is_local = 0; \ |
| 16 | decode->same_src_dst = 0; \ |
| 17 | decode->same_src_dstf = 0; \ |
| 18 | decode->same_srcf_dst = 0; \ |
| 19 | decode->op = opcode; \ |
| 20 | |
| 21 | |
| 22 | static void hyperstone_op00(UINT16 opcode) |
| 23 | { |
| 24 | LOCAL_DECODE_INIT; |
| 25 | RRdecode(decode, 0, 0); |
| 26 | hyperstone_chk(decode); |
| 27 | } |
| 28 | |
| 29 | static void hyperstone_op01(UINT16 opcode) |
| 30 | { |
| 31 | LOCAL_DECODE_INIT; |
| 32 | RRdecode(decode, 0, 1); |
| 33 | hyperstone_chk(decode); |
| 34 | } |
| 35 | |
| 36 | static void hyperstone_op02(UINT16 opcode) |
| 37 | { |
| 38 | LOCAL_DECODE_INIT; |
| 39 | RRdecode(decode, 1, 0); |
| 40 | hyperstone_chk(decode); |
| 41 | } |
| 42 | |
| 43 | static void hyperstone_op03(UINT16 opcode) |
| 44 | { |
| 45 | LOCAL_DECODE_INIT; |
| 46 | RRdecode(decode, 1, 1); |
| 47 | hyperstone_chk(decode); |
| 48 | } |
| 49 | |
| 50 | static void hyperstone_op04(UINT16 opcode) |
| 51 | { |
| 52 | LOCAL_DECODE_INIT; |
| 53 | RRdecode(decode, 0, 0); |
| 54 | hyperstone_movd(decode); |
| 55 | } |
| 56 | |
| 57 | static void hyperstone_op05(UINT16 opcode) |
| 58 | { |
| 59 | LOCAL_DECODE_INIT; |
| 60 | RRdecode(decode, 0, 1); |
| 61 | hyperstone_movd(decode); |
| 62 | } |
| 63 | |
| 64 | static void hyperstone_op06(UINT16 opcode) |
| 65 | { |
| 66 | LOCAL_DECODE_INIT; |
| 67 | RRdecode(decode, 1, 0); |
| 68 | hyperstone_movd(decode); |
| 69 | } |
| 70 | |
| 71 | static void hyperstone_op07(UINT16 opcode) |
| 72 | { |
| 73 | LOCAL_DECODE_INIT; |
| 74 | RRdecode(decode, 1, 1); |
| 75 | hyperstone_movd(decode); |
| 76 | } |
| 77 | |
| 78 | static void hyperstone_op08(UINT16 opcode) |
| 79 | { |
| 80 | LOCAL_DECODE_INIT; |
| 81 | RRdecode(decode, 0, 0); |
| 82 | hyperstone_divu(decode); |
| 83 | } |
| 84 | |
| 85 | static void hyperstone_op09(UINT16 opcode) |
| 86 | { |
| 87 | LOCAL_DECODE_INIT; |
| 88 | RRdecode(decode, 0, 1); |
| 89 | hyperstone_divu(decode); |
| 90 | } |
| 91 | |
| 92 | static void hyperstone_op0a(UINT16 opcode) |
| 93 | { |
| 94 | LOCAL_DECODE_INIT; |
| 95 | RRdecode(decode, 1, 0); |
| 96 | hyperstone_divu(decode); |
| 97 | } |
| 98 | |
| 99 | static void hyperstone_op0b(UINT16 opcode) |
| 100 | { |
| 101 | LOCAL_DECODE_INIT; |
| 102 | RRdecode(decode, 1, 1); |
| 103 | hyperstone_divu(decode); |
| 104 | } |
| 105 | |
| 106 | static void hyperstone_op0c(UINT16 opcode) |
| 107 | { |
| 108 | LOCAL_DECODE_INIT; |
| 109 | RRdecode(decode, 0, 0); |
| 110 | hyperstone_divs(decode); |
| 111 | } |
| 112 | |
| 113 | static void hyperstone_op0d(UINT16 opcode) |
| 114 | { |
| 115 | LOCAL_DECODE_INIT; |
| 116 | RRdecode(decode, 0, 1); |
| 117 | hyperstone_divs(decode); |
| 118 | } |
| 119 | |
| 120 | static void hyperstone_op0e(UINT16 opcode) |
| 121 | { |
| 122 | LOCAL_DECODE_INIT; |
| 123 | RRdecode(decode, 1, 0); |
| 124 | hyperstone_divs(decode); |
| 125 | } |
| 126 | |
| 127 | static void hyperstone_op0f(UINT16 opcode) |
| 128 | { |
| 129 | LOCAL_DECODE_INIT; |
| 130 | RRdecode(decode, 1, 1); |
| 131 | hyperstone_divs(decode); |
| 132 | } |
| 133 | |
| 134 | |
| 135 | |
| 136 | static void hyperstone_op10(UINT16 opcode) |
| 137 | { |
| 138 | LOCAL_DECODE_INIT; |
| 139 | RRlimdecode(decode, 0, 0); |
| 140 | hyperstone_xm(decode); |
| 141 | } |
| 142 | |
| 143 | static void hyperstone_op11(UINT16 opcode) |
| 144 | { |
| 145 | LOCAL_DECODE_INIT; |
| 146 | RRlimdecode(decode, 0, 1); |
| 147 | hyperstone_xm(decode); |
| 148 | } |
| 149 | |
| 150 | static void hyperstone_op12(UINT16 opcode) |
| 151 | { |
| 152 | LOCAL_DECODE_INIT; |
| 153 | RRlimdecode(decode, 1, 0); |
| 154 | hyperstone_xm(decode); |
| 155 | } |
| 156 | |
| 157 | static void hyperstone_op13(UINT16 opcode) |
| 158 | { |
| 159 | LOCAL_DECODE_INIT; |
| 160 | RRlimdecode(decode, 1, 1); |
| 161 | hyperstone_xm(decode); |
| 162 | } |
| 163 | |
| 164 | static void hyperstone_op14(UINT16 opcode) |
| 165 | { |
| 166 | LOCAL_DECODE_INIT; |
| 167 | RRconstdecode(decode, 0, 0); |
| 168 | hyperstone_mask(decode); |
| 169 | } |
| 170 | |
| 171 | static void hyperstone_op15(UINT16 opcode) |
| 172 | { |
| 173 | LOCAL_DECODE_INIT; |
| 174 | RRconstdecode(decode, 0, 1); |
| 175 | hyperstone_mask(decode); |
| 176 | } |
| 177 | |
| 178 | static void hyperstone_op16(UINT16 opcode) |
| 179 | { |
| 180 | LOCAL_DECODE_INIT; |
| 181 | RRconstdecode(decode, 1, 0); |
| 182 | hyperstone_mask(decode); |
| 183 | } |
| 184 | |
| 185 | static void hyperstone_op17(UINT16 opcode) |
| 186 | { |
| 187 | LOCAL_DECODE_INIT; |
| 188 | RRconstdecode(decode, 1, 1); |
| 189 | hyperstone_mask(decode); |
| 190 | } |
| 191 | |
| 192 | static void hyperstone_op18(UINT16 opcode) |
| 193 | { |
| 194 | LOCAL_DECODE_INIT; |
| 195 | RRconstdecode(decode, 0, 0); |
| 196 | hyperstone_sum(decode); |
| 197 | } |
| 198 | |
| 199 | static void hyperstone_op19(UINT16 opcode) |
| 200 | { |
| 201 | LOCAL_DECODE_INIT; |
| 202 | RRconstdecode(decode, 0, 1); |
| 203 | hyperstone_sum(decode); |
| 204 | } |
| 205 | |
| 206 | static void hyperstone_op1a(UINT16 opcode) |
| 207 | { |
| 208 | LOCAL_DECODE_INIT; |
| 209 | RRconstdecode(decode, 1, 0); |
| 210 | hyperstone_sum(decode); |
| 211 | } |
| 212 | |
| 213 | static void hyperstone_op1b(UINT16 opcode) |
| 214 | { |
| 215 | LOCAL_DECODE_INIT; |
| 216 | RRconstdecode(decode, 1, 1); |
| 217 | hyperstone_sum(decode); |
| 218 | } |
| 219 | |
| 220 | static void hyperstone_op1c(UINT16 opcode) |
| 221 | { |
| 222 | LOCAL_DECODE_INIT; |
| 223 | RRconstdecode(decode, 0, 0); |
| 224 | hyperstone_sums(decode); |
| 225 | } |
| 226 | |
| 227 | static void hyperstone_op1d(UINT16 opcode) |
| 228 | { |
| 229 | LOCAL_DECODE_INIT; |
| 230 | RRconstdecode(decode, 0, 1); |
| 231 | hyperstone_sums(decode); |
| 232 | } |
| 233 | |
| 234 | static void hyperstone_op1e(UINT16 opcode) |
| 235 | { |
| 236 | LOCAL_DECODE_INIT; |
| 237 | RRconstdecode(decode, 1, 0); |
| 238 | hyperstone_sums(decode); |
| 239 | } |
| 240 | |
| 241 | static void hyperstone_op1f(UINT16 opcode) |
| 242 | { |
| 243 | LOCAL_DECODE_INIT; |
| 244 | RRconstdecode(decode, 1, 1); |
| 245 | hyperstone_sums(decode); |
| 246 | } |
| 247 | |
| 248 | |
| 249 | |
| 250 | static void hyperstone_op20(UINT16 opcode) |
| 251 | { |
| 252 | LOCAL_DECODE_INIT; |
| 253 | RRdecode(decode, 0, 0); |
| 254 | hyperstone_cmp(decode); |
| 255 | } |
| 256 | |
| 257 | static void hyperstone_op21(UINT16 opcode) |
| 258 | { |
| 259 | LOCAL_DECODE_INIT; |
| 260 | RRdecode(decode, 0, 1); |
| 261 | hyperstone_cmp(decode); |
| 262 | } |
| 263 | |
| 264 | static void hyperstone_op22(UINT16 opcode) |
| 265 | { |
| 266 | LOCAL_DECODE_INIT; |
| 267 | RRdecode(decode, 1, 0); |
| 268 | hyperstone_cmp(decode); |
| 269 | } |
| 270 | |
| 271 | static void hyperstone_op23(UINT16 opcode) |
| 272 | { |
| 273 | LOCAL_DECODE_INIT; |
| 274 | RRdecode(decode, 1, 1); |
| 275 | hyperstone_cmp(decode); |
| 276 | } |
| 277 | |
| 278 | static void hyperstone_op24(UINT16 opcode) |
| 279 | { |
| 280 | LOCAL_DECODE_INIT; |
| 281 | RRdecodewithHflag(decode, 0, 0); |
| 282 | hyperstone_mov(decode); |
| 283 | } |
| 284 | |
| 285 | static void hyperstone_op25(UINT16 opcode) |
| 286 | { |
| 287 | LOCAL_DECODE_INIT; |
| 288 | RRdecodewithHflag(decode, 0, 1); |
| 289 | hyperstone_mov(decode); |
| 290 | } |
| 291 | |
| 292 | static void hyperstone_op26(UINT16 opcode) |
| 293 | { |
| 294 | LOCAL_DECODE_INIT; |
| 295 | RRdecodewithHflag(decode, 1, 0); |
| 296 | hyperstone_mov(decode); |
| 297 | } |
| 298 | |
| 299 | static void hyperstone_op27(UINT16 opcode) |
| 300 | { |
| 301 | LOCAL_DECODE_INIT; |
| 302 | RRdecodewithHflag(decode, 1, 1); |
| 303 | hyperstone_mov(decode); |
| 304 | } |
| 305 | |
| 306 | static void hyperstone_op28(UINT16 opcode) |
| 307 | { |
| 308 | LOCAL_DECODE_INIT; |
| 309 | RRdecode(decode, 0, 0); |
| 310 | hyperstone_add(decode); |
| 311 | } |
| 312 | |
| 313 | static void hyperstone_op29(UINT16 opcode) |
| 314 | { |
| 315 | LOCAL_DECODE_INIT; |
| 316 | RRdecode(decode, 0, 1); |
| 317 | hyperstone_add(decode); |
| 318 | } |
| 319 | |
| 320 | static void hyperstone_op2a(UINT16 opcode) |
| 321 | { |
| 322 | LOCAL_DECODE_INIT; |
| 323 | RRdecode(decode, 1, 0); |
| 324 | hyperstone_add(decode); |
| 325 | } |
| 326 | |
| 327 | static void hyperstone_op2b(UINT16 opcode) |
| 328 | { |
| 329 | LOCAL_DECODE_INIT; |
| 330 | RRdecode(decode, 1, 1); |
| 331 | hyperstone_add(decode); |
| 332 | } |
| 333 | |
| 334 | static void hyperstone_op2c(UINT16 opcode) |
| 335 | { |
| 336 | LOCAL_DECODE_INIT; |
| 337 | RRdecode(decode, 0, 0); |
| 338 | hyperstone_adds(decode); |
| 339 | } |
| 340 | |
| 341 | static void hyperstone_op2d(UINT16 opcode) |
| 342 | { |
| 343 | LOCAL_DECODE_INIT; |
| 344 | RRdecode(decode, 0, 1); |
| 345 | hyperstone_adds(decode); |
| 346 | } |
| 347 | |
| 348 | static void hyperstone_op2e(UINT16 opcode) |
| 349 | { |
| 350 | LOCAL_DECODE_INIT; |
| 351 | RRdecode(decode, 1, 0); |
| 352 | hyperstone_adds(decode); |
| 353 | } |
| 354 | |
| 355 | static void hyperstone_op2f(UINT16 opcode) |
| 356 | { |
| 357 | LOCAL_DECODE_INIT; |
| 358 | RRdecode(decode, 1, 1); |
| 359 | hyperstone_adds(decode); |
| 360 | } |
| 361 | |
| 362 | |
| 363 | |
| 364 | static void hyperstone_op30(UINT16 opcode) |
| 365 | { |
| 366 | LOCAL_DECODE_INIT; |
| 367 | RRdecode(decode, 0, 0); |
| 368 | hyperstone_cmpb(decode); |
| 369 | } |
| 370 | |
| 371 | static void hyperstone_op31(UINT16 opcode) |
| 372 | { |
| 373 | LOCAL_DECODE_INIT; |
| 374 | RRdecode(decode, 0, 1); |
| 375 | hyperstone_cmpb(decode); |
| 376 | } |
| 377 | |
| 378 | static void hyperstone_op32(UINT16 opcode) |
| 379 | { |
| 380 | LOCAL_DECODE_INIT; |
| 381 | RRdecode(decode, 1, 0); |
| 382 | hyperstone_cmpb(decode); |
| 383 | } |
| 384 | |
| 385 | static void hyperstone_op33(UINT16 opcode) |
| 386 | { |
| 387 | LOCAL_DECODE_INIT; |
| 388 | RRdecode(decode, 1, 1); |
| 389 | hyperstone_cmpb(decode); |
| 390 | } |
| 391 | |
| 392 | static void hyperstone_op34(UINT16 opcode) |
| 393 | { |
| 394 | LOCAL_DECODE_INIT; |
| 395 | RRdecode(decode, 0, 0); |
| 396 | hyperstone_andn(decode); |
| 397 | } |
| 398 | |
| 399 | static void hyperstone_op35(UINT16 opcode) |
| 400 | { |
| 401 | LOCAL_DECODE_INIT; |
| 402 | RRdecode(decode, 0, 1); |
| 403 | hyperstone_andn(decode); |
| 404 | } |
| 405 | |
| 406 | static void hyperstone_op36(UINT16 opcode) |
| 407 | { |
| 408 | LOCAL_DECODE_INIT; |
| 409 | RRdecode(decode, 1, 0); |
| 410 | hyperstone_andn(decode); |
| 411 | } |
| 412 | |
| 413 | static void hyperstone_op37(UINT16 opcode) |
| 414 | { |
| 415 | LOCAL_DECODE_INIT; |
| 416 | RRdecode(decode, 1, 1); |
| 417 | hyperstone_andn(decode); |
| 418 | } |
| 419 | |
| 420 | static void hyperstone_op38(UINT16 opcode) |
| 421 | { |
| 422 | LOCAL_DECODE_INIT; |
| 423 | RRdecode(decode, 0, 0); |
| 424 | hyperstone_or(decode); |
| 425 | } |
| 426 | |
| 427 | static void hyperstone_op39(UINT16 opcode) |
| 428 | { |
| 429 | LOCAL_DECODE_INIT; |
| 430 | RRdecode(decode, 0, 1); |
| 431 | hyperstone_or(decode); |
| 432 | } |
| 433 | |
| 434 | static void hyperstone_op3a(UINT16 opcode) |
| 435 | { |
| 436 | LOCAL_DECODE_INIT; |
| 437 | RRdecode(decode, 1, 0); |
| 438 | hyperstone_or(decode); |
| 439 | } |
| 440 | |
| 441 | static void hyperstone_op3b(UINT16 opcode) |
| 442 | { |
| 443 | LOCAL_DECODE_INIT; |
| 444 | RRdecode(decode, 1, 1); |
| 445 | hyperstone_or(decode); |
| 446 | } |
| 447 | |
| 448 | static void hyperstone_op3c(UINT16 opcode) |
| 449 | { |
| 450 | LOCAL_DECODE_INIT; |
| 451 | RRdecode(decode, 0, 0); |
| 452 | hyperstone_xor(decode); |
| 453 | } |
| 454 | |
| 455 | static void hyperstone_op3d(UINT16 opcode) |
| 456 | { |
| 457 | LOCAL_DECODE_INIT; |
| 458 | RRdecode(decode, 0, 1); |
| 459 | hyperstone_xor(decode); |
| 460 | } |
| 461 | |
| 462 | static void hyperstone_op3e(UINT16 opcode) |
| 463 | { |
| 464 | LOCAL_DECODE_INIT; |
| 465 | RRdecode(decode, 1, 0); |
| 466 | hyperstone_xor(decode); |
| 467 | } |
| 468 | |
| 469 | static void hyperstone_op3f(UINT16 opcode) |
| 470 | { |
| 471 | LOCAL_DECODE_INIT; |
| 472 | RRdecode(decode, 1, 1); |
| 473 | hyperstone_xor(decode); |
| 474 | } |
| 475 | |
| 476 | |
| 477 | |
| 478 | static void hyperstone_op40(UINT16 opcode) |
| 479 | { |
| 480 | LOCAL_DECODE_INIT; |
| 481 | RRdecode(decode, 0, 0); |
| 482 | hyperstone_subc(decode); |
| 483 | } |
| 484 | |
| 485 | static void hyperstone_op41(UINT16 opcode) |
| 486 | { |
| 487 | LOCAL_DECODE_INIT; |
| 488 | RRdecode(decode, 0, 1); |
| 489 | hyperstone_subc(decode); |
| 490 | } |
| 491 | |
| 492 | static void hyperstone_op42(UINT16 opcode) |
| 493 | { |
| 494 | LOCAL_DECODE_INIT; |
| 495 | RRdecode(decode, 1, 0); |
| 496 | hyperstone_subc(decode); |
| 497 | } |
| 498 | |
| 499 | static void hyperstone_op43(UINT16 opcode) |
| 500 | { |
| 501 | LOCAL_DECODE_INIT; |
| 502 | RRdecode(decode, 1, 1); |
| 503 | hyperstone_subc(decode); |
| 504 | } |
| 505 | |
| 506 | static void hyperstone_op44(UINT16 opcode) |
| 507 | { |
| 508 | LOCAL_DECODE_INIT; |
| 509 | RRdecode(decode, 0, 0); |
| 510 | hyperstone_not(decode); |
| 511 | } |
| 512 | |
| 513 | static void hyperstone_op45(UINT16 opcode) |
| 514 | { |
| 515 | LOCAL_DECODE_INIT; |
| 516 | RRdecode(decode, 0, 1); |
| 517 | hyperstone_not(decode); |
| 518 | } |
| 519 | |
| 520 | static void hyperstone_op46(UINT16 opcode) |
| 521 | { |
| 522 | LOCAL_DECODE_INIT; |
| 523 | RRdecode(decode, 1, 0); |
| 524 | hyperstone_not(decode); |
| 525 | } |
| 526 | |
| 527 | static void hyperstone_op47(UINT16 opcode) |
| 528 | { |
| 529 | LOCAL_DECODE_INIT; |
| 530 | RRdecode(decode, 1, 1); |
| 531 | hyperstone_not(decode); |
| 532 | } |
| 533 | |
| 534 | static void hyperstone_op48(UINT16 opcode) |
| 535 | { |
| 536 | LOCAL_DECODE_INIT; |
| 537 | RRdecode(decode, 0, 0); |
| 538 | hyperstone_sub(decode); |
| 539 | } |
| 540 | |
| 541 | static void hyperstone_op49(UINT16 opcode) |
| 542 | { |
| 543 | LOCAL_DECODE_INIT; |
| 544 | RRdecode(decode, 0, 1); |
| 545 | hyperstone_sub(decode); |
| 546 | } |
| 547 | |
| 548 | static void hyperstone_op4a(UINT16 opcode) |
| 549 | { |
| 550 | LOCAL_DECODE_INIT; |
| 551 | RRdecode(decode, 1, 0); |
| 552 | hyperstone_sub(decode); |
| 553 | } |
| 554 | |
| 555 | static void hyperstone_op4b(UINT16 opcode) |
| 556 | { |
| 557 | LOCAL_DECODE_INIT; |
| 558 | RRdecode(decode, 1, 1); |
| 559 | hyperstone_sub(decode); |
| 560 | } |
| 561 | |
| 562 | static void hyperstone_op4c(UINT16 opcode) |
| 563 | { |
| 564 | LOCAL_DECODE_INIT; |
| 565 | RRdecode(decode, 0, 0); |
| 566 | hyperstone_subs(decode); |
| 567 | } |
| 568 | |
| 569 | static void hyperstone_op4d(UINT16 opcode) |
| 570 | { |
| 571 | LOCAL_DECODE_INIT; |
| 572 | RRdecode(decode, 0, 1); |
| 573 | hyperstone_subs(decode); |
| 574 | } |
| 575 | |
| 576 | static void hyperstone_op4e(UINT16 opcode) |
| 577 | { |
| 578 | LOCAL_DECODE_INIT; |
| 579 | RRdecode(decode, 1, 0); |
| 580 | hyperstone_subs(decode); |
| 581 | } |
| 582 | |
| 583 | static void hyperstone_op4f(UINT16 opcode) |
| 584 | { |
| 585 | LOCAL_DECODE_INIT; |
| 586 | RRdecode(decode, 1, 1); |
| 587 | hyperstone_subs(decode); |
| 588 | } |
| 589 | |
| 590 | |
| 591 | |
| 592 | static void hyperstone_op50(UINT16 opcode) |
| 593 | { |
| 594 | LOCAL_DECODE_INIT; |
| 595 | RRdecode(decode, 0, 0); |
| 596 | hyperstone_addc(decode); |
| 597 | } |
| 598 | |
| 599 | static void hyperstone_op51(UINT16 opcode) |
| 600 | { |
| 601 | LOCAL_DECODE_INIT; |
| 602 | RRdecode(decode, 0, 1); |
| 603 | hyperstone_addc(decode); |
| 604 | } |
| 605 | |
| 606 | static void hyperstone_op52(UINT16 opcode) |
| 607 | { |
| 608 | LOCAL_DECODE_INIT; |
| 609 | RRdecode(decode, 1, 0); |
| 610 | hyperstone_addc(decode); |
| 611 | } |
| 612 | |
| 613 | static void hyperstone_op53(UINT16 opcode) |
| 614 | { |
| 615 | LOCAL_DECODE_INIT; |
| 616 | RRdecode(decode, 1, 1); |
| 617 | hyperstone_addc(decode); |
| 618 | } |
| 619 | |
| 620 | static void hyperstone_op54(UINT16 opcode) |
| 621 | { |
| 622 | LOCAL_DECODE_INIT; |
| 623 | RRdecode(decode, 0, 0); |
| 624 | hyperstone_and(decode); |
| 625 | } |
| 626 | |
| 627 | static void hyperstone_op55(UINT16 opcode) |
| 628 | { |
| 629 | LOCAL_DECODE_INIT; |
| 630 | RRdecode(decode, 0, 1); |
| 631 | hyperstone_and(decode); |
| 632 | } |
| 633 | |
| 634 | static void hyperstone_op56(UINT16 opcode) |
| 635 | { |
| 636 | LOCAL_DECODE_INIT; |
| 637 | RRdecode(decode, 1, 0); |
| 638 | hyperstone_and(decode); |
| 639 | } |
| 640 | |
| 641 | static void hyperstone_op57(UINT16 opcode) |
| 642 | { |
| 643 | LOCAL_DECODE_INIT; |
| 644 | RRdecode(decode, 1, 1); |
| 645 | hyperstone_and(decode); |
| 646 | } |
| 647 | |
| 648 | static void hyperstone_op58(UINT16 opcode) |
| 649 | { |
| 650 | LOCAL_DECODE_INIT; |
| 651 | RRdecode(decode, 0, 0); |
| 652 | hyperstone_neg(decode); |
| 653 | } |
| 654 | |
| 655 | static void hyperstone_op59(UINT16 opcode) |
| 656 | { |
| 657 | LOCAL_DECODE_INIT; |
| 658 | RRdecode(decode, 0, 1); |
| 659 | hyperstone_neg(decode); |
| 660 | } |
| 661 | |
| 662 | static void hyperstone_op5a(UINT16 opcode) |
| 663 | { |
| 664 | LOCAL_DECODE_INIT; |
| 665 | RRdecode(decode, 1, 0); |
| 666 | hyperstone_neg(decode); |
| 667 | } |
| 668 | |
| 669 | static void hyperstone_op5b(UINT16 opcode) |
| 670 | { |
| 671 | LOCAL_DECODE_INIT; |
| 672 | RRdecode(decode, 1, 1); |
| 673 | hyperstone_neg(decode); |
| 674 | } |
| 675 | |
| 676 | static void hyperstone_op5c(UINT16 opcode) |
| 677 | { |
| 678 | LOCAL_DECODE_INIT; |
| 679 | RRdecode(decode, 0, 0); |
| 680 | hyperstone_negs(decode); |
| 681 | } |
| 682 | |
| 683 | static void hyperstone_op5d(UINT16 opcode) |
| 684 | { |
| 685 | LOCAL_DECODE_INIT; |
| 686 | RRdecode(decode, 0, 1); |
| 687 | hyperstone_negs(decode); |
| 688 | } |
| 689 | |
| 690 | static void hyperstone_op5e(UINT16 opcode) |
| 691 | { |
| 692 | LOCAL_DECODE_INIT; |
| 693 | RRdecode(decode, 1, 0); |
| 694 | hyperstone_negs(decode); |
| 695 | } |
| 696 | |
| 697 | static void hyperstone_op5f(UINT16 opcode) |
| 698 | { |
| 699 | LOCAL_DECODE_INIT; |
| 700 | RRdecode(decode, 1, 1); |
| 701 | hyperstone_negs(decode); |
| 702 | } |
| 703 | |
| 704 | |
| 705 | |
| 706 | static void hyperstone_op60(UINT16 opcode) |
| 707 | { |
| 708 | LOCAL_DECODE_INIT; |
| 709 | Rimmdecode(decode, 0, 0); |
| 710 | hyperstone_cmpi(decode); |
| 711 | } |
| 712 | |
| 713 | static void hyperstone_op61(UINT16 opcode) |
| 714 | { |
| 715 | LOCAL_DECODE_INIT; |
| 716 | Rimmdecode(decode, 0, 1); |
| 717 | hyperstone_cmpi(decode); |
| 718 | } |
| 719 | |
| 720 | static void hyperstone_op62(UINT16 opcode) |
| 721 | { |
| 722 | LOCAL_DECODE_INIT; |
| 723 | Rimmdecode(decode, 1, 0); |
| 724 | hyperstone_cmpi(decode); |
| 725 | } |
| 726 | |
| 727 | static void hyperstone_op63(UINT16 opcode) |
| 728 | { |
| 729 | LOCAL_DECODE_INIT; |
| 730 | Rimmdecode(decode, 1, 1); |
| 731 | hyperstone_cmpi(decode); |
| 732 | } |
| 733 | |
| 734 | static void hyperstone_op64(UINT16 opcode) |
| 735 | { |
| 736 | LOCAL_DECODE_INIT; |
| 737 | RimmdecodewithHflag(decode, 0, 0); |
| 738 | hyperstone_movi(decode); |
| 739 | } |
| 740 | |
| 741 | static void hyperstone_op65(UINT16 opcode) |
| 742 | { |
| 743 | LOCAL_DECODE_INIT; |
| 744 | RimmdecodewithHflag(decode, 0, 1); |
| 745 | hyperstone_movi(decode); |
| 746 | } |
| 747 | |
| 748 | static void hyperstone_op66(UINT16 opcode) |
| 749 | { |
| 750 | LOCAL_DECODE_INIT; |
| 751 | RimmdecodewithHflag(decode, 1, 0); |
| 752 | hyperstone_movi(decode); |
| 753 | } |
| 754 | |
| 755 | static void hyperstone_op67(UINT16 opcode) |
| 756 | { |
| 757 | LOCAL_DECODE_INIT; |
| 758 | RimmdecodewithHflag(decode, 1, 1); |
| 759 | hyperstone_movi(decode); |
| 760 | } |
| 761 | |
| 762 | static void hyperstone_op68(UINT16 opcode) |
| 763 | { |
| 764 | LOCAL_DECODE_INIT; |
| 765 | Rimmdecode(decode, 0, 0); |
| 766 | hyperstone_addi(decode); |
| 767 | } |
| 768 | |
| 769 | static void hyperstone_op69(UINT16 opcode) |
| 770 | { |
| 771 | LOCAL_DECODE_INIT; |
| 772 | Rimmdecode(decode, 0, 1); |
| 773 | hyperstone_addi(decode); |
| 774 | } |
| 775 | |
| 776 | static void hyperstone_op6a(UINT16 opcode) |
| 777 | { |
| 778 | LOCAL_DECODE_INIT; |
| 779 | Rimmdecode(decode, 1, 0); |
| 780 | hyperstone_addi(decode); |
| 781 | } |
| 782 | |
| 783 | static void hyperstone_op6b(UINT16 opcode) |
| 784 | { |
| 785 | LOCAL_DECODE_INIT; |
| 786 | Rimmdecode(decode, 1, 1); |
| 787 | hyperstone_addi(decode); |
| 788 | } |
| 789 | |
| 790 | static void hyperstone_op6c(UINT16 opcode) |
| 791 | { |
| 792 | LOCAL_DECODE_INIT; |
| 793 | Rimmdecode(decode, 0, 0); |
| 794 | hyperstone_addsi(decode); |
| 795 | } |
| 796 | |
| 797 | static void hyperstone_op6d(UINT16 opcode) |
| 798 | { |
| 799 | LOCAL_DECODE_INIT; |
| 800 | Rimmdecode(decode, 0, 1); |
| 801 | hyperstone_addsi(decode); |
| 802 | } |
| 803 | |
| 804 | static void hyperstone_op6e(UINT16 opcode) |
| 805 | { |
| 806 | LOCAL_DECODE_INIT; |
| 807 | Rimmdecode(decode, 1, 0); |
| 808 | hyperstone_addsi(decode); |
| 809 | } |
| 810 | |
| 811 | static void hyperstone_op6f(UINT16 opcode) |
| 812 | { |
| 813 | LOCAL_DECODE_INIT; |
| 814 | Rimmdecode(decode, 1, 1); |
| 815 | hyperstone_addsi(decode); |
| 816 | } |
| 817 | |
| 818 | |
| 819 | |
| 820 | static void hyperstone_op70(UINT16 opcode) |
| 821 | { |
| 822 | LOCAL_DECODE_INIT; |
| 823 | Rimmdecode(decode, 0, 0); |
| 824 | hyperstone_cmpbi(decode); |
| 825 | } |
| 826 | |
| 827 | static void hyperstone_op71(UINT16 opcode) |
| 828 | { |
| 829 | LOCAL_DECODE_INIT; |
| 830 | Rimmdecode(decode, 0, 1); |
| 831 | hyperstone_cmpbi(decode); |
| 832 | } |
| 833 | |
| 834 | static void hyperstone_op72(UINT16 opcode) |
| 835 | { |
| 836 | LOCAL_DECODE_INIT; |
| 837 | Rimmdecode(decode, 1, 0); |
| 838 | hyperstone_cmpbi(decode); |
| 839 | } |
| 840 | |
| 841 | static void hyperstone_op73(UINT16 opcode) |
| 842 | { |
| 843 | LOCAL_DECODE_INIT; |
| 844 | Rimmdecode(decode, 1, 1); |
| 845 | hyperstone_cmpbi(decode); |
| 846 | } |
| 847 | |
| 848 | static void hyperstone_op74(UINT16 opcode) |
| 849 | { |
| 850 | LOCAL_DECODE_INIT; |
| 851 | Rimmdecode(decode, 0, 0); |
| 852 | hyperstone_andni(decode); |
| 853 | } |
| 854 | |
| 855 | static void hyperstone_op75(UINT16 opcode) |
| 856 | { |
| 857 | LOCAL_DECODE_INIT; |
| 858 | Rimmdecode(decode, 0, 1); |
| 859 | hyperstone_andni(decode); |
| 860 | } |
| 861 | |
| 862 | static void hyperstone_op76(UINT16 opcode) |
| 863 | { |
| 864 | LOCAL_DECODE_INIT; |
| 865 | Rimmdecode(decode, 1, 0); |
| 866 | hyperstone_andni(decode); |
| 867 | } |
| 868 | |
| 869 | static void hyperstone_op77(UINT16 opcode) |
| 870 | { |
| 871 | LOCAL_DECODE_INIT; |
| 872 | Rimmdecode(decode, 1, 1); |
| 873 | hyperstone_andni(decode); |
| 874 | } |
| 875 | |
| 876 | static void hyperstone_op78(UINT16 opcode) |
| 877 | { |
| 878 | LOCAL_DECODE_INIT; |
| 879 | Rimmdecode(decode, 0, 0); |
| 880 | hyperstone_ori(decode); |
| 881 | } |
| 882 | |
| 883 | static void hyperstone_op79(UINT16 opcode) |
| 884 | { |
| 885 | LOCAL_DECODE_INIT; |
| 886 | Rimmdecode(decode, 0, 1); |
| 887 | hyperstone_ori(decode); |
| 888 | } |
| 889 | |
| 890 | static void hyperstone_op7a(UINT16 opcode) |
| 891 | { |
| 892 | LOCAL_DECODE_INIT; |
| 893 | Rimmdecode(decode, 1, 0); |
| 894 | hyperstone_ori(decode); |
| 895 | } |
| 896 | |
| 897 | static void hyperstone_op7b(UINT16 opcode) |
| 898 | { |
| 899 | LOCAL_DECODE_INIT; |
| 900 | Rimmdecode(decode, 1, 1); |
| 901 | hyperstone_ori(decode); |
| 902 | } |
| 903 | |
| 904 | static void hyperstone_op7c(UINT16 opcode) |
| 905 | { |
| 906 | LOCAL_DECODE_INIT; |
| 907 | Rimmdecode(decode, 0, 0); |
| 908 | hyperstone_xori(decode); |
| 909 | } |
| 910 | |
| 911 | static void hyperstone_op7d(UINT16 opcode) |
| 912 | { |
| 913 | LOCAL_DECODE_INIT; |
| 914 | Rimmdecode(decode, 0, 1); |
| 915 | hyperstone_xori(decode); |
| 916 | } |
| 917 | |
| 918 | static void hyperstone_op7e(UINT16 opcode) |
| 919 | { |
| 920 | LOCAL_DECODE_INIT; |
| 921 | Rimmdecode(decode, 1, 0); |
| 922 | hyperstone_xori(decode); |
| 923 | } |
| 924 | |
| 925 | static void hyperstone_op7f(UINT16 opcode) |
| 926 | { |
| 927 | LOCAL_DECODE_INIT; |
| 928 | Rimmdecode(decode, 1, 1); |
| 929 | hyperstone_xori(decode); |
| 930 | } |
| 931 | |
| 932 | |
| 933 | |
| 934 | static void hyperstone_op80(UINT16 opcode) |
| 935 | { |
| 936 | LOCAL_DECODE_INIT; |
| 937 | Lndecode(decode); |
| 938 | hyperstone_shrdi(decode); |
| 939 | } |
| 940 | |
| 941 | static void hyperstone_op81(UINT16 opcode) |
| 942 | { |
| 943 | LOCAL_DECODE_INIT; |
| 944 | Lndecode(decode); |
| 945 | hyperstone_shrdi(decode); |
| 946 | } |
| 947 | |
| 948 | static void hyperstone_op82(UINT16 opcode) |
| 949 | { |
| 950 | LOCAL_DECODE_INIT; |
| 951 | LLdecode(decode); |
| 952 | hyperstone_shrd(decode); |
| 953 | } |
| 954 | |
| 955 | static void hyperstone_op83(UINT16 opcode) |
| 956 | { |
| 957 | LOCAL_DECODE_INIT; |
| 958 | LLdecode(decode); |
| 959 | hyperstone_shr(decode); |
| 960 | } |
| 961 | |
| 962 | static void hyperstone_op84(UINT16 opcode) |
| 963 | { |
| 964 | LOCAL_DECODE_INIT; |
| 965 | Lndecode(decode); |
| 966 | hyperstone_sardi(decode); |
| 967 | } |
| 968 | |
| 969 | static void hyperstone_op85(UINT16 opcode) |
| 970 | { |
| 971 | LOCAL_DECODE_INIT; |
| 972 | Lndecode(decode); |
| 973 | hyperstone_sardi(decode); |
| 974 | } |
| 975 | |
| 976 | static void hyperstone_op86(UINT16 opcode) |
| 977 | { |
| 978 | LOCAL_DECODE_INIT; |
| 979 | LLdecode(decode); |
| 980 | hyperstone_sard(decode); |
| 981 | } |
| 982 | |
| 983 | static void hyperstone_op87(UINT16 opcode) |
| 984 | { |
| 985 | LOCAL_DECODE_INIT; |
| 986 | LLdecode(decode); |
| 987 | hyperstone_sar(decode); |
| 988 | } |
| 989 | |
| 990 | static void hyperstone_op88(UINT16 opcode) |
| 991 | { |
| 992 | LOCAL_DECODE_INIT; |
| 993 | Lndecode(decode); |
| 994 | hyperstone_shldi(decode); |
| 995 | } |
| 996 | |
| 997 | static void hyperstone_op89(UINT16 opcode) |
| 998 | { |
| 999 | LOCAL_DECODE_INIT; |
| 1000 | Lndecode(decode); |
| 1001 | hyperstone_shldi(decode); |
| 1002 | } |
| 1003 | |
| 1004 | static void hyperstone_op8a(UINT16 opcode) |
| 1005 | { |
| 1006 | LOCAL_DECODE_INIT; |
| 1007 | LLdecode(decode); |
| 1008 | hyperstone_shld(decode); |
| 1009 | } |
| 1010 | |
| 1011 | static void hyperstone_op8b(UINT16 opcode) |
| 1012 | { |
| 1013 | LOCAL_DECODE_INIT; |
| 1014 | LLdecode(decode); |
| 1015 | hyperstone_shl(decode); |
| 1016 | } |
| 1017 | |
| 1018 | static void hyperstone_op8c(UINT16 opcode) |
| 1019 | { |
| 1020 | LOCAL_DECODE_INIT; |
| 1021 | no_decode(decode); |
| 1022 | reserved(decode); |
| 1023 | } |
| 1024 | |
| 1025 | static void hyperstone_op8d(UINT16 opcode) |
| 1026 | { |
| 1027 | LOCAL_DECODE_INIT; |
| 1028 | no_decode(decode); |
| 1029 | reserved(decode); |
| 1030 | } |
| 1031 | |
| 1032 | static void hyperstone_op8e(UINT16 opcode) |
| 1033 | { |
| 1034 | LOCAL_DECODE_INIT; |
| 1035 | LLdecode(decode); |
| 1036 | hyperstone_testlz(decode); |
| 1037 | } |
| 1038 | |
| 1039 | static void hyperstone_op8f(UINT16 opcode) |
| 1040 | { |
| 1041 | LOCAL_DECODE_INIT; |
| 1042 | LLdecode(decode); |
| 1043 | hyperstone_rol(decode); |
| 1044 | } |
| 1045 | |
| 1046 | |
| 1047 | |
| 1048 | static void hyperstone_op90(UINT16 opcode) |
| 1049 | { |
| 1050 | LOCAL_DECODE_INIT; |
| 1051 | RRdisdecode(decode, 0, 0); |
| 1052 | hyperstone_ldxx1(decode); |
| 1053 | } |
| 1054 | |
| 1055 | static void hyperstone_op91(UINT16 opcode) |
| 1056 | { |
| 1057 | LOCAL_DECODE_INIT; |
| 1058 | RRdisdecode(decode, 0, 1); |
| 1059 | hyperstone_ldxx1(decode); |
| 1060 | } |
| 1061 | |
| 1062 | static void hyperstone_op92(UINT16 opcode) |
| 1063 | { |
| 1064 | LOCAL_DECODE_INIT; |
| 1065 | RRdisdecode(decode, 1, 0); |
| 1066 | hyperstone_ldxx1(decode); |
| 1067 | } |
| 1068 | |
| 1069 | static void hyperstone_op93(UINT16 opcode) |
| 1070 | { |
| 1071 | LOCAL_DECODE_INIT; |
| 1072 | RRdisdecode(decode, 1, 1); |
| 1073 | hyperstone_ldxx1(decode); |
| 1074 | } |
| 1075 | |
| 1076 | static void hyperstone_op94(UINT16 opcode) |
| 1077 | { |
| 1078 | LOCAL_DECODE_INIT; |
| 1079 | RRdisdecode(decode, 0, 0); |
| 1080 | hyperstone_ldxx2(decode); |
| 1081 | } |
| 1082 | |
| 1083 | static void hyperstone_op95(UINT16 opcode) |
| 1084 | { |
| 1085 | LOCAL_DECODE_INIT; |
| 1086 | RRdisdecode(decode, 0, 1); |
| 1087 | hyperstone_ldxx2(decode); |
| 1088 | } |
| 1089 | |
| 1090 | static void hyperstone_op96(UINT16 opcode) |
| 1091 | { |
| 1092 | LOCAL_DECODE_INIT; |
| 1093 | RRdisdecode(decode, 1, 0); |
| 1094 | hyperstone_ldxx2(decode); |
| 1095 | } |
| 1096 | |
| 1097 | static void hyperstone_op97(UINT16 opcode) |
| 1098 | { |
| 1099 | LOCAL_DECODE_INIT; |
| 1100 | RRdisdecode(decode, 1, 1); |
| 1101 | hyperstone_ldxx2(decode); |
| 1102 | } |
| 1103 | |
| 1104 | static void hyperstone_op98(UINT16 opcode) |
| 1105 | { |
| 1106 | LOCAL_DECODE_INIT; |
| 1107 | RRdisdecode(decode, 0, 0); |
| 1108 | hyperstone_stxx1(decode); |
| 1109 | } |
| 1110 | |
| 1111 | static void hyperstone_op99(UINT16 opcode) |
| 1112 | { |
| 1113 | LOCAL_DECODE_INIT; |
| 1114 | RRdisdecode(decode, 0, 1); |
| 1115 | hyperstone_stxx1(decode); |
| 1116 | } |
| 1117 | |
| 1118 | static void hyperstone_op9a(UINT16 opcode) |
| 1119 | { |
| 1120 | LOCAL_DECODE_INIT; |
| 1121 | RRdisdecode(decode, 1, 0); |
| 1122 | hyperstone_stxx1(decode); |
| 1123 | } |
| 1124 | |
| 1125 | static void hyperstone_op9b(UINT16 opcode) |
| 1126 | { |
| 1127 | LOCAL_DECODE_INIT; |
| 1128 | RRdisdecode(decode, 1, 1); |
| 1129 | hyperstone_stxx1(decode); |
| 1130 | } |
| 1131 | |
| 1132 | static void hyperstone_op9c(UINT16 opcode) |
| 1133 | { |
| 1134 | LOCAL_DECODE_INIT; |
| 1135 | RRdisdecode(decode, 0, 0); |
| 1136 | hyperstone_stxx2(decode); |
| 1137 | } |
| 1138 | |
| 1139 | static void hyperstone_op9d(UINT16 opcode) |
| 1140 | { |
| 1141 | LOCAL_DECODE_INIT; |
| 1142 | RRdisdecode(decode, 0, 1); |
| 1143 | hyperstone_stxx2(decode); |
| 1144 | } |
| 1145 | |
| 1146 | static void hyperstone_op9e(UINT16 opcode) |
| 1147 | { |
| 1148 | LOCAL_DECODE_INIT; |
| 1149 | RRdisdecode(decode, 1, 0); |
| 1150 | hyperstone_stxx2(decode); |
| 1151 | } |
| 1152 | |
| 1153 | static void hyperstone_op9f(UINT16 opcode) |
| 1154 | { |
| 1155 | LOCAL_DECODE_INIT; |
| 1156 | RRdisdecode(decode, 1, 1); |
| 1157 | hyperstone_stxx2(decode); |
| 1158 | } |
| 1159 | |
| 1160 | |
| 1161 | |
| 1162 | static void hyperstone_opa0(UINT16 opcode) |
| 1163 | { |
| 1164 | LOCAL_DECODE_INIT; |
| 1165 | Rndecode(decode, 0); |
| 1166 | hyperstone_shri(decode); |
| 1167 | } |
| 1168 | |
| 1169 | static void hyperstone_opa1(UINT16 opcode) |
| 1170 | { |
| 1171 | LOCAL_DECODE_INIT; |
| 1172 | Rndecode(decode, 0); |
| 1173 | hyperstone_shri(decode); |
| 1174 | } |
| 1175 | |
| 1176 | static void hyperstone_opa2(UINT16 opcode) |
| 1177 | { |
| 1178 | LOCAL_DECODE_INIT; |
| 1179 | Rndecode(decode, 1); |
| 1180 | hyperstone_shri(decode); |
| 1181 | } |
| 1182 | |
| 1183 | static void hyperstone_opa3(UINT16 opcode) |
| 1184 | { |
| 1185 | LOCAL_DECODE_INIT; |
| 1186 | Rndecode(decode, 1); |
| 1187 | hyperstone_shri(decode); |
| 1188 | } |
| 1189 | |
| 1190 | static void hyperstone_opa4(UINT16 opcode) |
| 1191 | { |
| 1192 | LOCAL_DECODE_INIT; |
| 1193 | Rndecode(decode, 0); |
| 1194 | hyperstone_sari(decode); |
| 1195 | } |
| 1196 | |
| 1197 | static void hyperstone_opa5(UINT16 opcode) |
| 1198 | { |
| 1199 | LOCAL_DECODE_INIT; |
| 1200 | Rndecode(decode, 0); |
| 1201 | hyperstone_sari(decode); |
| 1202 | } |
| 1203 | |
| 1204 | static void hyperstone_opa6(UINT16 opcode) |
| 1205 | { |
| 1206 | LOCAL_DECODE_INIT; |
| 1207 | Rndecode(decode, 1); |
| 1208 | hyperstone_sari(decode); |
| 1209 | } |
| 1210 | |
| 1211 | static void hyperstone_opa7(UINT16 opcode) |
| 1212 | { |
| 1213 | LOCAL_DECODE_INIT; |
| 1214 | Rndecode(decode, 1); |
| 1215 | hyperstone_sari(decode); |
| 1216 | } |
| 1217 | |
| 1218 | static void hyperstone_opa8(UINT16 opcode) |
| 1219 | { |
| 1220 | LOCAL_DECODE_INIT; |
| 1221 | Rndecode(decode, 0); |
| 1222 | hyperstone_shli(decode); |
| 1223 | } |
| 1224 | |
| 1225 | static void hyperstone_opa9(UINT16 opcode) |
| 1226 | { |
| 1227 | LOCAL_DECODE_INIT; |
| 1228 | Rndecode(decode, 0); |
| 1229 | hyperstone_shli(decode); |
| 1230 | } |
| 1231 | |
| 1232 | static void hyperstone_opaa(UINT16 opcode) |
| 1233 | { |
| 1234 | LOCAL_DECODE_INIT; |
| 1235 | Rndecode(decode, 1); |
| 1236 | hyperstone_shli(decode); |
| 1237 | } |
| 1238 | |
| 1239 | static void hyperstone_opab(UINT16 opcode) |
| 1240 | { |
| 1241 | LOCAL_DECODE_INIT; |
| 1242 | Rndecode(decode, 1); |
| 1243 | hyperstone_shli(decode); |
| 1244 | } |
| 1245 | |
| 1246 | static void hyperstone_opac(UINT16 opcode) |
| 1247 | { |
| 1248 | LOCAL_DECODE_INIT; |
| 1249 | no_decode(decode); |
| 1250 | reserved(decode); |
| 1251 | } |
| 1252 | |
| 1253 | static void hyperstone_opad(UINT16 opcode) |
| 1254 | { |
| 1255 | LOCAL_DECODE_INIT; |
| 1256 | no_decode(decode); |
| 1257 | reserved(decode); |
| 1258 | } |
| 1259 | |
| 1260 | static void hyperstone_opae(UINT16 opcode) |
| 1261 | { |
| 1262 | LOCAL_DECODE_INIT; |
| 1263 | no_decode(decode); |
| 1264 | reserved(decode); |
| 1265 | } |
| 1266 | |
| 1267 | static void hyperstone_opaf(UINT16 opcode) |
| 1268 | { |
| 1269 | LOCAL_DECODE_INIT; |
| 1270 | no_decode(decode); |
| 1271 | reserved(decode); |
| 1272 | } |
| 1273 | |
| 1274 | |
| 1275 | |
| 1276 | static void hyperstone_opb0(UINT16 opcode) |
| 1277 | { |
| 1278 | LOCAL_DECODE_INIT; |
| 1279 | RRdecode(decode, 0, 0); |
| 1280 | hyperstone_mulu(decode); |
| 1281 | } |
| 1282 | |
| 1283 | static void hyperstone_opb1(UINT16 opcode) |
| 1284 | { |
| 1285 | LOCAL_DECODE_INIT; |
| 1286 | RRdecode(decode, 0, 1); |
| 1287 | hyperstone_mulu(decode); |
| 1288 | } |
| 1289 | |
| 1290 | static void hyperstone_opb2(UINT16 opcode) |
| 1291 | { |
| 1292 | LOCAL_DECODE_INIT; |
| 1293 | RRdecode(decode, 1, 0); |
| 1294 | hyperstone_mulu(decode); |
| 1295 | } |
| 1296 | |
| 1297 | static void hyperstone_opb3(UINT16 opcode) |
| 1298 | { |
| 1299 | LOCAL_DECODE_INIT; |
| 1300 | RRdecode(decode, 1, 1); |
| 1301 | hyperstone_mulu(decode); |
| 1302 | } |
| 1303 | |
| 1304 | static void hyperstone_opb4(UINT16 opcode) |
| 1305 | { |
| 1306 | LOCAL_DECODE_INIT; |
| 1307 | RRdecode(decode, 0, 0); |
| 1308 | hyperstone_muls(decode); |
| 1309 | } |
| 1310 | |
| 1311 | static void hyperstone_opb5(UINT16 opcode) |
| 1312 | { |
| 1313 | LOCAL_DECODE_INIT; |
| 1314 | RRdecode(decode, 0, 1); |
| 1315 | hyperstone_muls(decode); |
| 1316 | } |
| 1317 | |
| 1318 | static void hyperstone_opb6(UINT16 opcode) |
| 1319 | { |
| 1320 | LOCAL_DECODE_INIT; |
| 1321 | RRdecode(decode, 1, 0); |
| 1322 | hyperstone_muls(decode); |
| 1323 | } |
| 1324 | |
| 1325 | static void hyperstone_opb7(UINT16 opcode) |
| 1326 | { |
| 1327 | LOCAL_DECODE_INIT; |
| 1328 | RRdecode(decode, 1, 1); |
| 1329 | hyperstone_muls(decode); |
| 1330 | } |
| 1331 | |
| 1332 | static void hyperstone_opb8(UINT16 opcode) |
| 1333 | { |
| 1334 | LOCAL_DECODE_INIT; |
| 1335 | Rndecode(decode, 0); |
| 1336 | hyperstone_set(decode); |
| 1337 | } |
| 1338 | |
| 1339 | static void hyperstone_opb9(UINT16 opcode) |
| 1340 | { |
| 1341 | LOCAL_DECODE_INIT; |
| 1342 | Rndecode(decode, 0); |
| 1343 | hyperstone_set(decode); |
| 1344 | } |
| 1345 | |
| 1346 | static void hyperstone_opba(UINT16 opcode) |
| 1347 | { |
| 1348 | LOCAL_DECODE_INIT; |
| 1349 | Rndecode(decode, 1); |
| 1350 | hyperstone_set(decode); |
| 1351 | } |
| 1352 | |
| 1353 | static void hyperstone_opbb(UINT16 opcode) |
| 1354 | { |
| 1355 | LOCAL_DECODE_INIT; |
| 1356 | Rndecode(decode, 1); |
| 1357 | hyperstone_set(decode); |
| 1358 | } |
| 1359 | |
| 1360 | static void hyperstone_opbc(UINT16 opcode) |
| 1361 | { |
| 1362 | LOCAL_DECODE_INIT; |
| 1363 | RRdecode(decode, 0, 0); |
| 1364 | hyperstone_mul(decode); |
| 1365 | } |
| 1366 | |
| 1367 | static void hyperstone_opbd(UINT16 opcode) |
| 1368 | { |
| 1369 | LOCAL_DECODE_INIT; |
| 1370 | RRdecode(decode, 0, 1); |
| 1371 | hyperstone_mul(decode); |
| 1372 | } |
| 1373 | |
| 1374 | static void hyperstone_opbe(UINT16 opcode) |
| 1375 | { |
| 1376 | LOCAL_DECODE_INIT; |
| 1377 | RRdecode(decode, 1, 0); |
| 1378 | hyperstone_mul(decode); |
| 1379 | } |
| 1380 | |
| 1381 | static void hyperstone_opbf(UINT16 opcode) |
| 1382 | { |
| 1383 | LOCAL_DECODE_INIT; |
| 1384 | RRdecode(decode, 1, 1); |
| 1385 | hyperstone_mul(decode); |
| 1386 | } |
| 1387 | |
| 1388 | |
| 1389 | |
| 1390 | static void hyperstone_opc0(UINT16 opcode) |
| 1391 | { |
| 1392 | LOCAL_DECODE_INIT; |
| 1393 | LLdecode(decode); |
| 1394 | hyperstone_fadd(decode); |
| 1395 | } |
| 1396 | |
| 1397 | static void hyperstone_opc1(UINT16 opcode) |
| 1398 | { |
| 1399 | LOCAL_DECODE_INIT; |
| 1400 | LLdecode(decode); |
| 1401 | hyperstone_faddd(decode); |
| 1402 | } |
| 1403 | |
| 1404 | static void hyperstone_opc2(UINT16 opcode) |
| 1405 | { |
| 1406 | LOCAL_DECODE_INIT; |
| 1407 | LLdecode(decode); |
| 1408 | hyperstone_fsub(decode); |
| 1409 | } |
| 1410 | |
| 1411 | static void hyperstone_opc3(UINT16 opcode) |
| 1412 | { |
| 1413 | LOCAL_DECODE_INIT; |
| 1414 | LLdecode(decode); |
| 1415 | hyperstone_fsubd(decode); |
| 1416 | } |
| 1417 | |
| 1418 | static void hyperstone_opc4(UINT16 opcode) |
| 1419 | { |
| 1420 | LOCAL_DECODE_INIT; |
| 1421 | LLdecode(decode); |
| 1422 | hyperstone_fmul(decode); |
| 1423 | } |
| 1424 | |
| 1425 | static void hyperstone_opc5(UINT16 opcode) |
| 1426 | { |
| 1427 | LOCAL_DECODE_INIT; |
| 1428 | LLdecode(decode); |
| 1429 | hyperstone_fmuld(decode); |
| 1430 | } |
| 1431 | |
| 1432 | static void hyperstone_opc6(UINT16 opcode) |
| 1433 | { |
| 1434 | LOCAL_DECODE_INIT; |
| 1435 | LLdecode(decode); |
| 1436 | hyperstone_fdiv(decode); |
| 1437 | } |
| 1438 | |
| 1439 | static void hyperstone_opc7(UINT16 opcode) |
| 1440 | { |
| 1441 | LOCAL_DECODE_INIT; |
| 1442 | LLdecode(decode); |
| 1443 | hyperstone_fdivd(decode); |
| 1444 | } |
| 1445 | |
| 1446 | static void hyperstone_opc8(UINT16 opcode) |
| 1447 | { |
| 1448 | LOCAL_DECODE_INIT; |
| 1449 | LLdecode(decode); |
| 1450 | hyperstone_fcmp(decode); |
| 1451 | } |
| 1452 | |
| 1453 | static void hyperstone_opc9(UINT16 opcode) |
| 1454 | { |
| 1455 | LOCAL_DECODE_INIT; |
| 1456 | LLdecode(decode); |
| 1457 | hyperstone_fcmpd(decode); |
| 1458 | } |
| 1459 | |
| 1460 | static void hyperstone_opca(UINT16 opcode) |
| 1461 | { |
| 1462 | LOCAL_DECODE_INIT; |
| 1463 | LLdecode(decode); |
| 1464 | hyperstone_fcmpu(decode); |
| 1465 | } |
| 1466 | |
| 1467 | static void hyperstone_opcb(UINT16 opcode) |
| 1468 | { |
| 1469 | LOCAL_DECODE_INIT; |
| 1470 | LLdecode(decode); |
| 1471 | hyperstone_fcmpud(decode); |
| 1472 | } |
| 1473 | |
| 1474 | static void hyperstone_opcc(UINT16 opcode) |
| 1475 | { |
| 1476 | LOCAL_DECODE_INIT; |
| 1477 | LLdecode(decode); |
| 1478 | hyperstone_fcvt(decode); |
| 1479 | } |
| 1480 | |
| 1481 | static void hyperstone_opcd(UINT16 opcode) |
| 1482 | { |
| 1483 | LOCAL_DECODE_INIT; |
| 1484 | LLdecode(decode); |
| 1485 | hyperstone_fcvtd(decode); |
| 1486 | } |
| 1487 | |
| 1488 | static void hyperstone_opce(UINT16 opcode) |
| 1489 | { |
| 1490 | LOCAL_DECODE_INIT; |
| 1491 | LLextdecode(decode); |
| 1492 | hyperstone_extend(decode); |
| 1493 | } |
| 1494 | |
| 1495 | static void hyperstone_opcf(UINT16 opcode) |
| 1496 | { |
| 1497 | LOCAL_DECODE_INIT; |
| 1498 | LLdecode(decode); |
| 1499 | hyperstone_do(decode); |
| 1500 | } |
| 1501 | |
| 1502 | |
| 1503 | |
| 1504 | static void hyperstone_opd0(UINT16 opcode) |
| 1505 | { |
| 1506 | LOCAL_DECODE_INIT; |
| 1507 | LRdecode(decode, 0); |
| 1508 | hyperstone_ldwr(decode); |
| 1509 | } |
| 1510 | |
| 1511 | static void hyperstone_opd1(UINT16 opcode) |
| 1512 | { |
| 1513 | LOCAL_DECODE_INIT; |
| 1514 | LRdecode(decode, 1); |
| 1515 | hyperstone_ldwr(decode); |
| 1516 | } |
| 1517 | |
| 1518 | static void hyperstone_opd2(UINT16 opcode) |
| 1519 | { |
| 1520 | LOCAL_DECODE_INIT; |
| 1521 | LRdecode(decode, 0); |
| 1522 | hyperstone_lddr(decode); |
| 1523 | } |
| 1524 | |
| 1525 | static void hyperstone_opd3(UINT16 opcode) |
| 1526 | { |
| 1527 | LOCAL_DECODE_INIT; |
| 1528 | LRdecode(decode, 1); |
| 1529 | hyperstone_lddr(decode); |
| 1530 | } |
| 1531 | |
| 1532 | static void hyperstone_opd4(UINT16 opcode) |
| 1533 | { |
| 1534 | LOCAL_DECODE_INIT; |
| 1535 | LRdecode(decode, 0); |
| 1536 | hyperstone_ldwp(decode); |
| 1537 | } |
| 1538 | |
| 1539 | static void hyperstone_opd5(UINT16 opcode) |
| 1540 | { |
| 1541 | LOCAL_DECODE_INIT; |
| 1542 | LRdecode(decode, 1); |
| 1543 | hyperstone_ldwp(decode); |
| 1544 | } |
| 1545 | |
| 1546 | static void hyperstone_opd6(UINT16 opcode) |
| 1547 | { |
| 1548 | LOCAL_DECODE_INIT; |
| 1549 | LRdecode(decode, 0); |
| 1550 | hyperstone_lddp(decode); |
| 1551 | } |
| 1552 | |
| 1553 | static void hyperstone_opd7(UINT16 opcode) |
| 1554 | { |
| 1555 | LOCAL_DECODE_INIT; |
| 1556 | LRdecode(decode, 1); |
| 1557 | hyperstone_lddp(decode); |
| 1558 | } |
| 1559 | |
| 1560 | static void hyperstone_opd8(UINT16 opcode) |
| 1561 | { |
| 1562 | LOCAL_DECODE_INIT; |
| 1563 | LRdecode(decode, 0); |
| 1564 | hyperstone_stwr(decode); |
| 1565 | } |
| 1566 | |
| 1567 | static void hyperstone_opd9(UINT16 opcode) |
| 1568 | { |
| 1569 | LOCAL_DECODE_INIT; |
| 1570 | LRdecode(decode, 1); |
| 1571 | hyperstone_stwr(decode); |
| 1572 | } |
| 1573 | |
| 1574 | static void hyperstone_opda(UINT16 opcode) |
| 1575 | { |
| 1576 | LOCAL_DECODE_INIT; |
| 1577 | LRdecode(decode, 0); |
| 1578 | hyperstone_stdr(decode); |
| 1579 | } |
| 1580 | |
| 1581 | static void hyperstone_opdb(UINT16 opcode) |
| 1582 | { |
| 1583 | LOCAL_DECODE_INIT; |
| 1584 | LRdecode(decode, 1); |
| 1585 | hyperstone_stdr(decode); |
| 1586 | } |
| 1587 | |
| 1588 | static void hyperstone_opdc(UINT16 opcode) |
| 1589 | { |
| 1590 | LOCAL_DECODE_INIT; |
| 1591 | LRdecode(decode, 0); |
| 1592 | hyperstone_stwp(decode); |
| 1593 | } |
| 1594 | |
| 1595 | static void hyperstone_opdd(UINT16 opcode) |
| 1596 | { |
| 1597 | LOCAL_DECODE_INIT; |
| 1598 | LRdecode(decode, 1); |
| 1599 | hyperstone_stwp(decode); |
| 1600 | } |
| 1601 | |
| 1602 | static void hyperstone_opde(UINT16 opcode) |
| 1603 | { |
| 1604 | LOCAL_DECODE_INIT; |
| 1605 | LRdecode(decode, 0); |
| 1606 | hyperstone_stdp(decode); |
| 1607 | } |
| 1608 | |
| 1609 | static void hyperstone_opdf(UINT16 opcode) |
| 1610 | { |
| 1611 | LOCAL_DECODE_INIT; |
| 1612 | LRdecode(decode, 1); |
| 1613 | hyperstone_stdp(decode); |
| 1614 | } |
| 1615 | |
| 1616 | |
| 1617 | |
| 1618 | static void hyperstone_ope0(UINT16 opcode) |
| 1619 | { |
| 1620 | LOCAL_DECODE_INIT; |
| 1621 | PCreldecode(decode); |
| 1622 | hyperstone_dbv(decode); |
| 1623 | } |
| 1624 | |
| 1625 | static void hyperstone_ope1(UINT16 opcode) |
| 1626 | { |
| 1627 | LOCAL_DECODE_INIT; |
| 1628 | PCreldecode(decode); |
| 1629 | hyperstone_dbnv(decode); |
| 1630 | } |
| 1631 | |
| 1632 | static void hyperstone_ope2(UINT16 opcode) |
| 1633 | { |
| 1634 | LOCAL_DECODE_INIT; |
| 1635 | PCreldecode(decode); |
| 1636 | hyperstone_dbe(decode); |
| 1637 | } |
| 1638 | |
| 1639 | static void hyperstone_ope3(UINT16 opcode) |
| 1640 | { |
| 1641 | LOCAL_DECODE_INIT; |
| 1642 | PCreldecode(decode); |
| 1643 | hyperstone_dbne(decode); |
| 1644 | } |
| 1645 | |
| 1646 | static void hyperstone_ope4(UINT16 opcode) |
| 1647 | { |
| 1648 | LOCAL_DECODE_INIT; |
| 1649 | PCreldecode(decode); |
| 1650 | hyperstone_dbc(decode); |
| 1651 | } |
| 1652 | |
| 1653 | static void hyperstone_ope5(UINT16 opcode) |
| 1654 | { |
| 1655 | LOCAL_DECODE_INIT; |
| 1656 | PCreldecode(decode); |
| 1657 | hyperstone_dbnc(decode); |
| 1658 | } |
| 1659 | |
| 1660 | static void hyperstone_ope6(UINT16 opcode) |
| 1661 | { |
| 1662 | LOCAL_DECODE_INIT; |
| 1663 | PCreldecode(decode); |
| 1664 | hyperstone_dbse(decode); |
| 1665 | } |
| 1666 | |
| 1667 | static void hyperstone_ope7(UINT16 opcode) |
| 1668 | { |
| 1669 | LOCAL_DECODE_INIT; |
| 1670 | PCreldecode(decode); |
| 1671 | hyperstone_dbht(decode); |
| 1672 | } |
| 1673 | |
| 1674 | static void hyperstone_ope8(UINT16 opcode) |
| 1675 | { |
| 1676 | LOCAL_DECODE_INIT; |
| 1677 | PCreldecode(decode); |
| 1678 | hyperstone_dbn(decode); |
| 1679 | } |
| 1680 | |
| 1681 | static void hyperstone_ope9(UINT16 opcode) |
| 1682 | { |
| 1683 | LOCAL_DECODE_INIT; |
| 1684 | PCreldecode(decode); |
| 1685 | hyperstone_dbnn(decode); |
| 1686 | } |
| 1687 | |
| 1688 | static void hyperstone_opea(UINT16 opcode) |
| 1689 | { |
| 1690 | LOCAL_DECODE_INIT; |
| 1691 | PCreldecode(decode); |
| 1692 | hyperstone_dble(decode); |
| 1693 | } |
| 1694 | |
| 1695 | static void hyperstone_opeb(UINT16 opcode) |
| 1696 | { |
| 1697 | LOCAL_DECODE_INIT; |
| 1698 | PCreldecode(decode); |
| 1699 | hyperstone_dbgt(decode); |
| 1700 | } |
| 1701 | |
| 1702 | static void hyperstone_opec(UINT16 opcode) |
| 1703 | { |
| 1704 | LOCAL_DECODE_INIT; |
| 1705 | PCreldecode(decode); |
| 1706 | hyperstone_dbr(decode); |
| 1707 | } |
| 1708 | |
| 1709 | static void hyperstone_oped(UINT16 opcode) |
| 1710 | { |
| 1711 | LOCAL_DECODE_INIT; |
| 1712 | LLdecode(decode); |
| 1713 | hyperstone_frame(decode); |
| 1714 | } |
| 1715 | |
| 1716 | static void hyperstone_opee(UINT16 opcode) |
| 1717 | { |
| 1718 | LOCAL_DECODE_INIT; |
| 1719 | LRconstdecode(decode, 0); |
| 1720 | hyperstone_call(decode); |
| 1721 | } |
| 1722 | |
| 1723 | static void hyperstone_opef(UINT16 opcode) |
| 1724 | { |
| 1725 | LOCAL_DECODE_INIT; |
| 1726 | LRconstdecode(decode, 1); |
| 1727 | hyperstone_call(decode); |
| 1728 | } |
| 1729 | |
| 1730 | |
| 1731 | |
| 1732 | static void hyperstone_opf0(UINT16 opcode) |
| 1733 | { |
| 1734 | LOCAL_DECODE_INIT; |
| 1735 | PCreldecode(decode); |
| 1736 | hyperstone_bv(decode); |
| 1737 | } |
| 1738 | |
| 1739 | static void hyperstone_opf1(UINT16 opcode) |
| 1740 | { |
| 1741 | LOCAL_DECODE_INIT; |
| 1742 | PCreldecode(decode); |
| 1743 | hyperstone_bnv(decode); |
| 1744 | } |
| 1745 | |
| 1746 | static void hyperstone_opf2(UINT16 opcode) |
| 1747 | { |
| 1748 | LOCAL_DECODE_INIT; |
| 1749 | PCreldecode(decode); |
| 1750 | hyperstone_be(decode); |
| 1751 | } |
| 1752 | |
| 1753 | static void hyperstone_opf3(UINT16 opcode) |
| 1754 | { |
| 1755 | LOCAL_DECODE_INIT; |
| 1756 | PCreldecode(decode); |
| 1757 | hyperstone_bne(decode); |
| 1758 | } |
| 1759 | |
| 1760 | static void hyperstone_opf4(UINT16 opcode) |
| 1761 | { |
| 1762 | LOCAL_DECODE_INIT; |
| 1763 | PCreldecode(decode); |
| 1764 | hyperstone_bc(decode); |
| 1765 | } |
| 1766 | |
| 1767 | static void hyperstone_opf5(UINT16 opcode) |
| 1768 | { |
| 1769 | LOCAL_DECODE_INIT; |
| 1770 | PCreldecode(decode); |
| 1771 | hyperstone_bnc(decode); |
| 1772 | } |
| 1773 | |
| 1774 | static void hyperstone_opf6(UINT16 opcode) |
| 1775 | { |
| 1776 | LOCAL_DECODE_INIT; |
| 1777 | PCreldecode(decode); |
| 1778 | hyperstone_bse(decode); |
| 1779 | } |
| 1780 | |
| 1781 | static void hyperstone_opf7(UINT16 opcode) |
| 1782 | { |
| 1783 | LOCAL_DECODE_INIT; |
| 1784 | PCreldecode(decode); |
| 1785 | hyperstone_bht(decode); |
| 1786 | } |
| 1787 | |
| 1788 | static void hyperstone_opf8(UINT16 opcode) |
| 1789 | { |
| 1790 | LOCAL_DECODE_INIT; |
| 1791 | PCreldecode(decode); |
| 1792 | hyperstone_bn(decode); |
| 1793 | } |
| 1794 | |
| 1795 | static void hyperstone_opf9(UINT16 opcode) |
| 1796 | { |
| 1797 | LOCAL_DECODE_INIT; |
| 1798 | PCreldecode(decode); |
| 1799 | hyperstone_bnn(decode); |
| 1800 | } |
| 1801 | |
| 1802 | static void hyperstone_opfa(UINT16 opcode) |
| 1803 | { |
| 1804 | LOCAL_DECODE_INIT; |
| 1805 | PCreldecode(decode); |
| 1806 | hyperstone_ble(decode); |
| 1807 | } |
| 1808 | |
| 1809 | static void hyperstone_opfb(UINT16 opcode) |
| 1810 | { |
| 1811 | LOCAL_DECODE_INIT; |
| 1812 | PCreldecode(decode); |
| 1813 | hyperstone_bgt(decode); |
| 1814 | } |
| 1815 | |
| 1816 | static void hyperstone_opfc(UINT16 opcode) |
| 1817 | { |
| 1818 | LOCAL_DECODE_INIT; |
| 1819 | PCreldecode(decode); |
| 1820 | hyperstone_br(decode); |
| 1821 | } |
| 1822 | |
| 1823 | static void hyperstone_opfd(UINT16 opcode) |
| 1824 | { |
| 1825 | LOCAL_DECODE_INIT; |
| 1826 | PCadrdecode(decode); |
| 1827 | hyperstone_trap(decode); |
| 1828 | } |
| 1829 | |
| 1830 | static void hyperstone_opfe(UINT16 opcode) |
| 1831 | { |
| 1832 | LOCAL_DECODE_INIT; |
| 1833 | PCadrdecode(decode); |
| 1834 | hyperstone_trap(decode); |
| 1835 | } |
| 1836 | |
| 1837 | static void hyperstone_opff(UINT16 opcode) |
| 1838 | { |
| 1839 | LOCAL_DECODE_INIT; |
| 1840 | PCadrdecode(decode); |
| 1841 | hyperstone_trap(decode); |
| 1842 | } |
| 1843 | |
| 1844 | |
| 1845 | static void (*hyperstone_op[0x100])(UINT16 opcode) = |
| 1846 | { |
| 1847 | hyperstone_op00, hyperstone_op01, hyperstone_op02, hyperstone_op03, |
| 1848 | hyperstone_op04, hyperstone_op05, hyperstone_op06, hyperstone_op07, |
| 1849 | hyperstone_op08, hyperstone_op09, hyperstone_op0a, hyperstone_op0b, |
| 1850 | hyperstone_op0c, hyperstone_op0d, hyperstone_op0e, hyperstone_op0f, |
| 1851 | |
| 1852 | hyperstone_op10, hyperstone_op11, hyperstone_op12, hyperstone_op13, |
| 1853 | hyperstone_op14, hyperstone_op15, hyperstone_op16, hyperstone_op17, |
| 1854 | hyperstone_op18, hyperstone_op19, hyperstone_op1a, hyperstone_op1b, |
| 1855 | hyperstone_op1c, hyperstone_op1d, hyperstone_op1e, hyperstone_op1f, |
| 1856 | |
| 1857 | hyperstone_op20, hyperstone_op21, hyperstone_op22, hyperstone_op23, |
| 1858 | hyperstone_op24, hyperstone_op25, hyperstone_op26, hyperstone_op27, |
| 1859 | hyperstone_op28, hyperstone_op29, hyperstone_op2a, hyperstone_op2b, |
| 1860 | hyperstone_op2c, hyperstone_op2d, hyperstone_op2e, hyperstone_op2f, |
| 1861 | |
| 1862 | hyperstone_op30, hyperstone_op31, hyperstone_op32, hyperstone_op33, |
| 1863 | hyperstone_op34, hyperstone_op35, hyperstone_op36, hyperstone_op37, |
| 1864 | hyperstone_op38, hyperstone_op39, hyperstone_op3a, hyperstone_op3b, |
| 1865 | hyperstone_op3c, hyperstone_op3d, hyperstone_op3e, hyperstone_op3f, |
| 1866 | |
| 1867 | hyperstone_op40, hyperstone_op41, hyperstone_op42, hyperstone_op43, |
| 1868 | hyperstone_op44, hyperstone_op45, hyperstone_op46, hyperstone_op47, |
| 1869 | hyperstone_op48, hyperstone_op49, hyperstone_op4a, hyperstone_op4b, |
| 1870 | hyperstone_op4c, hyperstone_op4d, hyperstone_op4e, hyperstone_op4f, |
| 1871 | |
| 1872 | hyperstone_op50, hyperstone_op51, hyperstone_op52, hyperstone_op53, |
| 1873 | hyperstone_op54, hyperstone_op55, hyperstone_op56, hyperstone_op57, |
| 1874 | hyperstone_op58, hyperstone_op59, hyperstone_op5a, hyperstone_op5b, |
| 1875 | hyperstone_op5c, hyperstone_op5d, hyperstone_op5e, hyperstone_op5f, |
| 1876 | |
| 1877 | hyperstone_op60, hyperstone_op61, hyperstone_op62, hyperstone_op63, |
| 1878 | hyperstone_op64, hyperstone_op65, hyperstone_op66, hyperstone_op67, |
| 1879 | hyperstone_op68, hyperstone_op69, hyperstone_op6a, hyperstone_op6b, |
| 1880 | hyperstone_op6c, hyperstone_op6d, hyperstone_op6e, hyperstone_op6f, |
| 1881 | |
| 1882 | hyperstone_op70, hyperstone_op71, hyperstone_op72, hyperstone_op73, |
| 1883 | hyperstone_op74, hyperstone_op75, hyperstone_op76, hyperstone_op77, |
| 1884 | hyperstone_op78, hyperstone_op79, hyperstone_op7a, hyperstone_op7b, |
| 1885 | hyperstone_op7c, hyperstone_op7d, hyperstone_op7e, hyperstone_op7f, |
| 1886 | |
| 1887 | hyperstone_op80, hyperstone_op81, hyperstone_op82, hyperstone_op83, |
| 1888 | hyperstone_op84, hyperstone_op85, hyperstone_op86, hyperstone_op87, |
| 1889 | hyperstone_op88, hyperstone_op89, hyperstone_op8a, hyperstone_op8b, |
| 1890 | hyperstone_op8c, hyperstone_op8d, hyperstone_op8e, hyperstone_op8f, |
| 1891 | |
| 1892 | hyperstone_op90, hyperstone_op91, hyperstone_op92, hyperstone_op93, |
| 1893 | hyperstone_op94, hyperstone_op95, hyperstone_op96, hyperstone_op97, |
| 1894 | hyperstone_op98, hyperstone_op99, hyperstone_op9a, hyperstone_op9b, |
| 1895 | hyperstone_op9c, hyperstone_op9d, hyperstone_op9e, hyperstone_op9f, |
| 1896 | |
| 1897 | hyperstone_opa0, hyperstone_opa1, hyperstone_opa2, hyperstone_opa3, |
| 1898 | hyperstone_opa4, hyperstone_opa5, hyperstone_opa6, hyperstone_opa7, |
| 1899 | hyperstone_opa8, hyperstone_opa9, hyperstone_opaa, hyperstone_opab, |
| 1900 | hyperstone_opac, hyperstone_opad, hyperstone_opae, hyperstone_opaf, |
| 1901 | |
| 1902 | hyperstone_opb0, hyperstone_opb1, hyperstone_opb2, hyperstone_opb3, |
| 1903 | hyperstone_opb4, hyperstone_opb5, hyperstone_opb6, hyperstone_opb7, |
| 1904 | hyperstone_opb8, hyperstone_opb9, hyperstone_opba, hyperstone_opbb, |
| 1905 | hyperstone_opbc, hyperstone_opbd, hyperstone_opbe, hyperstone_opbf, |
| 1906 | |
| 1907 | hyperstone_opc0, hyperstone_opc1, hyperstone_opc2, hyperstone_opc3, |
| 1908 | hyperstone_opc4, hyperstone_opc5, hyperstone_opc6, hyperstone_opc7, |
| 1909 | hyperstone_opc8, hyperstone_opc9, hyperstone_opca, hyperstone_opcb, |
| 1910 | hyperstone_opcc, hyperstone_opcd, hyperstone_opce, hyperstone_opcf, |
| 1911 | |
| 1912 | hyperstone_opd0, hyperstone_opd1, hyperstone_opd2, hyperstone_opd3, |
| 1913 | hyperstone_opd4, hyperstone_opd5, hyperstone_opd6, hyperstone_opd7, |
| 1914 | hyperstone_opd8, hyperstone_opd9, hyperstone_opda, hyperstone_opdb, |
| 1915 | hyperstone_opdc, hyperstone_opdd, hyperstone_opde, hyperstone_opdf, |
| 1916 | |
| 1917 | hyperstone_ope0, hyperstone_ope1, hyperstone_ope2, hyperstone_ope3, |
| 1918 | hyperstone_ope4, hyperstone_ope5, hyperstone_ope6, hyperstone_ope7, |
| 1919 | hyperstone_ope8, hyperstone_ope9, hyperstone_opea, hyperstone_opeb, |
| 1920 | hyperstone_opec, hyperstone_oped, hyperstone_opee, hyperstone_opef, |
| 1921 | |
| 1922 | hyperstone_opf0, hyperstone_opf1, hyperstone_opf2, hyperstone_opf3, |
| 1923 | hyperstone_opf4, hyperstone_opf5, hyperstone_opf6, hyperstone_opf7, |
| 1924 | hyperstone_opf8, hyperstone_opf9, hyperstone_opfa, hyperstone_opfb, |
| 1925 | hyperstone_opfc, hyperstone_opfd, hyperstone_opfe, hyperstone_opff |
| 1926 | }; |
src/emu/cpu/e132xs/e132xs.c
| r1334 | r1335 | |
| 212 | 212 | *********************************************************************/ |
| 213 | 213 | |
| 214 | 214 | #include "debugger.h" |
| 215 | #include "eminline.h" |
| 215 | 216 | #include "e132xs.h" |
| 216 | 217 | #include "osd_cpu.h" |
| 217 | 218 | |
| 219 | #ifdef MAME_DEBUG |
| 220 | #define DEBUG_PRINTF(x) do { mame_printf_debug x; } while (0) |
| 221 | #else |
| 222 | #define DEBUG_PRINTF(x) do { } while (0) |
| 223 | #endif |
| 224 | |
| 218 | 225 | static UINT8 (*hyp_cpu_read_byte)(offs_t address); |
| 219 | 226 | static UINT16 (*hyp_cpu_read_half_word)(offs_t address); |
| 220 | 227 | static UINT32 (*hyp_cpu_read_word)(offs_t address); |
| r1334 | r1335 | |
| 231 | 238 | |
| 232 | 239 | static int hyperstone_ICount; |
| 233 | 240 | |
| 234 | | static void hyperstone_chk(void); |
| 235 | | static void hyperstone_movd(void); |
| 236 | | static void hyperstone_divu(void); |
| 237 | | static void hyperstone_divs(void); |
| 238 | | static void hyperstone_xm(void); |
| 239 | | static void hyperstone_mask(void); |
| 240 | | static void hyperstone_sum(void); |
| 241 | | static void hyperstone_sums(void); |
| 242 | | static void hyperstone_cmp(void); |
| 243 | | static void hyperstone_mov(void); |
| 244 | | static void hyperstone_add(void); |
| 245 | | static void hyperstone_adds(void); |
| 246 | | static void hyperstone_cmpb(void); |
| 247 | | static void hyperstone_andn(void); |
| 248 | | static void hyperstone_or(void); |
| 249 | | static void hyperstone_xor(void); |
| 250 | | static void hyperstone_subc(void); |
| 251 | | static void hyperstone_not(void); |
| 252 | | static void hyperstone_sub(void); |
| 253 | | static void hyperstone_subs(void); |
| 254 | | static void hyperstone_addc(void); |
| 255 | | static void hyperstone_and(void); |
| 256 | | static void hyperstone_neg(void); |
| 257 | | static void hyperstone_negs(void); |
| 258 | | static void hyperstone_cmpi(void); |
| 259 | | static void hyperstone_movi(void); |
| 260 | | static void hyperstone_addi(void); |
| 261 | | static void hyperstone_addsi(void); |
| 262 | | static void hyperstone_cmpbi(void); |
| 263 | | static void hyperstone_andni(void); |
| 264 | | static void hyperstone_ori(void); |
| 265 | | static void hyperstone_xori(void); |
| 266 | | static void hyperstone_shrdi(void); |
| 267 | | static void hyperstone_shrd(void); |
| 268 | | static void hyperstone_shr(void); |
| 269 | | static void hyperstone_sardi(void); |
| 270 | | static void hyperstone_sard(void); |
| 271 | | static void hyperstone_sar(void); |
| 272 | | static void hyperstone_shldi(void); |
| 273 | | static void hyperstone_shld(void); |
| 274 | | static void hyperstone_shl(void); |
| 275 | | static void reserved(void); |
| 276 | | static void hyperstone_testlz(void); |
| 277 | | static void hyperstone_rol(void); |
| 278 | | static void hyperstone_ldxx1(void); |
| 279 | | static void hyperstone_ldxx2(void); |
| 280 | | static void hyperstone_stxx1(void); |
| 281 | | static void hyperstone_stxx2(void); |
| 282 | | static void hyperstone_shri(void); |
| 283 | | static void hyperstone_sari(void); |
| 284 | | static void hyperstone_shli(void); |
| 285 | | static void hyperstone_mulu(void); |
| 286 | | static void hyperstone_muls(void); |
| 287 | | static void hyperstone_set(void); |
| 288 | | static void hyperstone_mul(void); |
| 289 | | static void hyperstone_fadd(void); |
| 290 | | static void hyperstone_faddd(void); |
| 291 | | static void hyperstone_fsub(void); |
| 292 | | static void hyperstone_fsubd(void); |
| 293 | | static void hyperstone_fmul(void); |
| 294 | | static void hyperstone_fmuld(void); |
| 295 | | static void hyperstone_fdiv(void); |
| 296 | | static void hyperstone_fdivd(void); |
| 297 | | static void hyperstone_fcmp(void); |
| 298 | | static void hyperstone_fcmpd(void); |
| 299 | | static void hyperstone_fcmpu(void); |
| 300 | | static void hyperstone_fcmpud(void); |
| 301 | | static void hyperstone_fcvt(void); |
| 302 | | static void hyperstone_fcvtd(void); |
| 303 | | static void hyperstone_extend(void); |
| 304 | | static void hyperstone_do(void); |
| 305 | | static void hyperstone_ldwr(void); |
| 306 | | static void hyperstone_lddr(void); |
| 307 | | static void hyperstone_ldwp(void); |
| 308 | | static void hyperstone_lddp(void); |
| 309 | | static void hyperstone_stwr(void); |
| 310 | | static void hyperstone_stdr(void); |
| 311 | | static void hyperstone_stwp(void); |
| 312 | | static void hyperstone_stdp(void); |
| 313 | | static void hyperstone_dbv(void); |
| 314 | | static void hyperstone_dbnv(void); |
| 315 | | static void hyperstone_dbe(void); |
| 316 | | static void hyperstone_dbne(void); |
| 317 | | static void hyperstone_dbc(void); |
| 318 | | static void hyperstone_dbnc(void); |
| 319 | | static void hyperstone_dbse(void); |
| 320 | | static void hyperstone_dbht(void); |
| 321 | | static void hyperstone_dbn(void); |
| 322 | | static void hyperstone_dbnn(void); |
| 323 | | static void hyperstone_dble(void); |
| 324 | | static void hyperstone_dbgt(void); |
| 325 | | static void hyperstone_dbr(void); |
| 326 | | static void hyperstone_frame(void); |
| 327 | | static void hyperstone_call(void); |
| 328 | | static void hyperstone_bv(void); |
| 329 | | static void hyperstone_bnv(void); |
| 330 | | static void hyperstone_be(void); |
| 331 | | static void hyperstone_bne(void); |
| 332 | | static void hyperstone_bc(void); |
| 333 | | static void hyperstone_bnc(void); |
| 334 | | static void hyperstone_bse(void); |
| 335 | | static void hyperstone_bht(void); |
| 336 | | static void hyperstone_bn(void); |
| 337 | | static void hyperstone_bnn(void); |
| 338 | | static void hyperstone_ble(void); |
| 339 | | static void hyperstone_bgt(void); |
| 340 | | static void hyperstone_br(void); |
| 341 | | static void hyperstone_trap(void); |
| 342 | | |
| 343 | 241 | /* Registers */ |
| 344 | 242 | |
| 345 | 243 | enum |
| r1334 | r1335 | |
| 417 | 315 | UINT16 op; // opcode |
| 418 | 316 | UINT32 trap_entry; // entry point to get trap address |
| 419 | 317 | |
| 420 | | UINT8 n; |
| 421 | | INT32 delay_timer; |
| 422 | | int timer_clocks; |
| 318 | UINT8 clock_scale_mask; |
| 319 | UINT8 clock_scale; |
| 320 | UINT8 clock_cycles_1; |
| 321 | UINT8 clock_cycles_2; |
| 322 | UINT8 clock_cycles_4; |
| 323 | UINT8 clock_cycles_6; |
| 423 | 324 | |
| 325 | UINT64 tr_base_cycles; |
| 326 | UINT32 tr_base_value; |
| 327 | UINT32 tr_clocks_per_tick; |
| 328 | UINT8 timer_int_pending; |
| 329 | emu_timer *timer; |
| 330 | |
| 424 | 331 | struct _delay delay; |
| 425 | 332 | |
| 426 | 333 | int (*irq_callback)(int irqline); |
| 427 | 334 | |
| 428 | | INT32 h_clear; |
| 429 | 335 | INT32 instruction_length; |
| 430 | 336 | INT32 intblock; |
| 431 | 337 | |
| r1334 | r1335 | |
| 433 | 339 | |
| 434 | 340 | static hyperstone_regs hyperstone; |
| 435 | 341 | |
| 436 | | static struct regs_decode |
| 342 | struct regs_decode |
| 437 | 343 | { |
| 438 | 344 | UINT8 src, dst; // destination and source register code |
| 439 | 345 | UINT32 src_value; // current source register value |
| r1334 | r1335 | |
| 443 | 349 | UINT8 sub_type; // sub type opcode (for DD and X_CODE bits) |
| 444 | 350 | union |
| 445 | 351 | { |
| 446 | | UINT32 u; |
| 447 | | INT32 s; |
| 352 | UINT32 u; |
| 353 | INT32 s; |
| 448 | 354 | } extra; // extra value such as immediate value, const, pcrel, ... |
| 449 | | void (*set_src_register)(UINT8 reg, UINT32 data); // set local / global source register |
| 450 | | void (*set_dst_register)(UINT8 reg, UINT32 data); // set local / global destination register |
| 451 | | UINT8 src_is_pc; |
| 452 | | UINT8 dst_is_pc; |
| 453 | | UINT8 src_is_sr; |
| 454 | | UINT8 dst_is_sr; |
| 355 | UINT8 src_is_local; |
| 356 | UINT8 dst_is_local; |
| 455 | 357 | UINT8 same_src_dst; |
| 456 | 358 | UINT8 same_src_dstf; |
| 457 | 359 | UINT8 same_srcf_dst; |
| 458 | | } current_regs; |
| 360 | UINT16 op; |
| 361 | }; |
| 459 | 362 | |
| 460 | | #define SREG current_regs.src_value |
| 461 | | #define SREGF current_regs.next_src_value |
| 462 | | #define DREG current_regs.dst_value |
| 463 | | #define DREGF current_regs.next_dst_value |
| 464 | | #define EXTRA_U current_regs.extra.u |
| 465 | | #define EXTRA_S current_regs.extra.s |
| 363 | static void check_interrupts(void); |
| 466 | 364 | |
| 467 | | #define SET_SREG( _data_ ) (*current_regs.set_src_register)(current_regs.src, _data_) |
| 468 | | #define SET_SREGF( _data_ ) (*current_regs.set_src_register)(current_regs.src + 1, _data_) |
| 469 | | #define SET_DREG( _data_ ) (*current_regs.set_dst_register)(current_regs.dst, _data_) |
| 470 | | #define SET_DREGF( _data_ ) (*current_regs.set_dst_register)(current_regs.dst + 1, _data_) |
| 365 | #define SREG (decode)->src_value |
| 366 | #define SREGF (decode)->next_src_value |
| 367 | #define DREG (decode)->dst_value |
| 368 | #define DREGF (decode)->next_dst_value |
| 369 | #define EXTRA_U (decode)->extra.u |
| 370 | #define EXTRA_S (decode)->extra.s |
| 371 | #define OP (decode)->op |
| 471 | 372 | |
| 472 | | #define SRC_IS_PC current_regs.src_is_pc |
| 473 | | #define DST_IS_PC current_regs.dst_is_pc |
| 474 | | #define SRC_IS_SR current_regs.src_is_sr |
| 475 | | #define DST_IS_SR current_regs.dst_is_sr |
| 476 | | #define SAME_SRC_DST current_regs.same_src_dst |
| 477 | | #define SAME_SRC_DSTF current_regs.same_src_dstf |
| 478 | | #define SAME_SRCF_DST current_regs.same_srcf_dst |
| 373 | #define SET_SREG( _data_ ) ((decode)->src_is_local ? set_local_register((decode)->src, _data_) : set_global_register((decode)->src, _data_)) |
| 374 | #define SET_SREGF( _data_ ) ((decode)->src_is_local ? set_local_register((decode)->src + 1, _data_) : set_global_register((decode)->src + 1, _data_)) |
| 375 | #define SET_DREG( _data_ ) ((decode)->dst_is_local ? set_local_register((decode)->dst, _data_) : set_global_register((decode)->dst, _data_)) |
| 376 | #define SET_DREGF( _data_ ) ((decode)->dst_is_local ? set_local_register((decode)->dst + 1, _data_) : set_global_register((decode)->dst + 1, _data_)) |
| 479 | 377 | |
| 378 | #define SRC_IS_PC (!(decode)->src_is_local && (decode)->src == PC_REGISTER) |
| 379 | #define DST_IS_PC (!(decode)->dst_is_local && (decode)->dst == PC_REGISTER) |
| 380 | #define SRC_IS_SR (!(decode)->src_is_local && (decode)->src == SR_REGISTER) |
| 381 | #define DST_IS_SR (!(decode)->dst_is_local && (decode)->dst == SR_REGISTER) |
| 382 | #define SAME_SRC_DST (decode)->same_src_dst |
| 383 | #define SAME_SRC_DSTF (decode)->same_src_dstf |
| 384 | #define SAME_SRCF_DST (decode)->same_srcf_dst |
| 385 | |
| 480 | 386 | #if (HAS_E116T || HAS_E116XT || HAS_E116XS || HAS_E116XSR || HAS_GMS30C2116 || HAS_GMS30C2216) |
| 481 | 387 | static UINT32 program_read_dword_16be(offs_t address) |
| 482 | 388 | { |
| r1334 | r1335 | |
| 502 | 408 | #endif |
| 503 | 409 | |
| 504 | 410 | |
| 505 | | /* Opcodes table */ |
| 506 | | static void (*hyperstone_op[0x100])(void) = { |
| 507 | | hyperstone_chk, hyperstone_chk, hyperstone_chk, hyperstone_chk, /* CHK - CHKZ - NOP */ |
| 508 | | hyperstone_movd, hyperstone_movd, hyperstone_movd, hyperstone_movd, /* MOVD - RET */ |
| 509 | | hyperstone_divu, hyperstone_divu, hyperstone_divu, hyperstone_divu, /* DIVU */ |
| 510 | | hyperstone_divs, hyperstone_divs, hyperstone_divs, hyperstone_divs, /* DIVS */ |
| 511 | | hyperstone_xm, hyperstone_xm, hyperstone_xm, hyperstone_xm, /* XMx - XXx */ |
| 512 | | hyperstone_mask, hyperstone_mask, hyperstone_mask, hyperstone_mask, /* MASK */ |
| 513 | | hyperstone_sum, hyperstone_sum, hyperstone_sum, hyperstone_sum, /* SUM */ |
| 514 | | hyperstone_sums, hyperstone_sums, hyperstone_sums, hyperstone_sums, /* SUMS */ |
| 515 | | hyperstone_cmp, hyperstone_cmp, hyperstone_cmp, hyperstone_cmp, /* CMP */ |
| 516 | | hyperstone_mov, hyperstone_mov, hyperstone_mov, hyperstone_mov, /* MOV */ |
| 517 | | hyperstone_add, hyperstone_add, hyperstone_add, hyperstone_add, /* ADD */ |
| 518 | | hyperstone_adds, hyperstone_adds, hyperstone_adds, hyperstone_adds, /* ADDS */ |
| 519 | | hyperstone_cmpb, hyperstone_cmpb, hyperstone_cmpb, hyperstone_cmpb, /* CMPB */ |
| 520 | | hyperstone_andn, hyperstone_andn, hyperstone_andn, hyperstone_andn, /* ANDN */ |
| 521 | | hyperstone_or, hyperstone_or, hyperstone_or, hyperstone_or, /* OR */ |
| 522 | | hyperstone_xor, hyperstone_xor, hyperstone_xor, hyperstone_xor, /* XOR */ |
| 523 | | hyperstone_subc, hyperstone_subc, hyperstone_subc, hyperstone_subc, /* SUBC */ |
| 524 | | hyperstone_not, hyperstone_not, hyperstone_not, hyperstone_not, /* NOT */ |
| 525 | | hyperstone_sub, hyperstone_sub, hyperstone_sub, hyperstone_sub, /* SUB */ |
| 526 | | hyperstone_subs, hyperstone_subs, hyperstone_subs, hyperstone_subs, /* SUBS */ |
| 527 | | hyperstone_addc, hyperstone_addc, hyperstone_addc, hyperstone_addc, /* ADDC */ |
| 528 | | hyperstone_and, hyperstone_and, hyperstone_and, hyperstone_and, /* AND */ |
| 529 | | hyperstone_neg, hyperstone_neg, hyperstone_neg, hyperstone_neg, /* NEG */ |
| 530 | | hyperstone_negs, hyperstone_negs, hyperstone_negs, hyperstone_negs, /* NEGS */ |
| 531 | | hyperstone_cmpi, hyperstone_cmpi, hyperstone_cmpi, hyperstone_cmpi, /* CMPI */ |
| 532 | | hyperstone_movi, hyperstone_movi, hyperstone_movi, hyperstone_movi, /* MOVI */ |
| 533 | | hyperstone_addi, hyperstone_addi, hyperstone_addi, hyperstone_addi, /* ADDI */ |
| 534 | | hyperstone_addsi,hyperstone_addsi,hyperstone_addsi, hyperstone_addsi, /* ADDSI */ |
| 535 | | hyperstone_cmpbi,hyperstone_cmpbi,hyperstone_cmpbi, hyperstone_cmpbi, /* CMPBI */ |
| 536 | | hyperstone_andni,hyperstone_andni,hyperstone_andni, hyperstone_andni, /* ANDNI */ |
| 537 | | hyperstone_ori, hyperstone_ori, hyperstone_ori, hyperstone_ori, /* ORI */ |
| 538 | | hyperstone_xori, hyperstone_xori, hyperstone_xori, hyperstone_xori, /* XORI */ |
| 539 | | hyperstone_shrdi,hyperstone_shrdi,hyperstone_shrd, hyperstone_shr, /* SHRDI, SHRD, SHR */ |
| 540 | | hyperstone_sardi,hyperstone_sardi,hyperstone_sard, hyperstone_sar, /* SARDI, SARD, SAR */ |
| 541 | | hyperstone_shldi,hyperstone_shldi,hyperstone_shld, hyperstone_shl, /* SHLDI, SHLD, SHL */ |
| 542 | | reserved, reserved, hyperstone_testlz,hyperstone_rol, /* RESERVED, TESTLZ, ROL */ |
| 543 | | hyperstone_ldxx1,hyperstone_ldxx1,hyperstone_ldxx1, hyperstone_ldxx1, /* LDxx.D/A/IOD/IOA */ |
| 544 | | hyperstone_ldxx2,hyperstone_ldxx2,hyperstone_ldxx2, hyperstone_ldxx2, /* LDxx.N/S */ |
| 545 | | hyperstone_stxx1,hyperstone_stxx1,hyperstone_stxx1, hyperstone_stxx1, /* STxx.D/A/IOD/IOA */ |
| 546 | | hyperstone_stxx2,hyperstone_stxx2,hyperstone_stxx2, hyperstone_stxx2, /* STxx.N/S */ |
| 547 | | hyperstone_shri, hyperstone_shri, hyperstone_shri, hyperstone_shri, /* SHRI */ |
| 548 | | hyperstone_sari, hyperstone_sari, hyperstone_sari, hyperstone_sari, /* SARI */ |
| 549 | | hyperstone_shli, hyperstone_shli, hyperstone_shli, hyperstone_shli, /* SHLI */ |
| 550 | | reserved, reserved, reserved, reserved, /* RESERVED */ |
| 551 | | hyperstone_mulu, hyperstone_mulu, hyperstone_mulu, hyperstone_mulu, /* MULU */ |
| 552 | | hyperstone_muls, hyperstone_muls, hyperstone_muls, hyperstone_muls, /* MULS */ |
| 553 | | hyperstone_set, hyperstone_set, hyperstone_set, hyperstone_set, /* SETxx - SETADR - FETCH */ |
| 554 | | hyperstone_mul, hyperstone_mul, hyperstone_mul, hyperstone_mul, /* MUL */ |
| 555 | | hyperstone_fadd, hyperstone_faddd,hyperstone_fsub, hyperstone_fsubd, /* FADD, FADDD, FSUB, FSUBD */ |
| 556 | | hyperstone_fmul, hyperstone_fmuld,hyperstone_fdiv, hyperstone_fdivd, /* FMUL, FMULD, FDIV, FDIVD */ |
| 557 | | hyperstone_fcmp, hyperstone_fcmpd,hyperstone_fcmpu, hyperstone_fcmpud, /* FCMP, FCMPD, FCMPU, FCMPUD */ |
| 558 | | hyperstone_fcvt, hyperstone_fcvtd,hyperstone_extend,hyperstone_do, /* FCVT, FCVTD, EXTEND, DO */ |
| 559 | | hyperstone_ldwr, hyperstone_ldwr, hyperstone_lddr, hyperstone_lddr, /* LDW.R, LDD.R */ |
| 560 | | hyperstone_ldwp, hyperstone_ldwp, hyperstone_lddp, hyperstone_lddp, /* LDW.P, LDD.P */ |
| 561 | | hyperstone_stwr, hyperstone_stwr, hyperstone_stdr, hyperstone_stdr, /* STW.R, STD.R */ |
| 562 | | hyperstone_stwp, hyperstone_stwp, hyperstone_stdp, hyperstone_stdp, /* STW.P, STD.P */ |
| 563 | | hyperstone_dbv, hyperstone_dbnv, hyperstone_dbe, hyperstone_dbne, /* DBV, DBNV, DBE, DBNE */ |
| 564 | | hyperstone_dbc, hyperstone_dbnc, hyperstone_dbse, hyperstone_dbht, /* DBC, DBNC, DBSE, DBHT */ |
| 565 | | hyperstone_dbn, hyperstone_dbnn, hyperstone_dble, hyperstone_dbgt, /* DBN, DBNN, DBLE, DBGT */ |
| 566 | | hyperstone_dbr, hyperstone_frame,hyperstone_call, hyperstone_call, /* DBR, FRAME, CALL */ |
| 567 | | hyperstone_bv, hyperstone_bnv, hyperstone_be, hyperstone_bne, /* BV, BNV, BE, BNE */ |
| 568 | | hyperstone_bc, hyperstone_bnc, hyperstone_bse, hyperstone_bht, /* BC, BNC, BSE, BHT */ |
| 569 | | hyperstone_bn, hyperstone_bnn, hyperstone_ble, hyperstone_bgt, /* BN, BNN, BLE, BGT */ |
| 570 | | hyperstone_br, hyperstone_trap, hyperstone_trap, hyperstone_trap /* BR, TRAPxx - TRAP */ |
| 571 | | }; |
| 572 | | |
| 573 | 411 | // 4Kb IRAM (On-Chip Memory) |
| 574 | 412 | #if (HAS_E116T || HAS_GMS30C2116) |
| 575 | 413 | |
| r1334 | r1335 | |
| 680 | 518 | break; |
| 681 | 519 | |
| 682 | 520 | default: |
| 683 | | logerror("Set entry point to a reserved value: %d\n", which); |
| 521 | DEBUG_PRINTF(("Set entry point to a reserved value: %d\n", which)); |
| 684 | 522 | break; |
| 685 | 523 | } |
| 686 | 524 | } |
| 687 | 525 | |
| 688 | | #define OP hyperstone.op |
| 689 | | |
| 690 | 526 | #define PPC hyperstone.ppc //previous pc |
| 691 | 527 | #define PC hyperstone.global_regs[0] //Program Counter |
| 692 | 528 | #define SR hyperstone.global_regs[1] //Status Register |
| r1334 | r1335 | |
| 698 | 534 | #define BCR hyperstone.global_regs[20] //Bus Control Register |
| 699 | 535 | #define TPR hyperstone.global_regs[21] //Timer Prescaler Register |
| 700 | 536 | #define TCR hyperstone.global_regs[22] //Timer Compare Register |
| 701 | | #define TR hyperstone.global_regs[23] //Timer Register |
| 537 | #define TR compute_tr() //Timer Register |
| 702 | 538 | #define WCR hyperstone.global_regs[24] //Watchdog Compare Register |
| 703 | 539 | #define ISR hyperstone.global_regs[25] //Input Status Register |
| 704 | 540 | #define FCR hyperstone.global_regs[26] //Function Control Register |
| r1334 | r1335 | |
| 761 | 597 | //other bits are reversed, in particular 7 - 5 for the operating system. |
| 762 | 598 | //the user program can only changes the above 2 flags |
| 763 | 599 | |
| 600 | |
| 601 | |
| 602 | |
| 603 | static UINT32 compute_tr(void) |
| 604 | { |
| 605 | UINT64 cycles_since_base = activecpu_gettotalcycles64() - hyperstone.tr_base_cycles; |
| 606 | UINT64 clocks_since_base = cycles_since_base >> hyperstone.clock_scale; |
| 607 | return hyperstone.tr_base_value + (clocks_since_base / hyperstone.tr_clocks_per_tick); |
| 608 | } |
| 609 | |
| 610 | static void update_timer_prescale(void) |
| 611 | { |
| 612 | UINT32 prevtr = compute_tr(); |
| 613 | TPR &= ~0x80000000; |
| 614 | hyperstone.clock_scale = (TPR >> 26) & hyperstone.clock_scale_mask; |
| 615 | hyperstone.clock_cycles_1 = 1 << hyperstone.clock_scale; |
| 616 | hyperstone.clock_cycles_2 = 2 << hyperstone.clock_scale; |
| 617 | hyperstone.clock_cycles_4 = 4 << hyperstone.clock_scale; |
| 618 | hyperstone.clock_cycles_6 = 6 << hyperstone.clock_scale; |
| 619 | hyperstone.tr_clocks_per_tick = ((TPR >> 16) & 0xff) + 2; |
| 620 | hyperstone.tr_base_value = prevtr; |
| 621 | hyperstone.tr_base_cycles = activecpu_gettotalcycles64(); |
| 622 | } |
| 623 | |
| 624 | static void adjust_timer_interrupt(void) |
| 625 | { |
| 626 | UINT64 cycles_since_base = activecpu_gettotalcycles64() - hyperstone.tr_base_cycles; |
| 627 | UINT64 clocks_since_base = cycles_since_base >> hyperstone.clock_scale; |
| 628 | UINT64 cycles_until_next_clock = cycles_since_base - (clocks_since_base << hyperstone.clock_scale); |
| 629 | int cpunum = cpu_getactivecpu(); |
| 630 | |
| 631 | if (cycles_until_next_clock == 0) |
| 632 | cycles_until_next_clock = (UINT64)(1 << hyperstone.clock_scale); |
| 633 | |
| 634 | /* special case: if we have a change pending, set a timer to fire then */ |
| 635 | if (TPR & 0x80000000) |
| 636 | { |
| 637 | UINT64 clocks_until_int = hyperstone.tr_clocks_per_tick - (clocks_since_base % hyperstone.tr_clocks_per_tick); |
| 638 | UINT64 cycles_until_int = (clocks_until_int << hyperstone.clock_scale) + cycles_until_next_clock; |
| 639 | timer_adjust(hyperstone.timer, ATTOTIME_IN_CYCLES(cycles_until_int + 1, cpunum), cpunum * 2 + 1, attotime_never); |
| 640 | } |
| 641 | |
| 642 | /* else if the timer interrupt is enabled, configure it to fire at the appropriate time */ |
| 643 | else if (!(FCR & 0x00800000)) |
| 644 | { |
| 645 | UINT32 curtr = hyperstone.tr_base_value + (clocks_since_base / hyperstone.tr_clocks_per_tick); |
| 646 | UINT32 delta = TCR - curtr; |
| 647 | if (delta > 0x80000000) |
| 648 | { |
| 649 | if (!hyperstone.timer_int_pending) |
| 650 | timer_adjust(hyperstone.timer, attotime_zero, cpunum * 2 + 0, attotime_never); |
| 651 | } |
| 652 | else |
| 653 | { |
| 654 | UINT64 clocks_until_int = mulu_32x32(delta, hyperstone.tr_clocks_per_tick); |
| 655 | UINT64 cycles_until_int = (clocks_until_int << hyperstone.clock_scale) + cycles_until_next_clock; |
| 656 | timer_adjust(hyperstone.timer, ATTOTIME_IN_CYCLES(cycles_until_int, cpunum), cpunum * 2 + 0, attotime_never); |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | /* otherwise, disable the timer */ |
| 661 | else |
| 662 | timer_adjust(hyperstone.timer, attotime_never, 0, attotime_never); |
| 663 | } |
| 664 | |
| 665 | static TIMER_CALLBACK( timer_callback ) |
| 666 | { |
| 667 | int update = param & 1; |
| 668 | int cpunum = param >> 1; |
| 669 | |
| 670 | cpuintrf_push_context(cpunum); |
| 671 | |
| 672 | /* update the values if necessary */ |
| 673 | if (update) |
| 674 | update_timer_prescale(); |
| 675 | |
| 676 | /* see if the timer is right for firing */ |
| 677 | if (!((compute_tr() - TCR) & 0x80000000)) |
| 678 | hyperstone.timer_int_pending = 1; |
| 679 | |
| 680 | /* adjust ourselves for the next time */ |
| 681 | else |
| 682 | adjust_timer_interrupt(); |
| 683 | |
| 684 | cpuintrf_pop_context(); |
| 685 | } |
| 686 | |
| 687 | |
| 688 | |
| 689 | |
| 764 | 690 | static UINT32 get_global_register(UINT8 code) |
| 765 | 691 | { |
| 766 | 692 | /* |
| r1334 | r1335 | |
| 774 | 700 | case 29: |
| 775 | 701 | case 30: |
| 776 | 702 | case 31: |
| 777 | | mame_printf_debug("read _Reserved_ Global Register %d @ %08X\n",code,PC); |
| 703 | DEBUG_PRINTF(("read _Reserved_ Global Register %d @ %08X\n",code,PC)); |
| 778 | 704 | break; |
| 779 | 705 | |
| 780 | 706 | case BCR_REGISTER: |
| 781 | | mame_printf_debug("read write-only BCR register @ %08X\n",PC); |
| 707 | DEBUG_PRINTF(("read write-only BCR register @ %08X\n",PC)); |
| 782 | 708 | return 0; |
| 783 | 709 | |
| 784 | 710 | case TPR_REGISTER: |
| 785 | | mame_printf_debug("read write-only TPR register @ %08X\n",PC); |
| 711 | DEBUG_PRINTF(("read write-only TPR register @ %08X\n",PC)); |
| 786 | 712 | return 0; |
| 787 | 713 | |
| 788 | 714 | case FCR_REGISTER: |
| 789 | | mame_printf_debug("read write-only FCR register @ %08X\n",PC); |
| 715 | DEBUG_PRINTF(("read write-only FCR register @ %08X\n",PC)); |
| 790 | 716 | return 0; |
| 791 | 717 | |
| 792 | 718 | case MCR_REGISTER: |
| 793 | | mame_printf_debug("read write-only MCR register @ %08X\n",PC); |
| 719 | DEBUG_PRINTF(("read write-only MCR register @ %08X\n",PC)); |
| 794 | 720 | return 0; |
| 795 | 721 | } |
| 796 | 722 | } |
| 797 | 723 | */ |
| 724 | if (code == TR_REGISTER) |
| 725 | { |
| 726 | /* it is common to poll this in a loop */ |
| 727 | if (hyperstone_ICount > hyperstone.tr_clocks_per_tick / 2) |
| 728 | hyperstone_ICount -= hyperstone.tr_clocks_per_tick / 2; |
| 729 | return compute_tr(); |
| 730 | } |
| 798 | 731 | return hyperstone.global_regs[code]; |
| 799 | 732 | } |
| 800 | 733 | |
| 801 | | static void set_global_register(UINT8 code, UINT32 val) |
| 734 | INLINE void set_global_register(UINT8 code, UINT32 val) |
| 802 | 735 | { |
| 803 | 736 | //TODO: add correct FER set instruction |
| 804 | 737 | |
| r1334 | r1335 | |
| 810 | 743 | else if( code == SR_REGISTER ) |
| 811 | 744 | { |
| 812 | 745 | SET_LOW_SR(val); // only a RET instruction can change the full content of SR |
| 813 | | |
| 814 | 746 | SR &= ~0x40; //reserved bit 6 always zero |
| 747 | if (hyperstone.intblock < 1) |
| 748 | hyperstone.intblock = 1; |
| 815 | 749 | } |
| 816 | 750 | else |
| 817 | 751 | { |
| 752 | UINT32 oldval = hyperstone.global_regs[code]; |
| 818 | 753 | if( code != ISR_REGISTER ) |
| 819 | 754 | hyperstone.global_regs[code] = val; |
| 820 | 755 | else |
| 821 | | logerror("Written to ISR register. PC = %08X\n", PC); |
| 756 | DEBUG_PRINTF(("Written to ISR register. PC = %08X\n", PC)); |
| 822 | 757 | |
| 823 | 758 | //are these set only when privilege bit is set? |
| 824 | 759 | if( code >= 16 ) |
| r1334 | r1335 | |
| 834 | 769 | break; |
| 835 | 770 | /* |
| 836 | 771 | case ISR_REGISTER: |
| 837 | | mame_printf_debug("written %08X to read-only ISR register\n",val); |
| 772 | DEBUG_PRINTF(("written %08X to read-only ISR register\n",val)); |
| 838 | 773 | break; |
| 839 | 774 | |
| 840 | | case 22: |
| 841 | | // mame_printf_debug("written %08X to TCR register\n",val); |
| 775 | case TCR_REGISTER: |
| 776 | // DEBUG_PRINTF(("written %08X to TCR register\n",val)); |
| 842 | 777 | break; |
| 843 | 778 | |
| 844 | 779 | case 23: |
| 845 | | // mame_printf_debug("written %08X to TR register\n",val); |
| 780 | // DEBUG_PRINTF(("written %08X to TR register\n",val)); |
| 846 | 781 | break; |
| 847 | 782 | |
| 848 | 783 | case 24: |
| 849 | | // mame_printf_debug("written %08X to WCR register\n",val); |
| 784 | // DEBUG_PRINTF(("written %08X to WCR register\n",val)); |
| 850 | 785 | break; |
| 851 | 786 | |
| 852 | 787 | case 16: |
| r1334 | r1335 | |
| 855 | 790 | case 29: |
| 856 | 791 | case 30: |
| 857 | 792 | case 31: |
| 858 | | mame_printf_debug("written %08X to _Reserved_ Global Register %d\n",val,code); |
| 793 | DEBUG_PRINTF(("written %08X to _Reserved_ Global Register %d\n",val,code)); |
| 859 | 794 | break; |
| 860 | 795 | |
| 861 | 796 | case BCR_REGISTER: |
| 862 | 797 | break; |
| 863 | 798 | */ |
| 799 | case TR_REGISTER: |
| 800 | hyperstone.tr_base_value = val; |
| 801 | hyperstone.tr_base_cycles = activecpu_gettotalcycles64(); |
| 802 | adjust_timer_interrupt(); |
| 803 | break; |
| 804 | |
| 864 | 805 | case TPR_REGISTER: |
| 806 | if (!(val & 0x80000000)) /* change immediately */ |
| 807 | update_timer_prescale(); |
| 808 | adjust_timer_interrupt(); |
| 809 | break; |
| 865 | 810 | |
| 866 | | hyperstone.n = (val & 0xff0000) >> 16; |
| 867 | | |
| 868 | | if(!(val & 0x80000000)) /* change immediately */ |
| 869 | | { |
| 870 | | hyperstone.delay_timer = 0; |
| 871 | | hyperstone.timer_clocks = hyperstone.n + 2; |
| 811 | case TCR_REGISTER: |
| 812 | if (oldval != val) |
| 813 | { |
| 814 | adjust_timer_interrupt(); |
| 815 | if (hyperstone.intblock < 1) |
| 816 | hyperstone.intblock = 1; |
| 872 | 817 | } |
| 873 | | else |
| 874 | | { |
| 875 | | hyperstone.delay_timer = 1; |
| 876 | | } |
| 818 | break; |
| 877 | 819 | |
| 878 | | break; |
| 879 | | /* |
| 880 | 820 | case FCR_REGISTER: |
| 881 | | switch((val & 0x3000)>>12) |
| 882 | | { |
| 883 | | case 0: |
| 884 | | mame_printf_debug("IO3 interrupt mode\n"); |
| 885 | | break; |
| 886 | | case 1: |
| 887 | | mame_printf_debug("IO3 timing mode\n"); |
| 888 | | break; |
| 889 | | case 2: |
| 890 | | mame_printf_debug("watchdog mode\n"); |
| 891 | | break; |
| 892 | | case 3: |
| 893 | | // IO3 standard mode |
| 894 | | break; |
| 895 | | } |
| 821 | if ((oldval ^ val) & 0x00800000) |
| 822 | adjust_timer_interrupt(); |
| 823 | if (hyperstone.intblock < 1) |
| 824 | hyperstone.intblock = 1; |
| 896 | 825 | break; |
| 897 | | */ |
| 826 | |
| 898 | 827 | case MCR_REGISTER: |
| 899 | 828 | // bits 14..12 EntryTableMap |
| 900 | 829 | hyperstone_set_trap_entry((val & 0x7000) >> 12); |
| 901 | | |
| 902 | 830 | break; |
| 903 | 831 | } |
| 904 | 832 | } |
| 905 | 833 | } |
| 906 | 834 | } |
| 907 | 835 | |
| 908 | | static void set_local_register(UINT8 code, UINT32 val) |
| 836 | INLINE void set_local_register(UINT8 code, UINT32 val) |
| 909 | 837 | { |
| 910 | 838 | UINT8 new_code = (code + GET_FP) % 64; |
| 911 | 839 | |
| r1334 | r1335 | |
| 928 | 856 | |
| 929 | 857 | #define LOCAL 1 |
| 930 | 858 | |
| 931 | | static void decode_source(int local, int hflag) |
| 859 | static const INT32 immediate_values[32] = |
| 932 | 860 | { |
| 933 | | if(local) |
| 934 | | { |
| 935 | | UINT8 code = current_regs.src; |
| 936 | | current_regs.set_src_register = set_local_register; |
| 937 | | code = (current_regs.src + GET_FP) % 64; // registers offset by frame pointer |
| 938 | | SREG = hyperstone.local_regs[code]; |
| 939 | | code = (current_regs.src + 1 + GET_FP) % 64; |
| 940 | | SREGF = hyperstone.local_regs[code]; |
| 941 | | } |
| 942 | | else |
| 943 | | { |
| 944 | | current_regs.set_src_register = set_global_register; |
| 861 | 0, 1, 2, 3, 4, 5, 6, 7, |
| 862 | 8, 9, 10, 11, 12, 13, 14, 15, |
| 863 | 16, 0, 0, 0, 32, 64, 128, 0x80000000, |
| 864 | -8, -7, -6, -5, -4, -3, -2, -1 |
| 865 | }; |
| 945 | 866 | |
| 946 | | if(hflag) |
| 947 | | current_regs.src += hflag * 16; |
| 867 | #define WRITE_ONLY_REGMASK ((1 << BCR_REGISTER) | (1 << TPR_REGISTER) | (1 << FCR_REGISTER) | (1 << MCR_REGISTER)) |
| 948 | 868 | |
| 949 | | SREG = hyperstone.global_regs[current_regs.src]; |
| 869 | #define decode_source(decode, local, hflag) \ |
| 870 | do \ |
| 871 | { \ |
| 872 | if(local) \ |
| 873 | { \ |
| 874 | UINT8 code = (decode)->src; \ |
| 875 | (decode)->src_is_local = 1; \ |
| 876 | code = ((decode)->src + GET_FP) % 64; /* registers offset by frame pointer */\ |
| 877 | SREG = hyperstone.local_regs[code]; \ |
| 878 | code = ((decode)->src + 1 + GET_FP) % 64; \ |
| 879 | SREGF = hyperstone.local_regs[code]; \ |
| 880 | } \ |
| 881 | else \ |
| 882 | { \ |
| 883 | (decode)->src_is_local = 0; \ |
| 884 | \ |
| 885 | if (!hflag) \ |
| 886 | { \ |
| 887 | SREG = get_global_register((decode)->src); \ |
| 888 | \ |
| 889 | /* bound safe */ \ |
| 890 | if ((decode)->src != 15) \ |
| 891 | SREGF = get_global_register((decode)->src + 1); \ |
| 892 | } \ |
| 893 | else \ |
| 894 | { \ |
| 895 | (decode)->src += 16; \ |
| 896 | \ |
| 897 | SREG = get_global_register((decode)->src); \ |
| 898 | if ((WRITE_ONLY_REGMASK >> (decode)->src) & 1) \ |
| 899 | SREG = 0; /* write-only registers */ \ |
| 900 | else if ((decode)->src == ISR_REGISTER) \ |
| 901 | DEBUG_PRINTF(("read src ISR. PC = %08X\n",PPC)); \ |
| 902 | \ |
| 903 | /* bound safe */ \ |
| 904 | if ((decode)->src != 31) \ |
| 905 | SREGF = get_global_register((decode)->src + 1); \ |
| 906 | } \ |
| 907 | } \ |
| 908 | } while (0) |
| 950 | 909 | |
| 951 | | /* bound safe */ |
| 952 | | if(current_regs.src != 15 && current_regs.src != 31) |
| 953 | | SREGF = hyperstone.global_regs[current_regs.src + 1]; |
| 910 | #define decode_dest(decode, local, hflag) \ |
| 911 | do \ |
| 912 | { \ |
| 913 | if(local) \ |
| 914 | { \ |
| 915 | UINT8 code = (decode)->dst; \ |
| 916 | (decode)->dst_is_local = 1; \ |
| 917 | code = ((decode)->dst + GET_FP) % 64; /* registers offset by frame pointer */\ |
| 918 | DREG = hyperstone.local_regs[code]; \ |
| 919 | code = ((decode)->dst + 1 + GET_FP) % 64; \ |
| 920 | DREGF = hyperstone.local_regs[code]; \ |
| 921 | } \ |
| 922 | else \ |
| 923 | { \ |
| 924 | (decode)->dst_is_local = 0; \ |
| 925 | \ |
| 926 | if (!hflag) \ |
| 927 | { \ |
| 928 | DREG = get_global_register((decode)->dst); \ |
| 929 | \ |
| 930 | /* bound safe */ \ |
| 931 | if ((decode)->dst != 15) \ |
| 932 | DREGF = get_global_register((decode)->dst + 1); \ |
| 933 | } \ |
| 934 | else \ |
| 935 | { \ |
| 936 | (decode)->dst += 16; \ |
| 937 | \ |
| 938 | DREG = get_global_register((decode)->dst); \ |
| 939 | if( (decode)->dst == ISR_REGISTER ) \ |
| 940 | DEBUG_PRINTF(("read dst ISR. PC = %08X\n",PPC)); \ |
| 941 | \ |
| 942 | /* bound safe */ \ |
| 943 | if ((decode)->dst != 31) \ |
| 944 | DREGF = get_global_register((decode)->dst + 1); \ |
| 945 | } \ |
| 946 | } \ |
| 947 | } while (0) |
| 954 | 948 | |
| 955 | | if(current_regs.src == PC_REGISTER) |
| 956 | | SRC_IS_PC = 1; |
| 957 | | else if(current_regs.src == SR_REGISTER) |
| 958 | | SRC_IS_SR = 1; |
| 959 | | else if( current_regs.src == BCR_REGISTER || current_regs.src == TPR_REGISTER || |
| 960 | | current_regs.src == FCR_REGISTER || current_regs.src == MCR_REGISTER ) |
| 961 | | { |
| 962 | | SREG = 0; // write-only registers |
| 963 | | } |
| 964 | | else if( current_regs.src == ISR_REGISTER ) |
| 965 | | mame_printf_debug("read src ISR. PC = %08X\n",PPC); |
| 966 | | } |
| 967 | | } |
| 949 | #define decode_RR(decode, dlocal, slocal) \ |
| 950 | do \ |
| 951 | { \ |
| 952 | (decode)->src = SRC_CODE; \ |
| 953 | (decode)->dst = DST_CODE; \ |
| 954 | decode_source(decode, slocal, 0); \ |
| 955 | decode_dest(decode, dlocal, 0); \ |
| 956 | \ |
| 957 | if( (slocal) == (dlocal) && SRC_CODE == DST_CODE ) \ |
| 958 | SAME_SRC_DST = 1; \ |
| 959 | \ |
| 960 | if( (slocal) == LOCAL && (dlocal) == LOCAL ) \ |
| 961 | { \ |
| 962 | if( SRC_CODE == ((DST_CODE + 1) % 64) ) \ |
| 963 | SAME_SRC_DSTF = 1; \ |
| 964 | \ |
| 965 | if( ((SRC_CODE + 1) % 64) == DST_CODE ) \ |
| 966 | SAME_SRCF_DST = 1; \ |
| 967 | } \ |
| 968 | else if( (slocal) == 0 && (dlocal) == 0 ) \ |
| 969 | { \ |
| 970 | if( SRC_CODE == (DST_CODE + 1) ) \ |
| 971 | SAME_SRC_DSTF = 1; \ |
| 972 | \ |
| 973 | if( (SRC_CODE + 1) == DST_CODE ) \ |
| 974 | SAME_SRCF_DST = 1; \ |
| 975 | } \ |
| 976 | } while (0) |
| 968 | 977 | |
| 969 | | static void decode_dest(int local, int hflag) |
| 970 | | { |
| 971 | | if(local) |
| 972 | | { |
| 973 | | UINT8 code = current_regs.dst; |
| 974 | | current_regs.set_dst_register = set_local_register; |
| 975 | | code = (current_regs.dst + GET_FP) % 64; // registers offset by frame pointer |
| 976 | | DREG = hyperstone.local_regs[code]; |
| 977 | | code = (current_regs.dst + 1 + GET_FP) % 64; |
| 978 | | DREGF = hyperstone.local_regs[code]; |
| 979 | | } |
| 980 | | else |
| 981 | | { |
| 982 | | current_regs.set_dst_register = set_global_register; |
| 978 | #define decode_LL(decode) \ |
| 979 | do \ |
| 980 | { \ |
| 981 | (decode)->src = SRC_CODE; \ |
| 982 | (decode)->dst = DST_CODE; \ |
| 983 | decode_source(decode, LOCAL, 0); \ |
| 984 | decode_dest(decode, LOCAL, 0); \ |
| 985 | \ |
| 986 | if( SRC_CODE == DST_CODE ) \ |
| 987 | SAME_SRC_DST = 1; \ |
| 988 | \ |
| 989 | if( SRC_CODE == ((DST_CODE + 1) % 64) ) \ |
| 990 | SAME_SRC_DSTF = 1; \ |
| 991 | } while (0) |
| 983 | 992 | |
| 984 | | if(hflag) |
| 985 | | current_regs.dst += hflag * 16; |
| 993 | #define decode_LR(decode, slocal) \ |
| 994 | do \ |
| 995 | { \ |
| 996 | (decode)->src = SRC_CODE; \ |
| 997 | (decode)->dst = DST_CODE; \ |
| 998 | decode_source(decode, slocal, 0); \ |
| 999 | decode_dest(decode, LOCAL, 0); \ |
| 1000 | \ |
| 1001 | if( ((SRC_CODE + 1) % 64) == DST_CODE && slocal == LOCAL ) \ |
| 1002 | SAME_SRCF_DST = 1; \ |
| 1003 | } while (0) |
| 986 | 1004 | |
| 987 | | DREG = hyperstone.global_regs[current_regs.dst]; |
| 1005 | #define check_delay_PC() \ |
| 1006 | do \ |
| 1007 | { \ |
| 1008 | /* if PC is used in a delay instruction, the delayed PC should be used */ \ |
| 1009 | if( hyperstone.delay.delay_cmd == DELAY_EXECUTE ) \ |
| 1010 | { \ |
| 1011 | PC = hyperstone.delay.delay_pc; \ |
| 1012 | hyperstone.delay.delay_cmd = NO_DELAY; \ |
| 1013 | } \ |
| 1014 | } while (0) |
| 988 | 1015 | |
| 989 | | /* bound safe */ |
| 990 | | if(current_regs.dst != 15 && current_regs.dst != 31) |
| 991 | | DREGF = hyperstone.global_regs[current_regs.dst + 1]; |
| 1016 | #define decode_immediate(decode, nbit) \ |
| 1017 | do \ |
| 1018 | { \ |
| 1019 | if (!nbit) \ |
| 1020 | EXTRA_U = immediate_values[OP & 0x0f]; \ |
| 1021 | else \ |
| 1022 | switch( OP & 0x0f ) \ |
| 1023 | { \ |
| 1024 | default: \ |
| 1025 | EXTRA_U = immediate_values[0x10 + (OP & 0x0f)]; \ |
| 1026 | break; \ |
| 1027 | \ |
| 1028 | case 1: \ |
| 1029 | hyperstone.instruction_length = 3; \ |
| 1030 | EXTRA_U = (READ_OP(PC) << 16) | READ_OP(PC + 2); \ |
| 1031 | PC += 4; \ |
| 1032 | break; \ |
| 1033 | \ |
| 1034 | case 2: \ |
| 1035 | hyperstone.instruction_length = 2; \ |
| 1036 | EXTRA_U = READ_OP(PC); \ |
| 1037 | PC += 2; \ |
| 1038 | break; \ |
| 1039 | \ |
| 1040 | case 3: \ |
| 1041 | hyperstone.instruction_length = 2; \ |
| 1042 | EXTRA_U = 0xffff0000 | READ_OP(PC); \ |
| 1043 | PC += 2; \ |
| 1044 | break; \ |
| 1045 | } \ |
| 1046 | } while (0) |
| 992 | 1047 | |
| 993 | | if(current_regs.dst == PC_REGISTER) |
| 994 | | DST_IS_PC = 1; |
| 995 | | else if(current_regs.dst == SR_REGISTER) |
| 996 | | DST_IS_SR = 1; |
| 997 | | else if( current_regs.src == ISR_REGISTER ) |
| 998 | | mame_printf_debug("read dst ISR. PC = %08X\n",PPC); |
| 999 | | } |
| 1000 | | } |
| 1048 | #define decode_const(decode) \ |
| 1049 | do \ |
| 1050 | { \ |
| 1051 | UINT16 imm_1 = READ_OP(PC); \ |
| 1052 | \ |
| 1053 | PC += 2; \ |
| 1054 | hyperstone.instruction_length = 2; \ |
| 1055 | \ |
| 1056 | if( E_BIT(imm_1) ) \ |
| 1057 | { \ |
| 1058 | UINT16 imm_2 = READ_OP(PC); \ |
| 1059 | \ |
| 1060 | PC += 2; \ |
| 1061 | hyperstone.instruction_length = 3; \ |
| 1062 | \ |
| 1063 | EXTRA_S = imm_2; \ |
| 1064 | EXTRA_S |= ((imm_1 & 0x3fff) << 16); \ |
| 1065 | \ |
| 1066 | if( S_BIT_CONST(imm_1) ) \ |
| 1067 | { \ |
| 1068 | EXTRA_S |= 0xc0000000; \ |
| 1069 | } \ |
| 1070 | } \ |
| 1071 | else \ |
| 1072 | { \ |
| 1073 | EXTRA_S = imm_1 & 0x3fff; \ |
| 1074 | \ |
| 1075 | if( S_BIT_CONST(imm_1) ) \ |
| 1076 | { \ |
| 1077 | EXTRA_S |= 0xffffc000; \ |
| 1078 | } \ |
| 1079 | } \ |
| 1080 | } while (0) |
| 1001 | 1081 | |
| 1002 | | INLINE void decode_RR(void) |
| 1003 | | { |
| 1004 | | current_regs.src = SRC_CODE; |
| 1005 | | current_regs.dst = DST_CODE; |
| 1006 | | decode_source(S_BIT, 0); |
| 1007 | | decode_dest(D_BIT, 0); |
| 1082 | #define decode_pcrel(decode) \ |
| 1083 | do \ |
| 1084 | { \ |
| 1085 | if( OP & 0x80 ) \ |
| 1086 | { \ |
| 1087 | UINT16 next = READ_OP(PC); \ |
| 1088 | \ |
| 1089 | PC += 2; \ |
| 1090 | hyperstone.instruction_length = 2; \ |
| 1091 | \ |
| 1092 | EXTRA_S = (OP & 0x7f) << 16; \ |
| 1093 | EXTRA_S |= (next & 0xfffe); \ |
| 1094 | \ |
| 1095 | if( next & 1 ) \ |
| 1096 | EXTRA_S |= 0xff800000; \ |
| 1097 | } \ |
| 1098 | else \ |
| 1099 | { \ |
| 1100 | EXTRA_S = OP & 0x7e; \ |
| 1101 | \ |
| 1102 | if( OP & 1 ) \ |
| 1103 | EXTRA_S |= 0xffffff80; \ |
| 1104 | } \ |
| 1105 | } while (0) |
| 1008 | 1106 | |
| 1009 | | if( SRC_CODE == DST_CODE && S_BIT == D_BIT ) |
| 1010 | | SAME_SRC_DST = 1; |
| 1107 | #define decode_dis(decode) \ |
| 1108 | do \ |
| 1109 | { \ |
| 1110 | UINT16 next_1 = READ_OP(PC); \ |
| 1111 | \ |
| 1112 | PC += 2; \ |
| 1113 | hyperstone.instruction_length = 2; \ |
| 1114 | \ |
| 1115 | (decode)->sub_type = DD(next_1); \ |
| 1116 | \ |
| 1117 | if( E_BIT(next_1) ) \ |
| 1118 | { \ |
| 1119 | UINT16 next_2 = READ_OP(PC); \ |
| 1120 | \ |
| 1121 | PC += 2; \ |
| 1122 | hyperstone.instruction_length = 3; \ |
| 1123 | \ |
| 1124 | EXTRA_S = next_2; \ |
| 1125 | EXTRA_S |= ((next_1 & 0xfff) << 16); \ |
| 1126 | \ |
| 1127 | if( S_BIT_CONST(next_1) ) \ |
| 1128 | { \ |
| 1129 | EXTRA_S |= 0xf0000000; \ |
| 1130 | } \ |
| 1131 | } \ |
| 1132 | else \ |
| 1133 | { \ |
| 1134 | EXTRA_S = next_1 & 0xfff; \ |
| 1135 | \ |
| 1136 | if( S_BIT_CONST(next_1) ) \ |
| 1137 | { \ |
| 1138 | EXTRA_S |= 0xfffff000; \ |
| 1139 | } \ |
| 1140 | } \ |
| 1141 | } while (0) |
| 1011 | 1142 | |
| 1012 | | if( S_BIT == LOCAL && D_BIT == LOCAL ) |
| 1013 | | { |
| 1014 | | if( SRC_CODE == ((DST_CODE + 1) % 64) ) |
| 1015 | | SAME_SRC_DSTF = 1; |
| 1143 | #define decode_lim(decode) \ |
| 1144 | do \ |
| 1145 | { \ |
| 1146 | UINT32 next = READ_OP(PC); \ |
| 1147 | PC += 2; \ |
| 1148 | hyperstone.instruction_length = 2; \ |
| 1149 | \ |
| 1150 | (decode)->sub_type = X_CODE(next); \ |
| 1151 | \ |
| 1152 | if( E_BIT(next) ) \ |
| 1153 | { \ |
| 1154 | EXTRA_U = ((next & 0xfff) << 16) | READ_OP(PC); \ |
| 1155 | PC += 2; \ |
| 1156 | hyperstone.instruction_length = 3; \ |
| 1157 | } \ |
| 1158 | else \ |
| 1159 | { \ |
| 1160 | EXTRA_U = next & 0xfff; \ |
| 1161 | } \ |
| 1162 | } while (0) |
| 1016 | 1163 | |
| 1017 | | if( ((SRC_CODE + 1) % 64) == DST_CODE ) |
| 1018 | | SAME_SRCF_DST = 1; |
| 1019 | | } |
| 1020 | | else if( S_BIT == 0 && D_BIT == 0 ) |
| 1021 | | { |
| 1022 | | if( SRC_CODE == (DST_CODE + 1) ) |
| 1023 | | SAME_SRC_DSTF = 1; |
| 1164 | #define RRdecode(decode, dlocal, slocal) \ |
| 1165 | do \ |
| 1166 | { \ |
| 1167 | check_delay_PC(); \ |
| 1168 | decode_RR(decode, dlocal, slocal); \ |
| 1169 | } while (0) |
| 1024 | 1170 | |
| 1025 | | if( (SRC_CODE + 1) == DST_CODE ) |
| 1026 | | SAME_SRCF_DST = 1; |
| 1027 | | } |
| 1028 | | } |
| 1171 | #define RRlimdecode(decode, dlocal, slocal) \ |
| 1172 | do \ |
| 1173 | { \ |
| 1174 | decode_lim(decode); \ |
| 1175 | check_delay_PC(); \ |
| 1176 | decode_RR(decode, dlocal, slocal); \ |
| 1177 | } while (0) |
| 1029 | 1178 | |
| 1030 | | INLINE void decode_LL(void) |
| 1031 | | { |
| 1032 | | current_regs.src = SRC_CODE; |
| 1033 | | current_regs.dst = DST_CODE; |
| 1034 | | decode_source(LOCAL, 0); |
| 1035 | | decode_dest(LOCAL, 0); |
| 1179 | #define RRconstdecode(decode, dlocal, slocal) \ |
| 1180 | do \ |
| 1181 | { \ |
| 1182 | decode_const(decode); \ |
| 1183 | check_delay_PC(); \ |
| 1184 | decode_RR(decode, dlocal, slocal); \ |
| 1185 | } while (0) |
| 1036 | 1186 | |
| 1037 | | if( SRC_CODE == DST_CODE ) |
| 1038 | | SAME_SRC_DST = 1; |
| 1187 | #define RRdisdecode(decode, dlocal, slocal) \ |
| 1188 | do \ |
| 1189 | { \ |
| 1190 | decode_dis(decode); \ |
| 1191 | check_delay_PC(); \ |
| 1192 | decode_RR(decode, dlocal, slocal); \ |
| 1193 | } while (0) |
| 1039 | 1194 | |
| 1040 | | if( SRC_CODE == ((DST_CODE + 1) % 64) ) |
| 1041 | | SAME_SRC_DSTF = 1; |
| 1042 | | } |
| 1195 | #define RRdecodewithHflag(decode, dlocal, slocal) \ |
| 1196 | do \ |
| 1197 | { \ |
| 1198 | check_delay_PC(); \ |
| 1199 | (decode)->src = SRC_CODE; \ |
| 1200 | (decode)->dst = DST_CODE; \ |
| 1201 | decode_source(decode, slocal, GET_H); \ |
| 1202 | decode_dest(decode, dlocal, GET_H); \ |
| 1203 | \ |
| 1204 | if(GET_H) \ |
| 1205 | if(slocal == 0 && dlocal == 0) \ |
| 1206 | DEBUG_PRINTF(("MOV with hflag and 2 GRegs! PC = %08X\n",PPC)); \ |
| 1207 | } while (0) |
| 1043 | 1208 | |
| 1044 | | INLINE void decode_LR(void) |
| 1045 | | { |
| 1046 | | current_regs.src = SRC_CODE; |
| 1047 | | current_regs.dst = DST_CODE; |
| 1048 | | decode_source(S_BIT, 0); |
| 1049 | | decode_dest(LOCAL, 0); |
| 1209 | #define Rimmdecode(decode, dlocal, nbit) \ |
| 1210 | do \ |
| 1211 | { \ |
| 1212 | decode_immediate(decode, nbit); \ |
| 1213 | check_delay_PC(); \ |
| 1214 | (decode)->dst = DST_CODE; \ |
| 1215 | decode_dest(decode, dlocal, 0); \ |
| 1216 | } while (0) |
| 1050 | 1217 | |
| 1051 | | if( ((SRC_CODE + 1) % 64) == DST_CODE && S_BIT == LOCAL ) |
| 1052 | | SAME_SRCF_DST = 1; |
| 1053 | | } |
| 1218 | #define Rndecode(decode, dlocal) \ |
| 1219 | do \ |
| 1220 | { \ |
| 1221 | check_delay_PC(); \ |
| 1222 | (decode)->dst = DST_CODE; \ |
| 1223 | decode_dest(decode, dlocal, 0); \ |
| 1224 | } while (0) |
| 1054 | 1225 | |
| 1055 | | INLINE void check_delay_PC(void) |
| 1056 | | { |
| 1057 | | // if PC is used in a delay instruction, the delayed PC should be used |
| 1058 | | if( hyperstone.delay.delay_cmd == DELAY_EXECUTE ) |
| 1059 | | { |
| 1060 | | PC = hyperstone.delay.delay_pc; |
| 1061 | | hyperstone.delay.delay_cmd = NO_DELAY; |
| 1062 | | } |
| 1063 | | } |
| 1226 | #define RimmdecodewithHflag(decode, dlocal, nbit) \ |
| 1227 | do \ |
| 1228 | { \ |
| 1229 | decode_immediate(decode, nbit); \ |
| 1230 | check_delay_PC(); \ |
| 1231 | (decode)->dst = DST_CODE; \ |
| 1232 | decode_dest(decode, dlocal, GET_H); \ |
| 1233 | } while (0) |
| 1064 | 1234 | |
| 1065 | | INLINE void decode_immediate(void) |
| 1066 | | { |
| 1067 | | switch( N_VALUE ) |
| 1068 | | { |
| 1069 | | case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: |
| 1070 | | case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: |
| 1071 | | EXTRA_U = N_VALUE; |
| 1072 | | break; |
| 1235 | #define Lndecode(decode) \ |
| 1236 | do \ |
| 1237 | { \ |
| 1238 | check_delay_PC(); \ |
| 1239 | (decode)->dst = DST_CODE; \ |
| 1240 | decode_dest(decode, LOCAL, 0); \ |
| 1241 | } while (0) |
| 1073 | 1242 | |
| 1074 | | case 17: |
| 1075 | | hyperstone.instruction_length = 3; |
| 1076 | | EXTRA_U = (READ_OP(PC) << 16) | READ_OP(PC + 2); |
| 1077 | | PC += 4; |
| 1078 | | break; |
| 1243 | #define LLdecode(decode) \ |
| 1244 | do \ |
| 1245 | { \ |
| 1246 | check_delay_PC(); \ |
| 1247 | decode_LL(decode); \ |
| 1248 | } while (0) |
| 1079 | 1249 | |
| 1080 | | case 18: |
| 1081 | | hyperstone.instruction_length = 2; |
| 1082 | | EXTRA_U = READ_OP(PC); |
| 1083 | | PC += 2; |
| 1084 | | break; |
| 1250 | #define LLextdecode(decode) \ |
| 1251 | do \ |
| 1252 | { \ |
| 1253 | hyperstone.instruction_length = 2; \ |
| 1254 | EXTRA_U = READ_OP(PC); \ |
| 1255 | PC += 2; \ |
| 1256 | check_delay_PC(); \ |
| 1257 | decode_LL(decode); \ |
| 1258 | } while (0) |
| 1085 | 1259 | |
| 1086 | | case 19: |
| 1087 | | hyperstone.instruction_length = 2; |
| 1088 | | EXTRA_U = 0xffff0000 | READ_OP(PC); |
| 1089 | | PC += 2; |
| 1090 | | break; |
| 1260 | #define LRdecode(decode, slocal) \ |
| 1261 | do \ |
| 1262 | { \ |
| 1263 | check_delay_PC(); \ |
| 1264 | decode_LR(decode, slocal); \ |
| 1265 | } while (0) |
| 1091 | 1266 | |
| 1092 | | case 20: |
| 1093 | | EXTRA_U = 32; // bit 5 = 1, others = 0 |
| 1094 | | break; |
| 1267 | #define LRconstdecode(decode, slocal) \ |
| 1268 | do \ |
| 1269 | { \ |
| 1270 | decode_const(decode); \ |
| 1271 | check_delay_PC(); \ |
| 1272 | decode_LR(decode, slocal); \ |
| 1273 | } while (0) |
| 1095 | 1274 | |
| 1096 | | case 21: |
| 1097 | | EXTRA_U = 64; // bit 6 = 1, others = 0 |
| 1098 | | break; |
| 1275 | #define PCreldecode(decode) \ |
| 1276 | do \ |
| 1277 | { \ |
| 1278 | decode_pcrel(decode); \ |
| 1279 | check_delay_PC(); \ |
| 1280 | } while (0) |
| 1099 | 1281 | |
| 1100 | | case 22: |
| 1101 | | EXTRA_U = 128; // bit 7 = 1, others = 0 |
| 1102 | | break; |
| 1282 | #define PCadrdecode(decode) \ |
| 1283 | do \ |
| 1284 | { \ |
| 1285 | check_delay_PC(); \ |
| 1286 | } while (0) |
| 1103 | 1287 | |
| 1104 | | case 23: |
| 1105 | | EXTRA_U = 0x80000000; // bit 31 = 1, others = 0 (2 at the power of 31) |
| 1106 | | break; |
| 1288 | #define no_decode(decode) \ |
| 1289 | do \ |
| 1290 | { \ |
| 1291 | } while (0) |
| 1107 | 1292 | |
| 1108 | | case 24: |
| 1109 | | EXTRA_U = -8; |
| 1110 | | break; |
| 1111 | 1293 | |
| 1112 | | case 25: |
| 1113 | | EXTRA_U = -7; |
| 1114 | | break; |
| 1115 | | |
| 1116 | | case 26: |
| 1117 | | EXTRA_U = -6; |
| 1118 | | break; |
| 1119 | | |
| 1120 | | case 27: |
| 1121 | | EXTRA_U = -5; |
| 1122 | | break; |
| 1123 | | |
| 1124 | | case 28: |
| 1125 | | EXTRA_U = -4; |
| 1126 | | break; |
| 1127 | | |
| 1128 | | case 29: |
| 1129 | | EXTRA_U = -3; |
| 1130 | | break; |
| 1131 | | |
| 1132 | | case 30: |
| 1133 | | EXTRA_U = -2; |
| 1134 | | break; |
| 1135 | | |
| 1136 | | case 31: |
| 1137 | | EXTRA_U = -1; |
| 1138 | | break; |
| 1139 | | } |
| 1140 | | } |
| 1141 | | |
| 1142 | | INLINE void decode_const(void) |
| 1294 | INLINE void execute_br(struct regs_decode *decode) |
| 1143 | 1295 | { |
| 1144 | | UINT16 imm_1 = READ_OP(PC); |
| 1145 | | |
| 1146 | | PC += 2; |
| 1147 | | hyperstone.instruction_length = 2; |
| 1148 | | |
| 1149 | | if( E_BIT(imm_1) ) |
| 1150 | | { |
| 1151 | | UINT16 imm_2 = READ_OP(PC); |
| 1152 | | |
| 1153 | | PC += 2; |
| 1154 | | hyperstone.instruction_length = 3; |
| 1155 | | |
| 1156 | | EXTRA_S = imm_2; |
| 1157 | | EXTRA_S |= ((imm_1 & 0x3fff) << 16); |
| 1158 | | |
| 1159 | | if( S_BIT_CONST(imm_1) ) |
| 1160 | | { |
| 1161 | | EXTRA_S |= 0xc0000000; |
| 1162 | | } |
| 1163 | | } |
| 1164 | | else |
| 1165 | | { |
| 1166 | | EXTRA_S = imm_1 & 0x3fff; |
| 1167 | | |
| 1168 | | if( S_BIT_CONST(imm_1) ) |
| 1169 | | { |
| 1170 | | EXTRA_S |= 0xffffc000; |
| 1171 | | } |
| 1172 | | } |
| 1173 | | } |
| 1174 | | |
| 1175 | | INLINE void decode_pcrel(void) |
| 1176 | | { |
| 1177 | | if( OP & 0x80 ) |
| 1178 | | { |
| 1179 | | UINT16 next = READ_OP(PC); |
| 1180 | | |
| 1181 | | PC += 2; |
| 1182 | | hyperstone.instruction_length = 2; |
| 1183 | | |
| 1184 | | EXTRA_S = (OP & 0x7f) << 16; |
| 1185 | | EXTRA_S |= (next & 0xfffe); |
| 1186 | | |
| 1187 | | if( next & 1 ) |
| 1188 | | EXTRA_S |= 0xff800000; |
| 1189 | | } |
| 1190 | | else |
| 1191 | | { |
| 1192 | | EXTRA_S = OP & 0x7e; |
| 1193 | | |
| 1194 | | if( OP & 1 ) |
| 1195 | | EXTRA_S |= 0xffffff80; |
| 1196 | | } |
| 1197 | | } |
| 1198 | | |
| 1199 | | INLINE void decode_dis(void) |
| 1200 | | { |
| 1201 | | UINT16 next_1 = READ_OP(PC); |
| 1202 | | |
| 1203 | | PC += 2; |
| 1204 | | hyperstone.instruction_length = 2; |
| 1205 | | |
| 1206 | | current_regs.sub_type = DD(next_1); |
| 1207 | | |
| 1208 | | if( E_BIT(next_1) ) |
| 1209 | | { |
| 1210 | | UINT16 next_2 = READ_OP(PC); |
| 1211 | | |
| 1212 | | PC += 2; |
| 1213 | | hyperstone.instruction_length = 3; |
| 1214 | | |
| 1215 | | EXTRA_S = next_2; |
| 1216 | | EXTRA_S |= ((next_1 & 0xfff) << 16); |
| 1217 | | |
| 1218 | | if( S_BIT_CONST(next_1) ) |
| 1219 | | { |
| 1220 | | EXTRA_S |= 0xf0000000; |
| 1221 | | } |
| 1222 | | } |
| 1223 | | else |
| 1224 | | { |
| 1225 | | EXTRA_S = next_1 & 0xfff; |
| 1226 | | |
| 1227 | | if( S_BIT_CONST(next_1) ) |
| 1228 | | { |
| 1229 | | EXTRA_S |= 0xfffff000; |
| 1230 | | } |
| 1231 | | } |
| 1232 | | } |
| 1233 | | |
| 1234 | | INLINE void decode_lim(void) |
| 1235 | | { |
| 1236 | | UINT32 next = READ_OP(PC); |
| 1237 | | PC += 2; |
| 1238 | | hyperstone.instruction_length = 2; |
| 1239 | | |
| 1240 | | current_regs.sub_type = X_CODE(next); |
| 1241 | | |
| 1242 | | if( E_BIT(next) ) |
| 1243 | | { |
| 1244 | | EXTRA_U = ((next & 0xfff) << 16) | READ_OP(PC); |
| 1245 | | PC += 2; |
| 1246 | | hyperstone.instruction_length = 3; |
| 1247 | | } |
| 1248 | | else |
| 1249 | | { |
| 1250 | | EXTRA_U = next & 0xfff; |
| 1251 | | } |
| 1252 | | } |
| 1253 | | |
| 1254 | | /* used in the jumptable */ |
| 1255 | | INLINE void RRdecode(void) |
| 1256 | | { |
| 1257 | | check_delay_PC(); |
| 1258 | | decode_RR(); |
| 1259 | | } |
| 1260 | | |
| 1261 | | INLINE void RRlimdecode(void) |
| 1262 | | { |
| 1263 | | decode_lim(); |
| 1264 | | check_delay_PC(); |
| 1265 | | decode_RR(); |
| 1266 | | } |
| 1267 | | |
| 1268 | | INLINE void RRconstdecode(void) |
| 1269 | | { |
| 1270 | | decode_const(); |
| 1271 | | check_delay_PC(); |
| 1272 | | decode_RR(); |
| 1273 | | } |
| 1274 | | |
| 1275 | | INLINE void RRdisdecode(void) |
| 1276 | | { |
| 1277 | | decode_dis(); |
| 1278 | | check_delay_PC(); |
| 1279 | | decode_RR(); |
| 1280 | | } |
| 1281 | | |
| 1282 | | INLINE void RRdecodewithHflag(void) |
| 1283 | | { |
| 1284 | | check_delay_PC(); |
| 1285 | | current_regs.src = SRC_CODE; |
| 1286 | | current_regs.dst = DST_CODE; |
| 1287 | | decode_source(S_BIT, GET_H); |
| 1288 | | decode_dest(D_BIT, GET_H); |
| 1289 | | |
| 1290 | | if(GET_H) |
| 1291 | | if(S_BIT == 0 && D_BIT == 0) |
| 1292 | | popmessage("MOV with hflag and 2 GRegs! PC = %08X\n",PPC); |
| 1293 | | } |
| 1294 | | |
| 1295 | | INLINE void Rimmdecode(void) |
| 1296 | | { |
| 1297 | | decode_immediate(); |
| 1298 | | check_delay_PC(); |
| 1299 | | current_regs.dst = DST_CODE; |
| 1300 | | decode_dest(D_BIT, 0); |
| 1301 | | } |
| 1302 | | |
| 1303 | | INLINE void Rndecode(void) |
| 1304 | | { |
| 1305 | | check_delay_PC(); |
| 1306 | | current_regs.dst = DST_CODE; |
| 1307 | | decode_dest(D_BIT, 0); |
| 1308 | | } |
| 1309 | | |
| 1310 | | INLINE void RimmdecodewithHflag(void) |
| 1311 | | { |
| 1312 | | decode_immediate(); |
| 1313 | | check_delay_PC(); |
| 1314 | | current_regs.dst = DST_CODE; |
| 1315 | | decode_dest(D_BIT, GET_H); |
| 1316 | | } |
| 1317 | | |
| 1318 | | INLINE void Lndecode(void) |
| 1319 | | { |
| 1320 | | check_delay_PC(); |
| 1321 | | current_regs.dst = DST_CODE; |
| 1322 | | decode_dest(LOCAL, 0); |
| 1323 | | } |
| 1324 | | |
| 1325 | | INLINE void LLdecode(void) |
| 1326 | | { |
| 1327 | | check_delay_PC(); |
| 1328 | | decode_LL(); |
| 1329 | | } |
| 1330 | | |
| 1331 | | INLINE void LLextdecode(void) |
| 1332 | | { |
| 1333 | | hyperstone.instruction_length = 2; |
| 1334 | | EXTRA_U = READ_OP(PC); |
| 1335 | | PC += 2; |
| 1336 | | check_delay_PC(); |
| 1337 | | decode_LL(); |
| 1338 | | } |
| 1339 | | |
| 1340 | | INLINE void LRdecode(void) |
| 1341 | | { |
| 1342 | | check_delay_PC(); |
| 1343 | | decode_LR(); |
| 1344 | | } |
| 1345 | | |
| 1346 | | INLINE void LRconstdecode(void) |
| 1347 | | { |
| 1348 | | decode_const(); |
| 1349 | | check_delay_PC(); |
| 1350 | | decode_LR(); |
| 1351 | | } |
| 1352 | | |
| 1353 | | INLINE void PCreldecode(void) |
| 1354 | | { |
| 1355 | | decode_pcrel(); |
| 1356 | | check_delay_PC(); |
| 1357 | | } |
| 1358 | | |
| 1359 | | INLINE void PCadrdecode(void) |
| 1360 | | { |
| 1361 | | check_delay_PC(); |
| 1362 | | } |
| 1363 | | |
| 1364 | | INLINE void no_decode(void) |
| 1365 | | { |
| 1366 | | |
| 1367 | | } |
| 1368 | | |
| 1369 | | |
| 1370 | | /* Decode helper table */ |
| 1371 | | static void (*hyperstone_decode[0x100])(void) = { |
| 1372 | | /*00*/ RRdecode, RRdecode, RRdecode, RRdecode, /* CHK - CHKZ - NOP */ |
| 1373 | | /*04*/ RRdecode, RRdecode, RRdecode, RRdecode, /* MOVD - RET */ |
| 1374 | | /*08*/ RRdecode, RRdecode, RRdecode, RRdecode, /* DIVU */ |
| 1375 | | /*0c*/ RRdecode, RRdecode, RRdecode, RRdecode, /* DIVS */ |
| 1376 | | /*10*/ RRlimdecode, RRlimdecode, RRlimdecode, RRlimdecode, /* XMx - XXx */ |
| 1377 | | /*14*/ RRconstdecode, RRconstdecode, RRconstdecode, RRconstdecode, /* MASK */ |
| 1378 | | /*18*/ RRconstdecode, RRconstdecode, RRconstdecode, RRconstdecode, /* SUM */ |
| 1379 | | /*1c*/ RRconstdecode, RRconstdecode, RRconstdecode, RRconstdecode, /* SUMS */ |
| 1380 | | /*20*/ RRdecode, RRdecode, RRdecode, RRdecode, /* CMP */ |
| 1381 | | /*24*/ RRdecodewithHflag, RRdecodewithHflag, RRdecodewithHflag, RRdecodewithHflag, /* MOV */ |
| 1382 | | /*28*/ RRdecode, RRdecode, RRdecode, RRdecode, /* ADD */ |
| 1383 | | /*2c*/ RRdecode, RRdecode, RRdecode, RRdecode, /* ADDS */ |
| 1384 | | /*30*/ RRdecode, RRdecode, RRdecode, RRdecode, /* CMPB */ |
| 1385 | | /*34*/ RRdecode, RRdecode, RRdecode, RRdecode, /* ANDN */ |
| 1386 | | /*38*/ RRdecode, RRdecode, RRdecode, RRdecode, /* OR */ |
| 1387 | | /*3c*/ RRdecode, RRdecode, RRdecode, RRdecode, /* XOR */ |
| 1388 | | /*40*/ RRdecode, RRdecode, RRdecode, RRdecode, /* SUBC */ |
| 1389 | | /*44*/ RRdecode, RRdecode, RRdecode, RRdecode, /* NOT */ |
| 1390 | | /*48*/ RRdecode, RRdecode, RRdecode, RRdecode, /* SUB */ |
| 1391 | | /*4c*/ RRdecode, RRdecode, RRdecode, RRdecode, /* SUBS */ |
| 1392 | | /*50*/ RRdecode, RRdecode, RRdecode, RRdecode, /* ADDC */ |
| 1393 | | /*54*/ RRdecode, RRdecode, RRdecode, RRdecode, /* AND */ |
| 1394 | | /*58*/ RRdecode, RRdecode, RRdecode, RRdecode, /* NEG */ |
| 1395 | | /*5c*/ RRdecode, RRdecode, RRdecode, RRdecode, /* NEGS */ |
| 1396 | | /*60*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* CMPI */ |
| 1397 | | /*64*/ RimmdecodewithHflag, RimmdecodewithHflag, RimmdecodewithHflag, RimmdecodewithHflag, /* MOVI */ |
| 1398 | | /*68*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* ADDI */ |
| 1399 | | /*6c*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* ADDSI */ |
| 1400 | | /*70*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* CMPBI */ |
| 1401 | | /*74*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* ANDNI */ |
| 1402 | | /*78*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* ORI */ |
| 1403 | | /*7c*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* XORI */ |
| 1404 | | /*80*/ Lndecode, Lndecode, LLdecode, LLdecode, /* SHRDI, SHRD, SHR */ |
| 1405 | | /*84*/ Lndecode, Lndecode, LLdecode, LLdecode, /* SARDI, SARD, SAR */ |
| 1406 | | /*88*/ Lndecode, Lndecode, LLdecode, LLdecode, /* SHLDI, SHLD, SHL */ |
| 1407 | | /*8c*/ no_decode, no_decode, LLdecode, LLdecode, /* RESERVED, TESTLZ, ROL */ |
| 1408 | | /*90*/ RRdisdecode, RRdisdecode, RRdisdecode, RRdisdecode, /* LDxx.D/A/IOD/IOA */ |
| 1409 | | /*94*/ RRdisdecode, RRdisdecode, RRdisdecode, RRdisdecode, /* LDxx.N/S */ |
| 1410 | | /*98*/ RRdisdecode, RRdisdecode, RRdisdecode, RRdisdecode, /* STxx.D/A/IOD/IOA */ |
| 1411 | | /*9c*/ RRdisdecode, RRdisdecode, RRdisdecode, RRdisdecode, /* STxx.N/S */ |
| 1412 | | /*a0*/ Rndecode, Rndecode, Rndecode, Rndecode, /* SHRI */ |
| 1413 | | /*a4*/ Rndecode, Rndecode, Rndecode, Rndecode, /* SARI */ |
| 1414 | | /*a8*/ Rndecode, Rndecode, Rndecode, Rndecode, /* SHLI */ |
| 1415 | | /*ac*/ no_decode, no_decode, no_decode, no_decode, /* RESERVED */ |
| 1416 | | /*b0*/ RRdecode, RRdecode, RRdecode, RRdecode, /* MULU */ |
| 1417 | | /*b4*/ RRdecode, RRdecode, RRdecode, RRdecode, /* MULS */ |
| 1418 | | /*b8*/ Rndecode, Rndecode, Rndecode, Rndecode, /* SETxx - SETADR - FETCH */ |
| 1419 | | /*bc*/ RRdecode, RRdecode, RRdecode, RRdecode, /* MUL */ |
| 1420 | | /*c0*/ LLdecode, LLdecode, LLdecode, LLdecode, /* FADD, FADDD, FSUB, FSUBD */ |
| 1421 | | /*c4*/ LLdecode, LLdecode, LLdecode, LLdecode, /* FMUL, FMULD, FDIV, FDIVD */ |
| 1422 | | /*c8*/ LLdecode, LLdecode, LLdecode, LLdecode, /* FCMP, FCMPD, FCMPU, FCMPUD */ |
| 1423 | | /*cc*/ LLdecode, LLdecode, LLextdecode, LLdecode, /* FCVT, FCVTD, EXTEND, DO */ |
| 1424 | | /*d0*/ LRdecode, LRdecode, LRdecode, LRdecode, /* LDW.R, LDD.R */ |
| 1425 | | /*d4*/ LRdecode, LRdecode, LRdecode, LRdecode, /* LDW.P, LDD.P */ |
| 1426 | | /*d8*/ LRdecode, LRdecode, LRdecode, LRdecode, /* STW.R, STD.R */ |
| 1427 | | /*dc*/ LRdecode, LRdecode, LRdecode, LRdecode, /* STW.P, STD.P */ |
| 1428 | | /*e0*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* DBV, DBNV, DBE, DBNE */ |
| 1429 | | /*e4*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* DBC, DBNC, DBSE, DBHT */ |
| 1430 | | /*e8*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* DBN, DBNN, DBLE, DBGT */ |
| 1431 | | /*ec*/ PCreldecode, LLdecode, LRconstdecode, LRconstdecode, /* DBR, FRAME, CALL */ |
| 1432 | | /*f0*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* BV, BNV, BE, BNE */ |
| 1433 | | /*f4*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* BC, BNC, BSE, BHT */ |
| 1434 | | /*f8*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* BN, BNN, BLE, BGT */ |
| 1435 | | /*fc*/ PCreldecode, PCadrdecode, PCadrdecode, PCadrdecode /* BR, TRAPxx - TRAP */ |
| 1436 | | }; |
| 1437 | | |
| 1438 | | INLINE void execute_br(void) |
| 1439 | | { |
| 1440 | 1296 | PPC = PC; |
| 1441 | 1297 | PC += EXTRA_S; |
| 1442 | 1298 | change_pc(PC); |
| 1443 | 1299 | SET_M(0); |
| 1444 | 1300 | |
| 1445 | | hyperstone_ICount -= 2; |
| 1301 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 1446 | 1302 | } |
| 1447 | 1303 | |
| 1448 | | INLINE void execute_dbr(void) |
| 1304 | INLINE void execute_dbr(struct regs_decode *decode) |
| 1449 | 1305 | { |
| 1450 | | hyperstone.delay.delay_cmd = DELAY_TAKEN; |
| 1306 | hyperstone.delay.delay_cmd = DELAY_EXECUTE; |
| 1451 | 1307 | hyperstone.delay.delay_pc = PC + EXTRA_S; |
| 1452 | 1308 | |
| 1453 | 1309 | hyperstone.intblock = 3; |
| r1334 | r1335 | |
| 1479 | 1335 | PC = addr; |
| 1480 | 1336 | change_pc(PC); |
| 1481 | 1337 | |
| 1482 | | hyperstone_ICount -= 2; |
| 1338 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 1483 | 1339 | } |
| 1484 | 1340 | |
| 1485 | 1341 | |
| r1334 | r1335 | |
| 1509 | 1365 | PC = addr; |
| 1510 | 1366 | change_pc(PC); |
| 1511 | 1367 | |
| 1512 | | hyperstone_ICount -= 2; |
| 1368 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 1513 | 1369 | } |
| 1514 | 1370 | |
| 1515 | 1371 | /* TODO: mask Parity Error and Extended Overflow exceptions */ |
| r1334 | r1335 | |
| 1538 | 1394 | PC = addr; |
| 1539 | 1395 | change_pc(PC); |
| 1540 | 1396 | |
| 1541 | | mame_printf_debug("EXCEPTION! PPC = %08X PC = %08X\n",PPC-2,PC-2); |
| 1542 | | hyperstone_ICount -= 2; |
| 1397 | DEBUG_PRINTF(("EXCEPTION! PPC = %08X PC = %08X\n",PPC-2,PC-2)); |
| 1398 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 1543 | 1399 | } |
| 1544 | 1400 | |
| 1545 | | static void execute_software(void) |
| 1401 | static void execute_software(struct regs_decode *decode) |
| 1546 | 1402 | { |
| 1547 | 1403 | UINT8 reg; |
| 1548 | 1404 | UINT32 oldSR; |
| r1334 | r1335 | |
| 1557 | 1413 | //since it's sure the register is in the register part of the stack, |
| 1558 | 1414 | //set the stack address to a value above the highest address |
| 1559 | 1415 | //that can be set by a following frame instruction |
| 1560 | | stack_of_dst = (SP & ~0xff) + 64*4 + (((GET_FP + current_regs.dst) % 64) * 4); //converted to 32bits offset |
| 1416 | stack_of_dst = (SP & ~0xff) + 64*4 + (((GET_FP + decode->dst) % 64) * 4); //converted to 32bits offset |
| 1561 | 1417 | |
| 1562 | 1418 | oldSR = SR; |
| 1563 | 1419 | |
| r1334 | r1335 | |
| 1591 | 1447 | 6 - IO3 (trap 54) |
| 1592 | 1448 | 7 - TIMER (trap 55) |
| 1593 | 1449 | */ |
| 1594 | | static void set_irq_line(int irqline, int state) |
| 1450 | |
| 1451 | #define INT1_LINE_STATE ((ISR >> 0) & 1) |
| 1452 | #define INT2_LINE_STATE ((ISR >> 1) & 1) |
| 1453 | #define INT3_LINE_STATE ((ISR >> 2) & 1) |
| 1454 | #define INT4_LINE_STATE ((ISR >> 3) & 1) |
| 1455 | #define IO1_LINE_STATE ((ISR >> 4) & 1) |
| 1456 | #define IO2_LINE_STATE ((ISR >> 5) & 1) |
| 1457 | #define IO3_LINE_STATE ((ISR >> 6) & 1) |
| 1458 | |
| 1459 | static void check_interrupts(void) |
| 1595 | 1460 | { |
| 1596 | 1461 | /* Interrupt-Lock flag isn't set */ |
| 1462 | if (GET_L || hyperstone.intblock > 0) |
| 1463 | return; |
| 1597 | 1464 | |
| 1598 | | if(hyperstone.intblock) |
| 1465 | /* quick exit if nothing */ |
| 1466 | if (!hyperstone.timer_int_pending && (ISR & 0x7f) == 0) |
| 1599 | 1467 | return; |
| 1600 | 1468 | |
| 1601 | | if( !GET_L && state ) |
| 1469 | /* IO3 is priority 5; state is in bit 6 of ISR; FCR bit 10 enables input and FCR bit 8 inhibits interrupt */ |
| 1470 | if (IO3_LINE_STATE && (FCR & 0x00000500) == 0x00000400) |
| 1602 | 1471 | { |
| 1603 | | int execint=0; |
| 1604 | | switch(irqline) |
| 1605 | | { |
| 1606 | | case 0: if( (FCR&(1<<6)) && (!(FCR&(1<<4))) ) execint=1; // IO2 |
| 1607 | | break; |
| 1608 | | case 1: if( (FCR&(1<<2)) && (!(FCR&(1<<0))) ) execint=1; // IO1 |
| 1609 | | break; |
| 1610 | | case 2: if( !(FCR&(1<<31)) ) execint=1; // int 4 |
| 1611 | | break; |
| 1612 | | case 3: if( !(FCR&(1<<30)) ) execint=1; // int 3 |
| 1613 | | break; |
| 1614 | | case 4: if( !(FCR&(1<<29)) ) execint=1; // int 2 |
| 1615 | | break; |
| 1616 | | case 5: if( !(FCR&(1<<28)) ) execint=1; // int 1 |
| 1617 | | break; |
| 1618 | | case 6: if( (FCR&(1<<10)) && (!(FCR&(1<<8))) ) execint=1; // IO3 |
| 1619 | | break; |
| 1620 | | case 7: if( !(FCR&(1<<23)) ) execint=1; // timer |
| 1621 | | break; |
| 1622 | | } |
| 1623 | | /* |
| 1624 | | if( (FCR&(1<<6)) && (!(FCR&(1<<4))) ) mame_printf_debug("IO2 en\n"); // IO2 |
| 1472 | execute_int(get_trap_addr(IO3)); |
| 1473 | (*hyperstone.irq_callback)(IRQ_IO3); |
| 1474 | return; |
| 1475 | } |
| 1625 | 1476 | |
| 1626 | | if( (FCR&(1<<2)) && (!(FCR&(1<<0))) ) mame_printf_debug("IO1 en\n"); // IO1 |
| 1477 | /* timer int might be priority 6 if FCR bits 20-21 == 3; FCR bit 23 inhibits interrupt */ |
| 1478 | if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00300000) |
| 1479 | { |
| 1480 | hyperstone.timer_int_pending = 0; |
| 1481 | execute_int(get_trap_addr(TIMER)); |
| 1482 | return; |
| 1483 | } |
| 1627 | 1484 | |
| 1628 | | if( !(FCR&(1<<31)) ) mame_printf_debug("int4 en\n"); // int 4 |
| 1485 | /* INT1 is priority 7; state is in bit 0 of ISR; FCR bit 28 inhibits interrupt */ |
| 1486 | if (INT1_LINE_STATE && (FCR & 0x10000000) == 0x00000000) |
| 1487 | { |
| 1488 | execute_int(get_trap_addr(INT1)); |
| 1489 | (*hyperstone.irq_callback)(IRQ_INT1); |
| 1490 | return; |
| 1491 | } |
| 1629 | 1492 | |
| 1630 | | if( !(FCR&(1<<30)) ) mame_printf_debug("int3 en\n"); // int 3 |
| 1493 | /* timer int might be priority 8 if FCR bits 20-21 == 2; FCR bit 23 inhibits interrupt */ |
| 1494 | if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00200000) |
| 1495 | { |
| 1496 | hyperstone.timer_int_pending = 0; |
| 1497 | execute_int(get_trap_addr(TIMER)); |
| 1498 | return; |
| 1499 | } |
| 1631 | 1500 | |
| 1632 | | if( !(FCR&(1<<29)) ) mame_printf_debug("int2 en\n"); // int 2 |
| 1501 | /* INT2 is priority 9; state is in bit 1 of ISR; FCR bit 29 inhibits interrupt */ |
| 1502 | if (INT2_LINE_STATE && (FCR & 0x20000000) == 0x00000000) |
| 1503 | { |
| 1504 | execute_int(get_trap_addr(INT2)); |
| 1505 | (*hyperstone.irq_callback)(IRQ_INT2); |
| 1506 | return; |
| 1507 | } |
| 1633 | 1508 | |
| 1634 | | if( !(FCR&(1<<28)) ) mame_printf_debug("int1 en\n"); // int 1 |
| 1509 | /* timer int might be priority 10 if FCR bits 20-21 == 1; FCR bit 23 inhibits interrupt */ |
| 1510 | if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00100000) |
| 1511 | { |
| 1512 | hyperstone.timer_int_pending = 0; |
| 1513 | execute_int(get_trap_addr(TIMER)); |
| 1514 | return; |
| 1515 | } |
| 1635 | 1516 | |
| 1636 | | if( (FCR&(1<<10)) && (!(FCR&(1<<8))) ) mame_printf_debug("IO3 en\n"); // IO3 |
| 1517 | /* INT3 is priority 11; state is in bit 2 of ISR; FCR bit 30 inhibits interrupt */ |
| 1518 | if (INT3_LINE_STATE && (FCR & 0x40000000) == 0x00000000) |
| 1519 | { |
| 1520 | execute_int(get_trap_addr(INT3)); |
| 1521 | (*hyperstone.irq_callback)(IRQ_INT3); |
| 1522 | return; |
| 1523 | } |
| 1637 | 1524 | |
| 1638 | | // if( !(FCR&(1<<23)) ) mame_printf_debug("timer irq!\n"); // timer |
| 1639 | | */ |
| 1640 | | if(execint) |
| 1641 | | { |
| 1642 | | execute_int(get_trap_addr(irqline + 48)); |
| 1643 | | (*hyperstone.irq_callback)(irqline); |
| 1644 | | } |
| 1525 | /* timer int might be priority 12 if FCR bits 20-21 == 0; FCR bit 23 inhibits interrupt */ |
| 1526 | if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00000000) |
| 1527 | { |
| 1528 | hyperstone.timer_int_pending = 0; |
| 1529 | execute_int(get_trap_addr(TIMER)); |
| 1530 | return; |
| 1645 | 1531 | } |
| 1532 | |
| 1533 | /* INT4 is priority 13; state is in bit 3 of ISR; FCR bit 31 inhibits interrupt */ |
| 1534 | if (INT4_LINE_STATE && (FCR & 0x80000000) == 0x00000000) |
| 1535 | { |
| 1536 | execute_int(get_trap_addr(INT4)); |
| 1537 | (*hyperstone.irq_callback)(IRQ_INT4); |
| 1538 | return; |
| 1539 | } |
| 1540 | |
| 1541 | /* IO1 is priority 14; state is in bit 4 of ISR; FCR bit 2 enables input and FCR bit 0 inhibits interrupt */ |
| 1542 | if (IO1_LINE_STATE && (FCR & 0x00000005) == 0x00000004) |
| 1543 | { |
| 1544 | execute_int(get_trap_addr(IO1)); |
| 1545 | (*hyperstone.irq_callback)(IRQ_IO3); |
| 1546 | return; |
| 1547 | } |
| 1548 | |
| 1549 | /* IO2 is priority 15; state is in bit 5 of ISR; FCR bit 6 enables input and FCR bit 4 inhibits interrupt */ |
| 1550 | if (IO2_LINE_STATE && (FCR & 0x00000050) == 0x00000040) |
| 1551 | { |
| 1552 | execute_int(get_trap_addr(IO2)); |
| 1553 | (*hyperstone.irq_callback)(IRQ_IO2); |
| 1554 | return; |
| 1555 | } |
| 1646 | 1556 | } |
| 1647 | 1557 | |
| 1648 | | static void hyperstone_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1558 | static void set_irq_line(int irqline, int state) |
| 1649 | 1559 | { |
| 1560 | if (state) |
| 1561 | ISR |= 1 << irqline; |
| 1562 | else |
| 1563 | ISR &= ~(1 << irqline); |
| 1564 | } |
| 1565 | |
| 1566 | static void hyperstone_init(int index, int clock, const void *config, int (*irqcallback)(int), int scale_mask) |
| 1567 | { |
| 1650 | 1568 | state_save_register_item_array("E132XS", index, hyperstone.global_regs); |
| 1651 | 1569 | state_save_register_item_array("E132XS", index, hyperstone.local_regs); |
| 1652 | 1570 | state_save_register_item("E132XS", index, hyperstone.ppc); |
| 1653 | 1571 | state_save_register_item("E132XS", index, hyperstone.trap_entry); |
| 1654 | 1572 | state_save_register_item("E132XS", index, hyperstone.delay.delay_pc); |
| 1655 | | state_save_register_item("E132XS", index, hyperstone.op); |
| 1656 | | state_save_register_item("E132XS", index, hyperstone.n); |
| 1657 | | state_save_register_item("E132XS", index, hyperstone.h_clear); |
| 1658 | 1573 | state_save_register_item("E132XS", index, hyperstone.instruction_length); |
| 1659 | 1574 | state_save_register_item("E132XS", index, hyperstone.intblock); |
| 1660 | | state_save_register_item("E132XS", index, hyperstone.delay_timer); |
| 1661 | 1575 | state_save_register_item("E132XS", index, hyperstone.delay.delay_cmd); |
| 1662 | | state_save_register_item("E132XS", index, hyperstone.timer_clocks); |
| 1576 | state_save_register_item("E132XS", index, hyperstone.tr_clocks_per_tick); |
| 1663 | 1577 | |
| 1664 | 1578 | hyperstone.irq_callback = irqcallback; |
| 1579 | hyperstone.timer = timer_alloc(timer_callback); |
| 1580 | hyperstone.clock_scale_mask = scale_mask; |
| 1665 | 1581 | } |
| 1666 | 1582 | |
| 1667 | 1583 | #if (HAS_E116T || HAS_E116XT || HAS_E116XS || HAS_E116XSR || HAS_GMS30C2116 || HAS_GMS30C2216) |
| 1668 | | static void e116_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1584 | static void e116_init(int index, int clock, const void *config, int (*irqcallback)(int), int scale_mask) |
| 1669 | 1585 | { |
| 1670 | 1586 | hyp_cpu_read_byte = program_read_byte_16be; |
| 1671 | 1587 | hyp_cpu_read_half_word = program_read_word_16be; |
| r1334 | r1335 | |
| 1679 | 1595 | |
| 1680 | 1596 | hyp_type_16bit = 1; |
| 1681 | 1597 | |
| 1682 | | hyperstone_init(index, clock, config, irqcallback); |
| 1598 | hyperstone_init(index, clock, config, irqcallback, scale_mask); |
| 1683 | 1599 | } |
| 1600 | |
| 1601 | static void e116t_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1602 | { |
| 1603 | e116_init(index, clock, config, irqcallback, 0); |
| 1604 | } |
| 1605 | |
| 1606 | static void e116xt_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1607 | { |
| 1608 | e116_init(index, clock, config, irqcallback, 3); |
| 1609 | } |
| 1610 | |
| 1611 | static void e116xs_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1612 | { |
| 1613 | e116_init(index, clock, config, irqcallback, 7); |
| 1614 | } |
| 1615 | |
| 1616 | static void e116xsr_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1617 | { |
| 1618 | e116_init(index, clock, config, irqcallback, 7); |
| 1619 | } |
| 1620 | |
| 1621 | static void gms30c2116_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1622 | { |
| 1623 | e116_init(index, clock, config, irqcallback, 0); |
| 1624 | } |
| 1625 | |
| 1626 | static void gms30c2216_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1627 | { |
| 1628 | e116_init(index, clock, config, irqcallback, 0); |
| 1629 | } |
| 1684 | 1630 | #endif |
| 1685 | 1631 | |
| 1686 | 1632 | #if (HAS_E132N || HAS_E132T || HAS_E132XN || HAS_E132XT || HAS_E132XS || HAS_E132XSR || HAS_GMS30C2132 || HAS_GMS30C2232) |
| 1687 | | static void e132_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1633 | static void e132_init(int index, int clock, const void *config, int (*irqcallback)(int), int scale_mask) |
| 1688 | 1634 | { |
| 1689 | 1635 | hyp_cpu_read_byte = program_read_byte_32be; |
| 1690 | 1636 | hyp_cpu_read_half_word = program_read_word_32be; |
| r1334 | r1335 | |
| 1698 | 1644 | |
| 1699 | 1645 | hyp_type_16bit = 0; |
| 1700 | 1646 | |
| 1701 | | hyperstone_init(index, clock, config, irqcallback); |
| 1647 | hyperstone_init(index, clock, config, irqcallback, scale_mask); |
| 1702 | 1648 | } |
| 1649 | |
| 1650 | static void e132n_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1651 | { |
| 1652 | e132_init(index, clock, config, irqcallback, 0); |
| 1653 | } |
| 1654 | |
| 1655 | static void e132t_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1656 | { |
| 1657 | e132_init(index, clock, config, irqcallback, 0); |
| 1658 | } |
| 1659 | |
| 1660 | static void e132xn_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1661 | { |
| 1662 | e132_init(index, clock, config, irqcallback, 3); |
| 1663 | } |
| 1664 | |
| 1665 | static void e132xt_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1666 | { |
| 1667 | e132_init(index, clock, config, irqcallback, 3); |
| 1668 | } |
| 1669 | |
| 1670 | static void e132xs_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1671 | { |
| 1672 | e132_init(index, clock, config, irqcallback, 7); |
| 1673 | } |
| 1674 | |
| 1675 | static void e132xsr_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1676 | { |
| 1677 | e132_init(index, clock, config, irqcallback, 7); |
| 1678 | } |
| 1679 | |
| 1680 | static void gms30c2132_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1681 | { |
| 1682 | e132_init(index, clock, config, irqcallback, 0); |
| 1683 | } |
| 1684 | |
| 1685 | static void gms30c2232_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1686 | { |
| 1687 | e132_init(index, clock, config, irqcallback, 0); |
| 1688 | } |
| 1703 | 1689 | #endif |
| 1704 | 1690 | |
| 1705 | 1691 | static void hyperstone_reset(void) |
| 1706 | 1692 | { |
| 1707 | 1693 | //TODO: Add different reset initializations for BCR, MCR, FCR, TPR |
| 1708 | 1694 | |
| 1695 | emu_timer *save_timer; |
| 1709 | 1696 | int (*save_irqcallback)(int); |
| 1710 | 1697 | |
| 1698 | save_timer = hyperstone.timer; |
| 1711 | 1699 | save_irqcallback = hyperstone.irq_callback; |
| 1712 | 1700 | memset(&hyperstone, 0, sizeof(hyperstone_regs)); |
| 1713 | 1701 | hyperstone.irq_callback = save_irqcallback; |
| 1702 | hyperstone.timer = save_timer; |
| 1714 | 1703 | |
| 1715 | | hyperstone.h_clear = 0; |
| 1716 | | hyperstone.instruction_length = 0; |
| 1704 | hyperstone.tr_clocks_per_tick = 2; |
| 1717 | 1705 | |
| 1718 | 1706 | hyperstone_set_trap_entry(E132XS_ENTRY_MEM3); /* default entry point @ MEM3 */ |
| 1719 | 1707 | |
| r1334 | r1335 | |
| 1736 | 1724 | SET_L_REG(0, (PC & 0xfffffffe) | GET_S); |
| 1737 | 1725 | SET_L_REG(1, SR); |
| 1738 | 1726 | |
| 1739 | | hyperstone_ICount -= 2; |
| 1727 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 1740 | 1728 | } |
| 1741 | 1729 | |
| 1742 | 1730 | static void hyperstone_exit(void) |
| r1334 | r1335 | |
| 1744 | 1732 | // nothing to do |
| 1745 | 1733 | } |
| 1746 | 1734 | |
| 1747 | | /* Handle the timer, increasing its value after "timer_clocks" clocks and returning the new icount base that needs to be used for the next check */ |
| 1748 | | static int handle_timers(int current_icount, int previous_icount) |
| 1749 | | { |
| 1750 | | int diff = previous_icount - current_icount; |
| 1751 | | int new_icount_base; |
| 1752 | | |
| 1753 | | if(diff >= hyperstone.timer_clocks) |
| 1754 | | { |
| 1755 | | TR++; // wrap around to 0 modulo 32 bits |
| 1756 | | |
| 1757 | | if( hyperstone.delay_timer ) |
| 1758 | | { |
| 1759 | | hyperstone.delay_timer = 0; |
| 1760 | | hyperstone.timer_clocks = hyperstone.n + 2; |
| 1761 | | } |
| 1762 | | |
| 1763 | | new_icount_base = current_icount + (diff - hyperstone.timer_clocks); |
| 1764 | | } |
| 1765 | | else |
| 1766 | | { |
| 1767 | | new_icount_base = previous_icount; |
| 1768 | | } |
| 1769 | | |
| 1770 | | if(!hyperstone.intblock) |
| 1771 | | { |
| 1772 | | if( !((TR - TCR) & 0x80000000) ) |
| 1773 | | { |
| 1774 | | /* generate a timer interrupt */ |
| 1775 | | set_irq_line(7, PULSE_LINE); |
| 1776 | | } |
| 1777 | | } |
| 1778 | | |
| 1779 | | return new_icount_base; |
| 1780 | | } |
| 1781 | | |
| 1782 | | static int hyperstone_execute(int cycles) |
| 1783 | | { |
| 1784 | | int old_icount = cycles; |
| 1785 | | hyperstone_ICount = cycles; |
| 1786 | | |
| 1787 | | do |
| 1788 | | { |
| 1789 | | PPC = PC; /* copy PC to previous PC */ |
| 1790 | | |
| 1791 | | CALL_MAME_DEBUG; |
| 1792 | | |
| 1793 | | OP = READ_OP(PC); |
| 1794 | | |
| 1795 | | PC += 2; |
| 1796 | | |
| 1797 | | if(GET_H) |
| 1798 | | { |
| 1799 | | hyperstone.h_clear = 1; |
| 1800 | | } |
| 1801 | | |
| 1802 | | hyperstone.instruction_length = 1; |
| 1803 | | |
| 1804 | | /* clear 'current regs / flags' */ |
| 1805 | | current_regs.src = 0; |
| 1806 | | current_regs.dst = 0; |
| 1807 | | current_regs.src_value = 0; |
| 1808 | | current_regs.next_src_value = 0; |
| 1809 | | current_regs.dst_value = 0; |
| 1810 | | current_regs.next_dst_value = 0; |
| 1811 | | current_regs.sub_type = 0; |
| 1812 | | current_regs.extra.u = 0; |
| 1813 | | current_regs.extra.s = 0; |
| 1814 | | current_regs.set_src_register = NULL; |
| 1815 | | current_regs.set_dst_register = NULL; |
| 1816 | | current_regs.src_is_pc = 0; |
| 1817 | | current_regs.dst_is_pc = 0; |
| 1818 | | current_regs.src_is_sr = 0; |
| 1819 | | current_regs.dst_is_sr = 0; |
| 1820 | | current_regs.same_src_dst = 0; |
| 1821 | | current_regs.same_src_dstf = 0; |
| 1822 | | current_regs.same_srcf_dst = 0; |
| 1823 | | |
| 1824 | | /* decode current opcode details into current regs */ |
| 1825 | | hyperstone_decode[(OP & 0xff00) >> 8](); |
| 1826 | | |
| 1827 | | /* execute opcode */ |
| 1828 | | hyperstone_op[(OP & 0xff00) >> 8](); |
| 1829 | | |
| 1830 | | SET_ILC(hyperstone.instruction_length & 3); |
| 1831 | | |
| 1832 | | old_icount = handle_timers(hyperstone_ICount, old_icount); |
| 1833 | | |
| 1834 | | if(hyperstone.h_clear) |
| 1835 | | { |
| 1836 | | SET_H(0); |
| 1837 | | hyperstone.h_clear = 0; |
| 1838 | | } |
| 1839 | | |
| 1840 | | if( GET_T && GET_P && hyperstone.delay.delay_cmd == NO_DELAY ) /* Not in a Delayed Branch instructions */ |
| 1841 | | { |
| 1842 | | UINT32 addr = get_trap_addr(TRACE_EXCEPTION); |
| 1843 | | execute_exception(addr); |
| 1844 | | } |
| 1845 | | |
| 1846 | | if( hyperstone.delay.delay_cmd == DELAY_TAKEN ) |
| 1847 | | { |
| 1848 | | hyperstone.delay.delay_cmd = DELAY_EXECUTE; |
| 1849 | | } |
| 1850 | | |
| 1851 | | if(hyperstone.intblock > 0) |
| 1852 | | { |
| 1853 | | hyperstone.intblock--; |
| 1854 | | } |
| 1855 | | |
| 1856 | | } while( hyperstone_ICount > 0 ); |
| 1857 | | |
| 1858 | | return cycles - hyperstone_ICount; |
| 1859 | | } |
| 1860 | | |
| 1861 | 1735 | static void hyperstone_get_context(void *regs) |
| 1862 | 1736 | { |
| 1863 | 1737 | /* copy the context */ |
| r1334 | r1335 | |
| 1881 | 1755 | |
| 1882 | 1756 | /* Opcodes */ |
| 1883 | 1757 | |
| 1884 | | static void hyperstone_chk(void) |
| 1758 | INLINE void hyperstone_chk(struct regs_decode *decode) |
| 1885 | 1759 | { |
| 1886 | 1760 | UINT32 addr = get_trap_addr(RANGE_ERROR); |
| 1887 | 1761 | |
| r1334 | r1335 | |
| 1904 | 1778 | } |
| 1905 | 1779 | } |
| 1906 | 1780 | |
| 1907 | | hyperstone_ICount -= 1; |
| 1781 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 1908 | 1782 | } |
| 1909 | 1783 | |
| 1910 | | static void hyperstone_movd(void) |
| 1784 | INLINE void hyperstone_movd(struct regs_decode *decode) |
| 1911 | 1785 | { |
| 1912 | 1786 | if( DST_IS_PC ) // Rd denotes PC |
| 1913 | 1787 | { |
| r1334 | r1335 | |
| 1918 | 1792 | |
| 1919 | 1793 | if( SRC_IS_PC || SRC_IS_SR ) |
| 1920 | 1794 | { |
| 1921 | | logerror("Denoted PC or SR in RET instruction. PC = %08X\n", PC); |
| 1795 | DEBUG_PRINTF(("Denoted PC or SR in RET instruction. PC = %08X\n", PC)); |
| 1922 | 1796 | } |
| 1923 | 1797 | else |
| 1924 | 1798 | { |
| r1334 | r1335 | |
| 1929 | 1803 | PC = SET_PC(SREG); |
| 1930 | 1804 | change_pc(PC); |
| 1931 | 1805 | SR = (SREGF & 0xffe00000) | ((SREG & 0x01) << 18 ) | (SREGF & 0x3ffff); |
| 1806 | if (hyperstone.intblock < 1) |
| 1807 | hyperstone.intblock = 1; |
| 1932 | 1808 | |
| 1933 | 1809 | hyperstone.instruction_length = 0; // undefined |
| 1934 | 1810 | |
| r1334 | r1335 | |
| 1959 | 1835 | } |
| 1960 | 1836 | |
| 1961 | 1837 | //TODO: no 1! |
| 1962 | | hyperstone_ICount -= 1; |
| 1838 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 1963 | 1839 | } |
| 1964 | 1840 | else if( SRC_IS_SR ) // Rd doesn't denote PC and Rs denotes SR |
| 1965 | 1841 | { |
| r1334 | r1335 | |
| 1968 | 1844 | SET_Z(1); |
| 1969 | 1845 | SET_N(0); |
| 1970 | 1846 | |
| 1971 | | hyperstone_ICount -= 2; |
| 1847 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 1972 | 1848 | } |
| 1973 | 1849 | else // Rd doesn't denote PC and Rs doesn't denote SR |
| 1974 | 1850 | { |
| r1334 | r1335 | |
| 1981 | 1857 | SET_Z( tmp == 0 ? 1 : 0 ); |
| 1982 | 1858 | SET_N( SIGN_BIT(SREG) ); |
| 1983 | 1859 | |
| 1984 | | hyperstone_ICount -= 2; |
| 1860 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 1985 | 1861 | } |
| 1986 | 1862 | } |
| 1987 | 1863 | |
| 1988 | | static void hyperstone_divu(void) |
| 1864 | INLINE void hyperstone_divu(struct regs_decode *decode) |
| 1989 | 1865 | { |
| 1990 | 1866 | if( SAME_SRC_DST || SAME_SRC_DSTF ) |
| 1991 | 1867 | { |
| 1992 | | logerror("Denoted the same register code in hyperstone_divu instruction. PC = %08X\n", PC); |
| 1868 | DEBUG_PRINTF(("Denoted the same register code in hyperstone_divu instruction. PC = %08X\n", PC)); |
| 1993 | 1869 | } |
| 1994 | 1870 | else |
| 1995 | 1871 | { |
| 1996 | 1872 | if( SRC_IS_PC || SRC_IS_SR ) |
| 1997 | 1873 | { |
| 1998 | | logerror("Denoted PC or SR as source register in hyperstone_divu instruction. PC = %08X\n", PC); |
| 1874 | DEBUG_PRINTF(("Denoted PC or SR as source register in hyperstone_divu instruction. PC = %08X\n", PC)); |
| 1999 | 1875 | } |
| 2000 | 1876 | else |
| 2001 | 1877 | { |
| r1334 | r1335 | |
| 2031 | 1907 | } |
| 2032 | 1908 | } |
| 2033 | 1909 | |
| 2034 | | hyperstone_ICount -= 36; |
| 1910 | hyperstone_ICount -= 36 << hyperstone.clock_scale; |
| 2035 | 1911 | } |
| 2036 | 1912 | |
| 2037 | | static void hyperstone_divs(void) |
| 1913 | INLINE void hyperstone_divs(struct regs_decode *decode) |
| 2038 | 1914 | { |
| 2039 | 1915 | if( SAME_SRC_DST || SAME_SRC_DSTF ) |
| 2040 | 1916 | { |
| 2041 | | logerror("Denoted the same register code in hyperstone_divs instruction. PC = %08X\n", PC); |
| 1917 | DEBUG_PRINTF(("Denoted the same register code in hyperstone_divs instruction. PC = %08X\n", PC)); |
| 2042 | 1918 | } |
| 2043 | 1919 | else |
| 2044 | 1920 | { |
| 2045 | 1921 | if( SRC_IS_PC || SRC_IS_SR ) |
| 2046 | 1922 | { |
| 2047 | | logerror("Denoted PC or SR as source register in hyperstone_divs instruction. PC = %08X\n", PC); |
| 1923 | DEBUG_PRINTF(("Denoted PC or SR as source register in hyperstone_divs instruction. PC = %08X\n", PC)); |
| 2048 | 1924 | } |
| 2049 | 1925 | else |
| 2050 | 1926 | { |
| r1334 | r1335 | |
| 2080 | 1956 | } |
| 2081 | 1957 | } |
| 2082 | 1958 | |
| 2083 | | hyperstone_ICount -= 36; |
| 1959 | hyperstone_ICount -= 36 << hyperstone.clock_scale; |
| 2084 | 1960 | } |
| 2085 | 1961 | |
| 2086 | | static void hyperstone_xm(void) |
| 1962 | INLINE void hyperstone_xm(struct regs_decode *decode) |
| 2087 | 1963 | { |
| 2088 | 1964 | if( SRC_IS_SR || DST_IS_SR || DST_IS_PC ) |
| 2089 | 1965 | { |
| 2090 | | logerror("Denoted PC or SR in hyperstone_xm. PC = %08X\n", PC); |
| 1966 | DEBUG_PRINTF(("Denoted PC or SR in hyperstone_xm. PC = %08X\n", PC)); |
| 2091 | 1967 | } |
| 2092 | 1968 | else |
| 2093 | 1969 | { |
| 2094 | | switch( current_regs.sub_type ) // x_code |
| 1970 | switch( decode->sub_type ) // x_code |
| 2095 | 1971 | { |
| 2096 | 1972 | case 0: |
| 2097 | 1973 | case 1: |
| r1334 | r1335 | |
| 2109 | 1985 | } |
| 2110 | 1986 | else |
| 2111 | 1987 | { |
| 2112 | | SREG <<= current_regs.sub_type; |
| 1988 | SREG <<= decode->sub_type; |
| 2113 | 1989 | } |
| 2114 | 1990 | |
| 2115 | 1991 | break; |
| r1334 | r1335 | |
| 2118 | 1994 | case 5: |
| 2119 | 1995 | case 6: |
| 2120 | 1996 | case 7: |
| 2121 | | current_regs.sub_type -= 4; |
| 2122 | | SREG <<= current_regs.sub_type; |
| 1997 | decode->sub_type -= 4; |
| 1998 | SREG <<= decode->sub_type; |
| 2123 | 1999 | |
| 2124 | 2000 | break; |
| 2125 | 2001 | } |
| r1334 | r1335 | |
| 2127 | 2003 | SET_DREG(SREG); |
| 2128 | 2004 | } |
| 2129 | 2005 | |
| 2130 | | hyperstone_ICount -= 1; |
| 2006 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2131 | 2007 | } |
| 2132 | 2008 | |
| 2133 | | static void hyperstone_mask(void) |
| 2009 | INLINE void hyperstone_mask(struct regs_decode *decode) |
| 2134 | 2010 | { |
| 2135 | 2011 | DREG = SREG & EXTRA_U; |
| 2136 | 2012 | |
| 2137 | 2013 | SET_DREG(DREG); |
| 2138 | 2014 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2139 | 2015 | |
| 2140 | | hyperstone_ICount -= 1; |
| 2016 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2141 | 2017 | } |
| 2142 | 2018 | |
| 2143 | | static void hyperstone_sum(void) |
| 2019 | INLINE void hyperstone_sum(struct regs_decode *decode) |
| 2144 | 2020 | { |
| 2145 | 2021 | UINT64 tmp; |
| 2146 | 2022 | |
| r1334 | r1335 | |
| 2161 | 2037 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2162 | 2038 | SET_N( SIGN_BIT(DREG) ); |
| 2163 | 2039 | |
| 2164 | | hyperstone_ICount -= 1; |
| 2040 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2165 | 2041 | } |
| 2166 | 2042 | |
| 2167 | | static void hyperstone_sums(void) |
| 2043 | INLINE void hyperstone_sums(struct regs_decode *decode) |
| 2168 | 2044 | { |
| 2169 | 2045 | INT32 res; |
| 2170 | 2046 | INT64 tmp; |
| r1334 | r1335 | |
| 2186 | 2062 | SET_Z( res == 0 ? 1 : 0 ); |
| 2187 | 2063 | SET_N( SIGN_BIT(res) ); |
| 2188 | 2064 | |
| 2189 | | hyperstone_ICount -= 1; |
| 2065 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2190 | 2066 | |
| 2191 | 2067 | if( GET_V && !SRC_IS_SR ) |
| 2192 | 2068 | { |
| r1334 | r1335 | |
| 2195 | 2071 | } |
| 2196 | 2072 | } |
| 2197 | 2073 | |
| 2198 | | static void hyperstone_cmp(void) |
| 2074 | INLINE void hyperstone_cmp(struct regs_decode *decode) |
| 2199 | 2075 | { |
| 2200 | 2076 | UINT64 tmp; |
| 2201 | 2077 | |
| r1334 | r1335 | |
| 2220 | 2096 | else |
| 2221 | 2097 | SET_C(0); |
| 2222 | 2098 | |
| 2223 | | hyperstone_ICount -= 1; |
| 2099 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2224 | 2100 | } |
| 2225 | 2101 | |
| 2226 | | static void hyperstone_mov(void) |
| 2102 | INLINE void hyperstone_mov(struct regs_decode *decode) |
| 2227 | 2103 | { |
| 2228 | | if( !GET_S && current_regs.dst >= 16 ) |
| 2104 | if( !GET_S && decode->dst >= 16 ) |
| 2229 | 2105 | { |
| 2230 | 2106 | UINT32 addr = get_trap_addr(PRIVILEGE_ERROR); |
| 2231 | 2107 | execute_exception(addr); |
| r1334 | r1335 | |
| 2239 | 2115 | SET_Z( SREG == 0 ? 1 : 0 ); |
| 2240 | 2116 | SET_N( SIGN_BIT(SREG) ); |
| 2241 | 2117 | |
| 2242 | | hyperstone_ICount -= 1; |
| 2118 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2243 | 2119 | } |
| 2244 | 2120 | |
| 2245 | 2121 | |
| 2246 | | static void hyperstone_add(void) |
| 2122 | INLINE void hyperstone_add(struct regs_decode *decode) |
| 2247 | 2123 | { |
| 2248 | 2124 | UINT64 tmp; |
| 2249 | 2125 | |
| r1334 | r1335 | |
| 2263 | 2139 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2264 | 2140 | SET_N( SIGN_BIT(DREG) ); |
| 2265 | 2141 | |
| 2266 | | hyperstone_ICount -= 1; |
| 2142 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2267 | 2143 | } |
| 2268 | 2144 | |
| 2269 | | static void hyperstone_adds(void) |
| 2145 | INLINE void hyperstone_adds(struct regs_decode *decode) |
| 2270 | 2146 | { |
| 2271 | 2147 | INT32 res; |
| 2272 | 2148 | INT64 tmp; |
| r1334 | r1335 | |
| 2288 | 2164 | SET_Z( res == 0 ? 1 : 0 ); |
| 2289 | 2165 | SET_N( SIGN_BIT(res) ); |
| 2290 | 2166 | |
| 2291 | | hyperstone_ICount -= 1; |
| 2167 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2292 | 2168 | |
| 2293 | 2169 | if( GET_V ) |
| 2294 | 2170 | { |
| r1334 | r1335 | |
| 2297 | 2173 | } |
| 2298 | 2174 | } |
| 2299 | 2175 | |
| 2300 | | static void hyperstone_cmpb(void) |
| 2176 | INLINE void hyperstone_cmpb(struct regs_decode *decode) |
| 2301 | 2177 | { |
| 2302 | 2178 | SET_Z( (DREG & SREG) == 0 ? 1 : 0 ); |
| 2303 | 2179 | |
| 2304 | | hyperstone_ICount -= 1; |
| 2180 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2305 | 2181 | } |
| 2306 | 2182 | |
| 2307 | | static void hyperstone_andn(void) |
| 2183 | INLINE void hyperstone_andn(struct regs_decode *decode) |
| 2308 | 2184 | { |
| 2309 | 2185 | DREG = DREG & ~SREG; |
| 2310 | 2186 | |
| 2311 | 2187 | SET_DREG(DREG); |
| 2312 | 2188 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2313 | 2189 | |
| 2314 | | hyperstone_ICount -= 1; |
| 2190 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2315 | 2191 | } |
| 2316 | 2192 | |
| 2317 | | static void hyperstone_or(void) |
| 2193 | INLINE void hyperstone_or(struct regs_decode *decode) |
| 2318 | 2194 | { |
| 2319 | 2195 | DREG = DREG | SREG; |
| 2320 | 2196 | |
| 2321 | 2197 | SET_DREG(DREG); |
| 2322 | 2198 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2323 | 2199 | |
| 2324 | | hyperstone_ICount -= 1; |
| 2200 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2325 | 2201 | } |
| 2326 | 2202 | |
| 2327 | | static void hyperstone_xor(void) |
| 2203 | INLINE void hyperstone_xor(struct regs_decode *decode) |
| 2328 | 2204 | { |
| 2329 | 2205 | DREG = DREG ^ SREG; |
| 2330 | 2206 | |
| 2331 | 2207 | SET_DREG(DREG); |
| 2332 | 2208 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2333 | 2209 | |
| 2334 | | hyperstone_ICount -= 1; |
| 2210 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2335 | 2211 | } |
| 2336 | 2212 | |
| 2337 | | static void hyperstone_subc(void) |
| 2213 | INLINE void hyperstone_subc(struct regs_decode *decode) |
| 2338 | 2214 | { |
| 2339 | 2215 | UINT64 tmp; |
| 2340 | 2216 | |
| r1334 | r1335 | |
| 2367 | 2243 | SET_Z( GET_Z & (DREG == 0 ? 1 : 0) ); |
| 2368 | 2244 | SET_N( SIGN_BIT(DREG) ); |
| 2369 | 2245 | |
| 2370 | | hyperstone_ICount -= 1; |
| 2246 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2371 | 2247 | } |
| 2372 | 2248 | |
| 2373 | | static void hyperstone_not(void) |
| 2249 | INLINE void hyperstone_not(struct regs_decode *decode) |
| 2374 | 2250 | { |
| 2375 | 2251 | SET_DREG(~SREG); |
| 2376 | 2252 | SET_Z( ~SREG == 0 ? 1 : 0 ); |
| 2377 | 2253 | |
| 2378 | | hyperstone_ICount -= 1; |
| 2254 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2379 | 2255 | } |
| 2380 | 2256 | |
| 2381 | | static void hyperstone_sub(void) |
| 2257 | INLINE void hyperstone_sub(struct regs_decode *decode) |
| 2382 | 2258 | { |
| 2383 | 2259 | UINT64 tmp; |
| 2384 | 2260 | |
| r1334 | r1335 | |
| 2398 | 2274 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2399 | 2275 | SET_N( SIGN_BIT(DREG) ); |
| 2400 | 2276 | |
| 2401 | | hyperstone_ICount -= 1; |
| 2277 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2402 | 2278 | } |
| 2403 | 2279 | |
| 2404 | | static void hyperstone_subs(void) |
| 2280 | INLINE void hyperstone_subs(struct regs_decode *decode) |
| 2405 | 2281 | { |
| 2406 | 2282 | INT32 res; |
| 2407 | 2283 | INT64 tmp; |
| r1334 | r1335 | |
| 2424 | 2300 | SET_Z( res == 0 ? 1 : 0 ); |
| 2425 | 2301 | SET_N( SIGN_BIT(res) ); |
| 2426 | 2302 | |
| 2427 | | hyperstone_ICount -= 1; |
| 2303 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2428 | 2304 | |
| 2429 | 2305 | if( GET_V ) |
| 2430 | 2306 | { |
| r1334 | r1335 | |
| 2433 | 2309 | } |
| 2434 | 2310 | } |
| 2435 | 2311 | |
| 2436 | | static void hyperstone_addc(void) |
| 2312 | INLINE void hyperstone_addc(struct regs_decode *decode) |
| 2437 | 2313 | { |
| 2438 | 2314 | UINT64 tmp; |
| 2439 | 2315 | |
| r1334 | r1335 | |
| 2471 | 2347 | SET_Z( GET_Z & (DREG == 0 ? 1 : 0) ); |
| 2472 | 2348 | SET_N( SIGN_BIT(DREG) ); |
| 2473 | 2349 | |
| 2474 | | hyperstone_ICount -= 1; |
| 2350 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2475 | 2351 | } |
| 2476 | 2352 | |
| 2477 | | static void hyperstone_and(void) |
| 2353 | INLINE void hyperstone_and(struct regs_decode *decode) |
| 2478 | 2354 | { |
| 2479 | 2355 | DREG = DREG & SREG; |
| 2480 | 2356 | |
| 2481 | 2357 | SET_DREG(DREG); |
| 2482 | 2358 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2483 | 2359 | |
| 2484 | | hyperstone_ICount -= 1; |
| 2360 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2485 | 2361 | } |
| 2486 | 2362 | |
| 2487 | | static void hyperstone_neg(void) |
| 2363 | INLINE void hyperstone_neg(struct regs_decode *decode) |
| 2488 | 2364 | { |
| 2489 | 2365 | UINT64 tmp; |
| 2490 | 2366 | |
| r1334 | r1335 | |
| 2502 | 2378 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2503 | 2379 | SET_N( SIGN_BIT(DREG) ); |
| 2504 | 2380 | |
| 2505 | | hyperstone_ICount -= 1; |
| 2381 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2506 | 2382 | } |
| 2507 | 2383 | |
| 2508 | | static void hyperstone_negs(void) |
| 2384 | INLINE void hyperstone_negs(struct regs_decode *decode) |
| 2509 | 2385 | { |
| 2510 | 2386 | INT32 res; |
| 2511 | 2387 | INT64 tmp; |
| r1334 | r1335 | |
| 2528 | 2404 | SET_N( SIGN_BIT(res) ); |
| 2529 | 2405 | |
| 2530 | 2406 | |
| 2531 | | hyperstone_ICount -= 1; |
| 2407 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2532 | 2408 | |
| 2533 | 2409 | if( GET_V && !SRC_IS_SR ) //trap doesn't occur when source is SR |
| 2534 | 2410 | { |
| r1334 | r1335 | |
| 2537 | 2413 | } |
| 2538 | 2414 | } |
| 2539 | 2415 | |
| 2540 | | static void hyperstone_cmpi(void) |
| 2416 | INLINE void hyperstone_cmpi(struct regs_decode *decode) |
| 2541 | 2417 | { |
| 2542 | 2418 | UINT64 tmp; |
| 2543 | 2419 | |
| r1334 | r1335 | |
| 2559 | 2435 | else |
| 2560 | 2436 | SET_C(0); |
| 2561 | 2437 | |
| 2562 | | hyperstone_ICount -= 1; |
| 2438 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2563 | 2439 | } |
| 2564 | 2440 | |
| 2565 | | static void hyperstone_movi(void) |
| 2441 | INLINE void hyperstone_movi(struct regs_decode *decode) |
| 2566 | 2442 | { |
| 2567 | | if( !GET_S && current_regs.dst >= 16 ) |
| 2443 | if( !GET_S && decode->dst >= 16 ) |
| 2568 | 2444 | { |
| 2569 | 2445 | UINT32 addr = get_trap_addr(PRIVILEGE_ERROR); |
| 2570 | 2446 | execute_exception(addr); |
| r1334 | r1335 | |
| 2582 | 2458 | SET_V(0); // or V undefined ? |
| 2583 | 2459 | #endif |
| 2584 | 2460 | |
| 2585 | | hyperstone_ICount -= 1; |
| 2461 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2586 | 2462 | } |
| 2587 | 2463 | |
| 2588 | | static void hyperstone_addi(void) |
| 2464 | INLINE void hyperstone_addi(struct regs_decode *decode) |
| 2589 | 2465 | { |
| 2590 | 2466 | UINT32 imm; |
| 2591 | 2467 | UINT64 tmp; |
| r1334 | r1335 | |
| 2609 | 2485 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2610 | 2486 | SET_N( SIGN_BIT(DREG) ); |
| 2611 | 2487 | |
| 2612 | | hyperstone_ICount -= 1; |
| 2488 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2613 | 2489 | } |
| 2614 | 2490 | |
| 2615 | | static void hyperstone_addsi(void) |
| 2491 | INLINE void hyperstone_addsi(struct regs_decode *decode) |
| 2616 | 2492 | { |
| 2617 | 2493 | INT32 imm, res; |
| 2618 | 2494 | INT64 tmp; |
| r1334 | r1335 | |
| 2636 | 2512 | SET_Z( res == 0 ? 1 : 0 ); |
| 2637 | 2513 | SET_N( SIGN_BIT(res) ); |
| 2638 | 2514 | |
| 2639 | | hyperstone_ICount -= 1; |
| 2515 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2640 | 2516 | |
| 2641 | 2517 | if( GET_V ) |
| 2642 | 2518 | { |
| r1334 | r1335 | |
| 2645 | 2521 | } |
| 2646 | 2522 | } |
| 2647 | 2523 | |
| 2648 | | static void hyperstone_cmpbi(void) |
| 2524 | INLINE void hyperstone_cmpbi(struct regs_decode *decode) |
| 2649 | 2525 | { |
| 2650 | 2526 | UINT32 imm; |
| 2651 | 2527 | |
| r1334 | r1335 | |
| 2671 | 2547 | SET_Z(0); |
| 2672 | 2548 | } |
| 2673 | 2549 | |
| 2674 | | hyperstone_ICount -= 1; |
| 2550 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2675 | 2551 | } |
| 2676 | 2552 | |
| 2677 | | static void hyperstone_andni(void) |
| 2553 | INLINE void hyperstone_andni(struct regs_decode *decode) |
| 2678 | 2554 | { |
| 2679 | 2555 | UINT32 imm; |
| 2680 | 2556 | |
| r1334 | r1335 | |
| 2688 | 2564 | SET_DREG(DREG); |
| 2689 | 2565 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2690 | 2566 | |
| 2691 | | hyperstone_ICount -= 1; |
| 2567 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2692 | 2568 | } |
| 2693 | 2569 | |
| 2694 | | static void hyperstone_ori(void) |
| 2570 | INLINE void hyperstone_ori(struct regs_decode *decode) |
| 2695 | 2571 | { |
| 2696 | 2572 | DREG = DREG | EXTRA_U; |
| 2697 | 2573 | |
| 2698 | 2574 | SET_DREG(DREG); |
| 2699 | 2575 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2700 | 2576 | |
| 2701 | | hyperstone_ICount -= 1; |
| 2577 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2702 | 2578 | } |
| 2703 | 2579 | |
| 2704 | | static void hyperstone_xori(void) |
| 2580 | INLINE void hyperstone_xori(struct regs_decode *decode) |
| 2705 | 2581 | { |
| 2706 | 2582 | DREG = DREG ^ EXTRA_U; |
| 2707 | 2583 | |
| 2708 | 2584 | SET_DREG(DREG); |
| 2709 | 2585 | SET_Z( DREG == 0 ? 1 : 0 ); |
| 2710 | 2586 | |
| 2711 | | hyperstone_ICount -= 1; |
| 2587 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2712 | 2588 | } |
| 2713 | 2589 | |
| 2714 | | static void hyperstone_shrdi(void) |
| 2590 | INLINE void hyperstone_shrdi(struct regs_decode *decode) |
| 2715 | 2591 | { |
| 2716 | 2592 | UINT32 low_order, high_order; |
| 2717 | 2593 | UINT64 val; |
| r1334 | r1335 | |
| 2736 | 2612 | SET_Z( val == 0 ? 1 : 0 ); |
| 2737 | 2613 | SET_N( SIGN_BIT(high_order) ); |
| 2738 | 2614 | |
| 2739 | | hyperstone_ICount -= 2; |
| 2615 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 2740 | 2616 | } |
| 2741 | 2617 | |
| 2742 | | static void hyperstone_shrd(void) |
| 2618 | INLINE void hyperstone_shrd(struct regs_decode *decode) |
| 2743 | 2619 | { |
| 2744 | 2620 | UINT32 low_order, high_order; |
| 2745 | 2621 | UINT64 val; |
| r1334 | r1335 | |
| 2748 | 2624 | // result undefined if Ls denotes the same register as Ld or Ldf |
| 2749 | 2625 | if( SAME_SRC_DST || SAME_SRC_DSTF ) |
| 2750 | 2626 | { |
| 2751 | | logerror("Denoted same registers in hyperstone_shrd. PC = %08X\n", PC); |
| 2627 | DEBUG_PRINTF(("Denoted same registers in hyperstone_shrd. PC = %08X\n", PC)); |
| 2752 | 2628 | } |
| 2753 | 2629 | else |
| 2754 | 2630 | { |
| r1334 | r1335 | |
| 2774 | 2650 | SET_N( SIGN_BIT(high_order) ); |
| 2775 | 2651 | } |
| 2776 | 2652 | |
| 2777 | | hyperstone_ICount -= 2; |
| 2653 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 2778 | 2654 | } |
| 2779 | 2655 | |
| 2780 | | static void hyperstone_shr(void) |
| 2656 | INLINE void hyperstone_shr(struct regs_decode *decode) |
| 2781 | 2657 | { |
| 2782 | 2658 | UINT32 ret; |
| 2783 | 2659 | UINT8 n; |
| r1334 | r1335 | |
| 2796 | 2672 | SET_Z( ret == 0 ? 1 : 0 ); |
| 2797 | 2673 | SET_N( SIGN_BIT(ret) ); |
| 2798 | 2674 | |
| 2799 | | hyperstone_ICount -= 1; |
| 2675 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2800 | 2676 | } |
| 2801 | 2677 | |
| 2802 | | static void hyperstone_sardi(void) |
| 2678 | INLINE void hyperstone_sardi(struct regs_decode *decode) |
| 2803 | 2679 | { |
| 2804 | 2680 | UINT32 low_order, high_order; |
| 2805 | 2681 | UINT64 val; |
| r1334 | r1335 | |
| 2836 | 2712 | SET_Z( val == 0 ? 1 : 0 ); |
| 2837 | 2713 | SET_N( SIGN_BIT(high_order) ); |
| 2838 | 2714 | |
| 2839 | | hyperstone_ICount -= 2; |
| 2715 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 2840 | 2716 | } |
| 2841 | 2717 | |
| 2842 | | static void hyperstone_sard(void) |
| 2718 | INLINE void hyperstone_sard(struct regs_decode *decode) |
| 2843 | 2719 | { |
| 2844 | 2720 | UINT32 low_order, high_order; |
| 2845 | 2721 | UINT64 val; |
| r1334 | r1335 | |
| 2850 | 2726 | // result undefined if Ls denotes the same register as Ld or Ldf |
| 2851 | 2727 | if( SAME_SRC_DST || SAME_SRC_DSTF ) |
| 2852 | 2728 | { |
| 2853 | | logerror("Denoted same registers in hyperstone_sard. PC = %08X\n", PC); |
| 2729 | DEBUG_PRINTF(("Denoted same registers in hyperstone_sard. PC = %08X\n", PC)); |
| 2854 | 2730 | } |
| 2855 | 2731 | else |
| 2856 | 2732 | { |
| r1334 | r1335 | |
| 2886 | 2762 | SET_N( SIGN_BIT(high_order) ); |
| 2887 | 2763 | } |
| 2888 | 2764 | |
| 2889 | | hyperstone_ICount -= 2; |
| 2765 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 2890 | 2766 | } |
| 2891 | 2767 | |
| 2892 | | static void hyperstone_sar(void) |
| 2768 | INLINE void hyperstone_sar(struct regs_decode *decode) |
| 2893 | 2769 | { |
| 2894 | 2770 | UINT32 ret; |
| 2895 | 2771 | UINT8 n, sign_bit; |
| r1334 | r1335 | |
| 2918 | 2794 | SET_Z( ret == 0 ? 1 : 0 ); |
| 2919 | 2795 | SET_N( SIGN_BIT(ret) ); |
| 2920 | 2796 | |
| 2921 | | hyperstone_ICount -= 1; |
| 2797 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 2922 | 2798 | } |
| 2923 | 2799 | |
| 2924 | | static void hyperstone_shldi(void) |
| 2800 | INLINE void hyperstone_shldi(struct regs_decode *decode) |
| 2925 | 2801 | { |
| 2926 | 2802 | UINT32 low_order, high_order, tmp; |
| 2927 | 2803 | UINT64 val, mask; |
| r1334 | r1335 | |
| 2951 | 2827 | SET_Z( val == 0 ? 1 : 0 ); |
| 2952 | 2828 | SET_N( SIGN_BIT(high_order) ); |
| 2953 | 2829 | |
| 2954 | | hyperstone_ICount -= 2; |
| 2830 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 2955 | 2831 | } |
| 2956 | 2832 | |
| 2957 | | static void hyperstone_shld(void) |
| 2833 | INLINE void hyperstone_shld(struct regs_decode *decode) |
| 2958 | 2834 | { |
| 2959 | 2835 | UINT32 low_order, high_order, tmp, n; |
| 2960 | 2836 | UINT64 val, mask; |
| r1334 | r1335 | |
| 2964 | 2840 | // result undefined if Ls denotes the same register as Ld or Ldf |
| 2965 | 2841 | if( SAME_SRC_DST || SAME_SRC_DSTF ) |
| 2966 | 2842 | { |
| 2967 | | logerror("Denoted same registers in hyperstone_shld. PC = %08X\n", PC); |
| 2843 | DEBUG_PRINTF(("Denoted same registers in hyperstone_shld. PC = %08X\n", PC)); |
| 2968 | 2844 | } |
| 2969 | 2845 | else |
| 2970 | 2846 | { |
| r1334 | r1335 | |
| 2995 | 2871 | SET_N( SIGN_BIT(high_order) ); |
| 2996 | 2872 | } |
| 2997 | 2873 | |
| 2998 | | hyperstone_ICount -= 2; |
| 2874 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 2999 | 2875 | } |
| 3000 | 2876 | |
| 3001 | | static void hyperstone_shl(void) |
| 2877 | INLINE void hyperstone_shl(struct regs_decode *decode) |
| 3002 | 2878 | { |
| 3003 | 2879 | UINT32 base, ret, n; |
| 3004 | 2880 | UINT64 mask; |
| r1334 | r1335 | |
| 3019 | 2895 | SET_Z( ret == 0 ? 1 : 0 ); |
| 3020 | 2896 | SET_N( SIGN_BIT(ret) ); |
| 3021 | 2897 | |
| 3022 | | hyperstone_ICount -= 1; |
| 2898 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 3023 | 2899 | } |
| 3024 | 2900 | |
| 3025 | | static void reserved(void) |
| 2901 | static void reserved(struct regs_decode *decode) |
| 3026 | 2902 | { |
| 3027 | | logerror("Executed Reserved opcode. PC = %08X OP = %04X\n", PC, OP); |
| 2903 | DEBUG_PRINTF(("Executed Reserved opcode. PC = %08X OP = %04X\n", PC, OP)); |
| 3028 | 2904 | } |
| 3029 | 2905 | |
| 3030 | | static void hyperstone_testlz(void) |
| 2906 | INLINE void hyperstone_testlz(struct regs_decode *decode) |
| 3031 | 2907 | { |
| 3032 | 2908 | UINT8 zeros = 0; |
| 3033 | 2909 | UINT32 mask; |
| r1334 | r1335 | |
| 3045 | 2921 | |
| 3046 | 2922 | SET_DREG(zeros); |
| 3047 | 2923 | |
| 3048 | | hyperstone_ICount -= 2; |
| 2924 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 3049 | 2925 | } |
| 3050 | 2926 | |
| 3051 | | static void hyperstone_rol(void) |
| 2927 | INLINE void hyperstone_rol(struct regs_decode *decode) |
| 3052 | 2928 | { |
| 3053 | 2929 | UINT32 val, base; |
| 3054 | 2930 | UINT8 n; |
| r1334 | r1335 | |
| 3081 | 2957 | SET_Z( val == 0 ? 1 : 0 ); |
| 3082 | 2958 | SET_N( SIGN_BIT(val) ); |
| 3083 | 2959 | |
| 3084 | | hyperstone_ICount -= 1; |
| 2960 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 3085 | 2961 | } |
| 3086 | 2962 | |
| 3087 | 2963 | //TODO: add trap error |
| 3088 | | static void hyperstone_ldxx1(void) |
| 2964 | INLINE void hyperstone_ldxx1(struct regs_decode *decode) |
| 3089 | 2965 | { |
| 3090 | 2966 | UINT32 load; |
| 3091 | 2967 | |
| 3092 | 2968 | if( DST_IS_SR ) |
| 3093 | 2969 | { |
| 3094 | | switch( current_regs.sub_type ) |
| 2970 | switch( decode->sub_type ) |
| 3095 | 2971 | { |
| 3096 | 2972 | case 0: // LDBS.A |
| 3097 | 2973 | |
| r1334 | r1335 | |
| 3137 | 3013 | load = IO_READ_W((EXTRA_S & ~3) + 4); |
| 3138 | 3014 | SET_SREGF(load); |
| 3139 | 3015 | |
| 3140 | | hyperstone_ICount -= 1; // extra cycle |
| 3016 | hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle |
| 3141 | 3017 | } |
| 3142 | 3018 | else if( (EXTRA_S & 3) == 2 ) // LDW.IOA |
| 3143 | 3019 | { |
| r1334 | r1335 | |
| 3152 | 3028 | load = READ_W((EXTRA_S & ~1) + 4); |
| 3153 | 3029 | SET_SREGF(load); |
| 3154 | 3030 | |
| 3155 | | hyperstone_ICount -= 1; // extra cycle |
| 3031 | hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle |
| 3156 | 3032 | } |
| 3157 | 3033 | else // LDW.A |
| 3158 | 3034 | { |
| r1334 | r1335 | |
| 3165 | 3041 | } |
| 3166 | 3042 | else |
| 3167 | 3043 | { |
| 3168 | | switch( current_regs.sub_type ) |
| 3044 | switch( decode->sub_type ) |
| 3169 | 3045 | { |
| 3170 | 3046 | case 0: // LDBS.D |
| 3171 | 3047 | |
| r1334 | r1335 | |
| 3211 | 3087 | load = IO_READ_W(DREG + (EXTRA_S & ~3) + 4); |
| 3212 | 3088 | SET_SREGF(load); |
| 3213 | 3089 | |
| 3214 | | hyperstone_ICount -= 1; // extra cycle |
| 3090 | hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle |
| 3215 | 3091 | } |
| 3216 | 3092 | else if( (EXTRA_S & 3) == 2 ) // LDW.IOD |
| 3217 | 3093 | { |
| r1334 | r1335 | |
| 3226 | 3102 | load = READ_W(DREG + (EXTRA_S & ~1) + 4); |
| 3227 | 3103 | SET_SREGF(load); |
| 3228 | 3104 | |
| 3229 | | hyperstone_ICount -= 1; // extra cycle |
| 3105 | hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle |
| 3230 | 3106 | } |
| 3231 | 3107 | else // LDW.D |
| 3232 | 3108 | { |
| r1334 | r1335 | |
| 3238 | 3114 | } |
| 3239 | 3115 | } |
| 3240 | 3116 | |
| 3241 | | hyperstone_ICount -= 1; |
| 3117 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 3242 | 3118 | } |
| 3243 | 3119 | |
| 3244 | | static void hyperstone_ldxx2(void) |
| 3120 | INLINE void hyperstone_ldxx2(struct regs_decode *decode) |
| 3245 | 3121 | { |
| 3246 | 3122 | UINT32 load; |
| 3247 | 3123 | |
| 3248 | 3124 | if( DST_IS_PC || DST_IS_SR ) |
| 3249 | 3125 | { |
| 3250 | | logerror("Denoted PC or SR in hyperstone_ldxx2. PC = %08X\n", PC); |
| 3126 | DEBUG_PRINTF(("Denoted PC or SR in hyperstone_ldxx2. PC = %08X\n", PC)); |
| 3251 | 3127 | } |
| 3252 | 3128 | else |
| 3253 | 3129 | { |
| 3254 | | switch( current_regs.sub_type ) |
| 3130 | switch( decode->sub_type ) |
| 3255 | 3131 | { |
| 3256 | 3132 | case 0: // LDBS.N |
| 3257 | 3133 | |
| 3258 | 3134 | if(SAME_SRC_DST) |
| 3259 | | popmessage("LDBS.N denoted same regs @ %08X",PPC); |
| 3135 | DEBUG_PRINTF(("LDBS.N denoted same regs @ %08X",PPC)); |
| 3260 | 3136 | |
| 3261 | 3137 | load = READ_B(DREG); |
| 3262 | 3138 | load |= (load & 0x80) ? 0xffffff00 : 0; |
| r1334 | r1335 | |
| 3270 | 3146 | case 1: // LDBU.N |
| 3271 | 3147 | |
| 3272 | 3148 | if(SAME_SRC_DST) |
| 3273 | | popmessage("LDBU.N denoted same regs @ %08X",PPC); |
| 3149 | DEBUG_PRINTF(("LDBU.N denoted same regs @ %08X",PPC)); |
| 3274 | 3150 | |
| 3275 | 3151 | load = READ_B(DREG); |
| 3276 | 3152 | SET_SREG(load); |
| r1334 | r1335 | |
| 3289 | 3165 | load |= (load & 0x8000) ? 0xffff0000 : 0; |
| 3290 | 3166 | |
| 3291 | 3167 | if(SAME_SRC_DST) |
| 3292 | | popmessage("LDHS.N denoted same regs @ %08X",PPC); |
| 3168 | DEBUG_PRINTF(("LDHS.N denoted same regs @ %08X",PPC)); |
| 3293 | 3169 | } |
| 3294 | 3170 | /* |
| 3295 | 3171 | else // LDHU.N |
| r1334 | r1335 | |
| 3310 | 3186 | if( (EXTRA_S & 3) == 3 ) // LDW.S |
| 3311 | 3187 | { |
| 3312 | 3188 | if(SAME_SRC_DST) |
| 3313 | | popmessage("LDW.S denoted same regs @ %08X",PPC); |
| 3189 | DEBUG_PRINTF(("LDW.S denoted same regs @ %08X",PPC)); |
| 3314 | 3190 | |
| 3315 | 3191 | if(DREG < SP) |
| 3316 | 3192 | SET_SREG(READ_W(DREG)); |
| r1334 | r1335 | |
| 3320 | 3196 | if(!SAME_SRC_DST) |
| 3321 | 3197 | SET_DREG(DREG + (EXTRA_S & ~3)); |
| 3322 | 3198 | |
| 3323 | | hyperstone_ICount -= 2; // extra cycles |
| 3199 | hyperstone_ICount -= hyperstone.clock_cycles_2; // extra cycles |
| 3324 | 3200 | } |
| 3325 | 3201 | else if( (EXTRA_S & 3) == 2 ) // Reserved |
| 3326 | 3202 | { |
| 3327 | | logerror("Executed Reserved instruction in hyperstone_ldxx2. PC = %08X\n", PC); |
| 3203 | DEBUG_PRINTF(("Executed Reserved instruction in hyperstone_ldxx2. PC = %08X\n", PC)); |
| 3328 | 3204 | } |
| 3329 | 3205 | else if( (EXTRA_S & 3) == 1 ) // LDD.N |
| 3330 | 3206 | { |
| 3331 | 3207 | if(SAME_SRC_DST || SAME_SRCF_DST) |
| 3332 | | popmessage("LDD.N denoted same regs @ %08X",PPC); |
| 3208 | DEBUG_PRINTF(("LDD.N denoted same regs @ %08X",PPC)); |
| 3333 | 3209 | |
| 3334 | 3210 | load = READ_W(DREG); |
| 3335 | 3211 | SET_SREG(load); |
| r1334 | r1335 | |
| 3340 | 3216 | if(!SAME_SRC_DST && !SAME_SRCF_DST) |
| 3341 | 3217 | SET_DREG(DREG + (EXTRA_S & ~1)); |
| 3342 | 3218 | |
| 3343 | | hyperstone_ICount -= 1; // extra cycle |
| 3219 | hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle |
| 3344 | 3220 | } |
| 3345 | 3221 | else // LDW.N |
| 3346 | 3222 | { |
| 3347 | 3223 | if(SAME_SRC_DST) |
| 3348 | | popmessage("LDW.N denoted same regs @ %08X",PPC); |
| 3224 | DEBUG_PRINTF(("LDW.N denoted same regs @ %08X",PPC)); |
| 3349 | 3225 | |
| 3350 | 3226 | load = READ_W(DREG); |
| 3351 | 3227 | SET_SREG(load); |
| r1334 | r1335 | |
| 3358 | 3234 | } |
| 3359 | 3235 | } |
| 3360 | 3236 | |
| 3361 | | hyperstone_ICount -= 1; |
| 3237 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 3362 | 3238 | } |
| 3363 | 3239 | |
| 3364 | 3240 | //TODO: add trap error |
| 3365 | | static void hyperstone_stxx1(void) |
| 3241 | INLINE void hyperstone_stxx1(struct regs_decode *decode) |
| 3366 | 3242 | { |
| 3367 | 3243 | if( SRC_IS_SR ) |
| 3368 | 3244 | SREG = SREGF = 0; |
| 3369 | 3245 | |
| 3370 | 3246 | if( DST_IS_SR ) |
| 3371 | 3247 | { |
| 3372 | | switch( current_regs.sub_type ) |
| 3248 | switch( decode->sub_type ) |
| 3373 | 3249 | { |
| 3374 | 3250 | case 0: // STBS.A |
| 3375 | 3251 | |
| r1334 | r1335 | |
| 3408 | 3284 | IO_WRITE_W(EXTRA_S & ~3, SREG); |
| 3409 | 3285 | IO_WRITE_W((EXTRA_S & ~3) + 4, SREGF); |
| 3410 | 3286 | |
| 3411 | | hyperstone_ICount -= 1; // extra cycle |
| 3287 | hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle |
| 3412 | 3288 | } |
| 3413 | 3289 | else if( (EXTRA_S & 3) == 2 ) // STW.IOA |
| 3414 | 3290 | { |
| r1334 | r1335 | |
| 3419 | 3295 | WRITE_W(EXTRA_S & ~1, SREG); |
| 3420 | 3296 | WRITE_W((EXTRA_S & ~1) + 4, SREGF); |
| 3421 | 3297 | |
| 3422 | | hyperstone_ICount -= 1; // extra cycle |
| 3298 | hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle |
| 3423 | 3299 | } |
| 3424 | 3300 | else // STW.A |
| 3425 | 3301 | { |
| r1334 | r1335 | |
| 3431 | 3307 | } |
| 3432 | 3308 | else |
| 3433 | 3309 | { |
| 3434 | | switch( current_regs.sub_type ) |
| 3310 | switch( decode->sub_type ) |
| 3435 | 3311 | { |
| 3436 | 3312 | case 0: // STBS.D |
| 3437 | 3313 | |
| r1334 | r1335 | |
| 3470 | 3346 | IO_WRITE_W(DREG + (EXTRA_S & ~3), SREG); |
| 3471 | 3347 | IO_WRITE_W(DREG + (EXTRA_S & ~3) + 4, SREGF); |
| 3472 | 3348 | |
| 3473 | | hyperstone_ICount -= 1; // extra cycle |
| 3349 | hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle |
| 3474 | 3350 | } |
| 3475 | 3351 | else if( (EXTRA_S & 3) == 2 ) // STW.IOD |
| 3476 | 3352 | { |
| r1334 | r1335 | |
| 3481 | 3357 | WRITE_W(DREG + (EXTRA_S & ~1), SREG); |
| 3482 | 3358 | WRITE_W(DREG + (EXTRA_S & ~1) + 4, SREGF); |
| 3483 | 3359 | |
| 3484 | | hyperstone_ICount -= 1; // extra cycle |
| 3360 | hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle |
| 3485 | 3361 | } |
| 3486 | 3362 | else // STW.D |
| 3487 | 3363 | { |
| r1334 | r1335 | |
| 3492 | 3368 | } |
| 3493 | 3369 | } |
| 3494 | 3370 | |
| 3495 | | hyperstone_ICount -= 1; |
| 3371 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 3496 | 3372 | } |
| 3497 | 3373 | |
| 3498 | | static void hyperstone_stxx2(void) |
| 3374 | INLINE void hyperstone_stxx2(struct regs_decode *decode) |
| 3499 | 3375 | { |
| 3500 | 3376 | if( SRC_IS_SR ) |
| 3501 | 3377 | SREG = SREGF = 0; |
| 3502 | 3378 | |
| 3503 | 3379 | if( DST_IS_PC || DST_IS_SR ) |
| 3504 | 3380 | { |
| 3505 | | logerror("Denoted PC or SR in hyperstone_stxx2. PC = %08X\n", PC); |
| 3381 | DEBUG_PRINTF(("Denoted PC or SR in hyperstone_stxx2. PC = %08X\n", PC)); |
| 3506 | 3382 | } |
| 3507 | 3383 | else |
| 3508 | 3384 | { |
| 3509 | | switch( current_regs.sub_type ) |
| 3385 | switch( decode->sub_type ) |
| 3510 | 3386 | { |
| 3511 | 3387 | case 0: // STBS.N |
| 3512 | 3388 | |
| r1334 | r1335 | |
| 3549 | 3425 | WRITE_W(DREG, SREG); |
| 3550 | 3426 | else |
| 3551 | 3427 | { |
| 3552 | | if(((DREG & 0xfc) >> 2) == ((current_regs.src + GET_FP) % 64) && S_BIT == LOCAL) |
| 3553 | | popmessage("STW.S denoted the same local register @ %08X\n",PPC); |
| 3428 | if(((DREG & 0xfc) >> 2) == ((decode->src + GET_FP) % 64) && S_BIT == LOCAL) |
| 3429 | DEBUG_PRINTF(("STW.S denoted the same local register @ %08X\n",PPC)); |
| 3554 | 3430 | |
| 3555 | 3431 | SET_ABS_L_REG((DREG & 0xfc) >> 2,SREG); |
| 3556 | 3432 | } |
| 3557 | 3433 | |
| 3558 | 3434 | SET_DREG(DREG + (EXTRA_S & ~3)); |
| 3559 | 3435 | |
| 3560 | | hyperstone_ICount -= 2; // extra cycles |
| 3436 | hyperstone_ICount -= hyperstone.clock_cycles_2; // extra cycles |
| 3561 | 3437 | |
| 3562 | 3438 | } |
| 3563 | 3439 | else if( (EXTRA_S & 3) == 2 ) // Reserved |
| 3564 | 3440 | { |
| 3565 | | logerror("Executed Reserved instruction in hyperstone_stxx2. PC = %08X\n", PC); |
| 3441 | DEBUG_PRINTF(("Executed Reserved instruction in hyperstone_stxx2. PC = %08X\n", PC)); |
| 3566 | 3442 | } |
| 3567 | 3443 | else if( (EXTRA_S & 3) == 1 ) // STD.N |
| 3568 | 3444 | { |
| r1334 | r1335 | |
| 3574 | 3450 | else |
| 3575 | 3451 | WRITE_W(DREG + 4, SREGF); |
| 3576 | 3452 | |
| 3577 | | hyperstone_ICount -= 1; // extra cycle |
| 3453 | hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle |
| 3578 | 3454 | } |
| 3579 | 3455 | else // STW.N |
| 3580 | 3456 | { |
| r1334 | r1335 | |
| 3586 | 3462 | } |
| 3587 | 3463 | } |
| 3588 | 3464 | |
| 3589 | | hyperstone_ICount -= 1; |
| 3465 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 3590 | 3466 | } |
| 3591 | 3467 | |
| 3592 | | static void hyperstone_shri(void) |
| 3468 | INLINE void hyperstone_shri(struct regs_decode *decode) |
| 3593 | 3469 | { |
| 3594 | 3470 | UINT32 val; |
| 3595 | 3471 | |
| r1334 | r1335 | |
| 3606 | 3482 | SET_Z( val == 0 ? 1 : 0 ); |
| 3607 | 3483 | SET_N( SIGN_BIT(val) ); |
| 3608 | 3484 | |
| 3609 | | hyperstone_ICount -= 1; |
| 3485 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 3610 | 3486 | } |
| 3611 | 3487 | |
| 3612 | | static void hyperstone_sari(void) |
| 3488 | INLINE void hyperstone_sari(struct regs_decode *decode) |
| 3613 | 3489 | { |
| 3614 | 3490 | UINT32 val; |
| 3615 | 3491 | UINT8 sign_bit; |
| r1334 | r1335 | |
| 3637 | 3513 | SET_Z( val == 0 ? 1 : 0 ); |
| 3638 | 3514 | SET_N( SIGN_BIT(val) ); |
| 3639 | 3515 | |
| 3640 | | hyperstone_ICount -= 1; |
| 3516 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 3641 | 3517 | } |
| 3642 | 3518 | |
| 3643 | | static void hyperstone_shli(void) |
| 3519 | INLINE void hyperstone_shli(struct regs_decode *decode) |
| 3644 | 3520 | { |
| 3645 | 3521 | UINT32 val, val2; |
| 3646 | 3522 | UINT64 mask; |
| r1334 | r1335 | |
| 3660 | 3536 | SET_Z( val2 == 0 ? 1 : 0 ); |
| 3661 | 3537 | SET_N( SIGN_BIT(val2) ); |
| 3662 | 3538 | |
| 3663 | | hyperstone_ICount -= 1; |
| 3539 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 3664 | 3540 | } |
| 3665 | 3541 | |
| 3666 | | static void hyperstone_mulu(void) |
| 3542 | INLINE void hyperstone_mulu(struct regs_decode *decode) |
| 3667 | 3543 | { |
| 3668 | 3544 | UINT32 low_order, high_order; |
| 3669 | 3545 | UINT64 double_word; |
| r1334 | r1335 | |
| 3671 | 3547 | // PC or SR aren't denoted, else result is undefined |
| 3672 | 3548 | if( SRC_IS_PC || SRC_IS_SR || DST_IS_PC || DST_IS_SR ) |
| 3673 | 3549 | { |
| 3674 | | logerror("Denoted PC or SR in hyperstone_mulu instruction. PC = %08X\n", PC); |
| 3550 | DEBUG_PRINTF(("Denoted PC or SR in hyperstone_mulu instruction. PC = %08X\n", PC)); |
| 3675 | 3551 | } |
| 3676 | 3552 | else |
| 3677 | 3553 | { |
| r1334 | r1335 | |
| 3688 | 3564 | } |
| 3689 | 3565 | |
| 3690 | 3566 | if(SREG <= 0xffff && DREG <= 0xffff) |
| 3691 | | hyperstone_ICount -= 4; |
| 3567 | hyperstone_ICount -= hyperstone.clock_cycles_4; |
| 3692 | 3568 | else |
| 3693 | | hyperstone_ICount -= 6; |
| 3569 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 3694 | 3570 | } |
| 3695 | 3571 | |
| 3696 | | static void hyperstone_muls(void) |
| 3572 | INLINE void hyperstone_muls(struct regs_decode *decode) |
| 3697 | 3573 | { |
| 3698 | 3574 | UINT32 low_order, high_order; |
| 3699 | 3575 | INT64 double_word; |
| r1334 | r1335 | |
| 3701 | 3577 | // PC or SR aren't denoted, else result is undefined |
| 3702 | 3578 | if( SRC_IS_PC || SRC_IS_SR || DST_IS_PC || DST_IS_SR ) |
| 3703 | 3579 | { |
| 3704 | | logerror("Denoted PC or SR in hyperstone_muls instruction. PC = %08X\n", PC); |
| 3580 | DEBUG_PRINTF(("Denoted PC or SR in hyperstone_muls instruction. PC = %08X\n", PC)); |
| 3705 | 3581 | } |
| 3706 | 3582 | else |
| 3707 | 3583 | { |
| r1334 | r1335 | |
| 3717 | 3593 | } |
| 3718 | 3594 | |
| 3719 | 3595 | if((SREG >= 0xffff8000 && SREG <= 0x7fff) && (DREG >= 0xffff8000 && DREG <= 0x7fff)) |
| 3720 | | hyperstone_ICount -= 4; |
| 3596 | hyperstone_ICount -= hyperstone.clock_cycles_4; |
| 3721 | 3597 | else |
| 3722 | | hyperstone_ICount -= 6; |
| 3598 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 3723 | 3599 | } |
| 3724 | 3600 | |
| 3725 | | static void hyperstone_set(void) |
| 3601 | INLINE void hyperstone_set(struct regs_decode *decode) |
| 3726 | 3602 | { |
| 3727 | 3603 | int n = N_VALUE; |
| 3728 | 3604 | |
| 3729 | 3605 | if( DST_IS_PC ) |
| 3730 | 3606 | { |
| 3731 | | logerror("Denoted PC in hyperstone_set. PC = %08X\n", PC); |
| 3607 | DEBUG_PRINTF(("Denoted PC in hyperstone_set. PC = %08X\n", PC)); |
| 3732 | 3608 | } |
| 3733 | 3609 | else if( DST_IS_SR ) |
| 3734 | 3610 | { |
| 3735 | 3611 | //TODO: add fetch opcode when there's the pipeline |
| 3736 | 3612 | |
| 3737 | 3613 | //TODO: no 1! |
| 3738 | | hyperstone_ICount -= 1; |
| 3614 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 3739 | 3615 | } |
| 3740 | 3616 | else |
| 3741 | 3617 | { |
| r1334 | r1335 | |
| 3759 | 3635 | case 16: |
| 3760 | 3636 | case 17: |
| 3761 | 3637 | case 19: |
| 3762 | | logerror("Used reserved N value (%d) in hyperstone_set. PC = %08X\n", n, PC); |
| 3638 | DEBUG_PRINTF(("Used reserved N value (%d) in hyperstone_set. PC = %08X\n", n, PC)); |
| 3763 | 3639 | break; |
| 3764 | 3640 | |
| 3765 | 3641 | // SETxx |
| r1334 | r1335 | |
| 4064 | 3940 | break; |
| 4065 | 3941 | } |
| 4066 | 3942 | |
| 4067 | | hyperstone_ICount -= 1; |
| 3943 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4068 | 3944 | } |
| 4069 | 3945 | } |
| 4070 | 3946 | |
| 4071 | | static void hyperstone_mul(void) |
| 3947 | INLINE void hyperstone_mul(struct regs_decode *decode) |
| 4072 | 3948 | { |
| 4073 | 3949 | UINT32 single_word; |
| 4074 | 3950 | |
| 4075 | 3951 | // PC or SR aren't denoted, else result is undefined |
| 4076 | 3952 | if( SRC_IS_PC || SRC_IS_SR || DST_IS_PC || DST_IS_SR ) |
| 4077 | 3953 | { |
| 4078 | | logerror("Denoted PC or SR in hyperstone_mul instruction. PC = %08X\n", PC); |
| 3954 | DEBUG_PRINTF(("Denoted PC or SR in hyperstone_mul instruction. PC = %08X\n", PC)); |
| 4079 | 3955 | } |
| 4080 | 3956 | else |
| 4081 | 3957 | { |
| r1334 | r1335 | |
| 4088 | 3964 | } |
| 4089 | 3965 | |
| 4090 | 3966 | if((SREG >= 0xffff8000 && SREG <= 0x7fff) && (DREG >= 0xffff8000 && DREG <= 0x7fff)) |
| 4091 | | hyperstone_ICount -= 3; |
| 3967 | hyperstone_ICount -= 3 << hyperstone.clock_scale; |
| 4092 | 3968 | else |
| 4093 | | hyperstone_ICount -= 5; |
| 3969 | hyperstone_ICount -= 5 << hyperstone.clock_scale; |
| 4094 | 3970 | } |
| 4095 | 3971 | |
| 4096 | | static void hyperstone_fadd(void) |
| 3972 | INLINE void hyperstone_fadd(struct regs_decode *decode) |
| 4097 | 3973 | { |
| 4098 | | execute_software(); |
| 4099 | | hyperstone_ICount -= 6; |
| 3974 | execute_software(decode); |
| 3975 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4100 | 3976 | } |
| 4101 | 3977 | |
| 4102 | | static void hyperstone_faddd(void) |
| 3978 | INLINE void hyperstone_faddd(struct regs_decode *decode) |
| 4103 | 3979 | { |
| 4104 | | execute_software(); |
| 4105 | | hyperstone_ICount -= 6; |
| 3980 | execute_software(decode); |
| 3981 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4106 | 3982 | } |
| 4107 | 3983 | |
| 4108 | | static void hyperstone_fsub(void) |
| 3984 | INLINE void hyperstone_fsub(struct regs_decode *decode) |
| 4109 | 3985 | { |
| 4110 | | execute_software(); |
| 4111 | | hyperstone_ICount -= 6; |
| 3986 | execute_software(decode); |
| 3987 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4112 | 3988 | } |
| 4113 | 3989 | |
| 4114 | | static void hyperstone_fsubd(void) |
| 3990 | INLINE void hyperstone_fsubd(struct regs_decode *decode) |
| 4115 | 3991 | { |
| 4116 | | execute_software(); |
| 4117 | | hyperstone_ICount -= 6; |
| 3992 | execute_software(decode); |
| 3993 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4118 | 3994 | } |
| 4119 | 3995 | |
| 4120 | | static void hyperstone_fmul(void) |
| 3996 | INLINE void hyperstone_fmul(struct regs_decode *decode) |
| 4121 | 3997 | { |
| 4122 | | execute_software(); |
| 4123 | | hyperstone_ICount -= 6; |
| 3998 | execute_software(decode); |
| 3999 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4124 | 4000 | } |
| 4125 | 4001 | |
| 4126 | | static void hyperstone_fmuld(void) |
| 4002 | INLINE void hyperstone_fmuld(struct regs_decode *decode) |
| 4127 | 4003 | { |
| 4128 | | execute_software(); |
| 4129 | | hyperstone_ICount -= 6; |
| 4004 | execute_software(decode); |
| 4005 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4130 | 4006 | } |
| 4131 | 4007 | |
| 4132 | | static void hyperstone_fdiv(void) |
| 4008 | INLINE void hyperstone_fdiv(struct regs_decode *decode) |
| 4133 | 4009 | { |
| 4134 | | execute_software(); |
| 4135 | | hyperstone_ICount -= 6; |
| 4010 | execute_software(decode); |
| 4011 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4136 | 4012 | } |
| 4137 | 4013 | |
| 4138 | | static void hyperstone_fdivd(void) |
| 4014 | INLINE void hyperstone_fdivd(struct regs_decode *decode) |
| 4139 | 4015 | { |
| 4140 | | execute_software(); |
| 4141 | | hyperstone_ICount -= 6; |
| 4016 | execute_software(decode); |
| 4017 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4142 | 4018 | } |
| 4143 | 4019 | |
| 4144 | | static void hyperstone_fcmp(void) |
| 4020 | INLINE void hyperstone_fcmp(struct regs_decode *decode) |
| 4145 | 4021 | { |
| 4146 | | execute_software(); |
| 4147 | | hyperstone_ICount -= 6; |
| 4022 | execute_software(decode); |
| 4023 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4148 | 4024 | } |
| 4149 | 4025 | |
| 4150 | | static void hyperstone_fcmpd(void) |
| 4026 | INLINE void hyperstone_fcmpd(struct regs_decode *decode) |
| 4151 | 4027 | { |
| 4152 | | execute_software(); |
| 4153 | | hyperstone_ICount -= 6; |
| 4028 | execute_software(decode); |
| 4029 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4154 | 4030 | } |
| 4155 | 4031 | |
| 4156 | | static void hyperstone_fcmpu(void) |
| 4032 | INLINE void hyperstone_fcmpu(struct regs_decode *decode) |
| 4157 | 4033 | { |
| 4158 | | execute_software(); |
| 4159 | | hyperstone_ICount -= 6; |
| 4034 | execute_software(decode); |
| 4035 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4160 | 4036 | } |
| 4161 | 4037 | |
| 4162 | | static void hyperstone_fcmpud(void) |
| 4038 | INLINE void hyperstone_fcmpud(struct regs_decode *decode) |
| 4163 | 4039 | { |
| 4164 | | execute_software(); |
| 4165 | | hyperstone_ICount -= 6; |
| 4040 | execute_software(decode); |
| 4041 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4166 | 4042 | } |
| 4167 | 4043 | |
| 4168 | | static void hyperstone_fcvt(void) |
| 4044 | INLINE void hyperstone_fcvt(struct regs_decode *decode) |
| 4169 | 4045 | { |
| 4170 | | execute_software(); |
| 4171 | | hyperstone_ICount -= 6; |
| 4046 | execute_software(decode); |
| 4047 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4172 | 4048 | } |
| 4173 | 4049 | |
| 4174 | | static void hyperstone_fcvtd(void) |
| 4050 | INLINE void hyperstone_fcvtd(struct regs_decode *decode) |
| 4175 | 4051 | { |
| 4176 | | execute_software(); |
| 4177 | | hyperstone_ICount -= 6; |
| 4052 | execute_software(decode); |
| 4053 | hyperstone_ICount -= hyperstone.clock_cycles_6; |
| 4178 | 4054 | } |
| 4179 | 4055 | |
| 4180 | | static void hyperstone_extend(void) |
| 4056 | INLINE void hyperstone_extend(struct regs_decode *decode) |
| 4181 | 4057 | { |
| 4182 | 4058 | //TODO: add locks, overflow error and other things |
| 4183 | 4059 | UINT32 vals, vald; |
| r1334 | r1335 | |
| 4371 | 4247 | break; |
| 4372 | 4248 | } |
| 4373 | 4249 | default: |
| 4374 | | logerror("Executed Illegal extended opcode (%X). PC = %08X\n", EXTRA_U, PC); |
| 4250 | DEBUG_PRINTF(("Executed Illegal extended opcode (%X). PC = %08X\n", EXTRA_U, PC)); |
| 4375 | 4251 | break; |
| 4376 | 4252 | } |
| 4377 | 4253 | |
| 4378 | | hyperstone_ICount -= 1; //TODO: with the latency it can change |
| 4254 | hyperstone_ICount -= hyperstone.clock_cycles_1; //TODO: with the latency it can change |
| 4379 | 4255 | } |
| 4380 | 4256 | |
| 4381 | | static void hyperstone_do(void) |
| 4257 | INLINE void hyperstone_do(struct regs_decode *decode) |
| 4382 | 4258 | { |
| 4383 | 4259 | fatalerror("Executed hyperstone_do instruction. PC = %08X", PPC); |
| 4384 | 4260 | } |
| 4385 | 4261 | |
| 4386 | | static void hyperstone_ldwr(void) |
| 4262 | INLINE void hyperstone_ldwr(struct regs_decode *decode) |
| 4387 | 4263 | { |
| 4388 | 4264 | SET_SREG(READ_W(DREG)); |
| 4389 | 4265 | |
| 4390 | | hyperstone_ICount -= 1; |
| 4266 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4391 | 4267 | } |
| 4392 | 4268 | |
| 4393 | | static void hyperstone_lddr(void) |
| 4269 | INLINE void hyperstone_lddr(struct regs_decode *decode) |
| 4394 | 4270 | { |
| 4395 | 4271 | SET_SREG(READ_W(DREG)); |
| 4396 | 4272 | SET_SREGF(READ_W(DREG + 4)); |
| 4397 | 4273 | |
| 4398 | | hyperstone_ICount -= 2; |
| 4274 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 4399 | 4275 | } |
| 4400 | 4276 | |
| 4401 | | static void hyperstone_ldwp(void) |
| 4277 | INLINE void hyperstone_ldwp(struct regs_decode *decode) |
| 4402 | 4278 | { |
| 4403 | 4279 | SET_SREG(READ_W(DREG)); |
| 4404 | 4280 | |
| 4405 | 4281 | // post increment the destination register if it's different from the source one |
| 4406 | 4282 | // (needed by Hidden Catch) |
| 4407 | | if(!(current_regs.src == current_regs.dst && S_BIT == LOCAL)) |
| 4283 | if(!(decode->src == decode->dst && S_BIT == LOCAL)) |
| 4408 | 4284 | SET_DREG(DREG + 4); |
| 4409 | 4285 | |
| 4410 | | hyperstone_ICount -= 1; |
| 4286 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4411 | 4287 | } |
| 4412 | 4288 | |
| 4413 | | static void hyperstone_lddp(void) |
| 4289 | INLINE void hyperstone_lddp(struct regs_decode *decode) |
| 4414 | 4290 | { |
| 4415 | 4291 | SET_SREG(READ_W(DREG)); |
| 4416 | 4292 | SET_SREGF(READ_W(DREG + 4)); |
| 4417 | 4293 | |
| 4418 | 4294 | // post increment the destination register if it's different from the source one |
| 4419 | 4295 | // and from the "next source" one |
| 4420 | | if(!(current_regs.src == current_regs.dst && S_BIT == LOCAL) && !SAME_SRCF_DST ) |
| 4296 | if(!(decode->src == decode->dst && S_BIT == LOCAL) && !SAME_SRCF_DST ) |
| 4421 | 4297 | { |
| 4422 | 4298 | SET_DREG(DREG + 8); |
| 4423 | 4299 | } |
| 4424 | 4300 | else |
| 4425 | 4301 | { |
| 4426 | | popmessage("LDD.P denoted same regs @ %08X",PPC); |
| 4302 | DEBUG_PRINTF(("LDD.P denoted same regs @ %08X",PPC)); |
| 4427 | 4303 | } |
| 4428 | 4304 | |
| 4429 | | hyperstone_ICount -= 2; |
| 4305 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 4430 | 4306 | } |
| 4431 | 4307 | |
| 4432 | | static void hyperstone_stwr(void) |
| 4308 | INLINE void hyperstone_stwr(struct regs_decode *decode) |
| 4433 | 4309 | { |
| 4434 | 4310 | if( SRC_IS_SR ) |
| 4435 | 4311 | SREG = 0; |
| 4436 | 4312 | |
| 4437 | 4313 | WRITE_W(DREG, SREG); |
| 4438 | 4314 | |
| 4439 | | hyperstone_ICount -= 1; |
| 4315 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4440 | 4316 | } |
| 4441 | 4317 | |
| 4442 | | static void hyperstone_stdr(void) |
| 4318 | INLINE void hyperstone_stdr(struct regs_decode *decode) |
| 4443 | 4319 | { |
| 4444 | 4320 | if( SRC_IS_SR ) |
| 4445 | 4321 | SREG = SREGF = 0; |
| r1334 | r1335 | |
| 4447 | 4323 | WRITE_W(DREG, SREG); |
| 4448 | 4324 | WRITE_W(DREG + 4, SREGF); |
| 4449 | 4325 | |
| 4450 | | hyperstone_ICount -= 2; |
| 4326 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 4451 | 4327 | } |
| 4452 | 4328 | |
| 4453 | | static void hyperstone_stwp(void) |
| 4329 | INLINE void hyperstone_stwp(struct regs_decode *decode) |
| 4454 | 4330 | { |
| 4455 | 4331 | if( SRC_IS_SR ) |
| 4456 | 4332 | SREG = 0; |
| r1334 | r1335 | |
| 4458 | 4334 | WRITE_W(DREG, SREG); |
| 4459 | 4335 | SET_DREG(DREG + 4); |
| 4460 | 4336 | |
| 4461 | | hyperstone_ICount -= 1; |
| 4337 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4462 | 4338 | } |
| 4463 | 4339 | |
| 4464 | | static void hyperstone_stdp(void) |
| 4340 | INLINE void hyperstone_stdp(struct regs_decode *decode) |
| 4465 | 4341 | { |
| 4466 | 4342 | if( SRC_IS_SR ) |
| 4467 | 4343 | SREG = SREGF = 0; |
| r1334 | r1335 | |
| 4474 | 4350 | else |
| 4475 | 4351 | WRITE_W(DREG + 4, SREGF); |
| 4476 | 4352 | |
| 4477 | | hyperstone_ICount -= 2; |
| 4353 | hyperstone_ICount -= hyperstone.clock_cycles_2; |
| 4478 | 4354 | } |
| 4479 | 4355 | |
| 4480 | | static void hyperstone_dbv(void) |
| 4356 | INLINE void hyperstone_dbv(struct regs_decode *decode) |
| 4481 | 4357 | { |
| 4482 | 4358 | if( GET_V ) |
| 4483 | | execute_dbr(); |
| 4359 | execute_dbr(decode); |
| 4484 | 4360 | |
| 4485 | | hyperstone_ICount -= 1; |
| 4361 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4486 | 4362 | } |
| 4487 | 4363 | |
| 4488 | | static void hyperstone_dbnv(void) |
| 4364 | INLINE void hyperstone_dbnv(struct regs_decode *decode) |
| 4489 | 4365 | { |
| 4490 | 4366 | if( !GET_V ) |
| 4491 | | execute_dbr(); |
| 4367 | execute_dbr(decode); |
| 4492 | 4368 | |
| 4493 | | hyperstone_ICount -= 1; |
| 4369 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4494 | 4370 | } |
| 4495 | 4371 | |
| 4496 | | static void hyperstone_dbe(void) //or DBZ |
| 4372 | INLINE void hyperstone_dbe(struct regs_decode *decode) //or DBZ |
| 4497 | 4373 | { |
| 4498 | 4374 | if( GET_Z ) |
| 4499 | | execute_dbr(); |
| 4375 | execute_dbr(decode); |
| 4500 | 4376 | |
| 4501 | | hyperstone_ICount -= 1; |
| 4377 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4502 | 4378 | } |
| 4503 | 4379 | |
| 4504 | | static void hyperstone_dbne(void) //or DBNZ |
| 4380 | INLINE void hyperstone_dbne(struct regs_decode *decode) //or DBNZ |
| 4505 | 4381 | { |
| 4506 | 4382 | if( !GET_Z ) |
| 4507 | | execute_dbr(); |
| 4383 | execute_dbr(decode); |
| 4508 | 4384 | |
| 4509 | | hyperstone_ICount -= 1; |
| 4385 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4510 | 4386 | } |
| 4511 | 4387 | |
| 4512 | | static void hyperstone_dbc(void) //or DBST |
| 4388 | INLINE void hyperstone_dbc(struct regs_decode *decode) //or DBST |
| 4513 | 4389 | { |
| 4514 | 4390 | if( GET_C ) |
| 4515 | | execute_dbr(); |
| 4391 | execute_dbr(decode); |
| 4516 | 4392 | |
| 4517 | | hyperstone_ICount -= 1; |
| 4393 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4518 | 4394 | } |
| 4519 | 4395 | |
| 4520 | | static void hyperstone_dbnc(void) //or DBHE |
| 4396 | INLINE void hyperstone_dbnc(struct regs_decode *decode) //or DBHE |
| 4521 | 4397 | { |
| 4522 | 4398 | if( !GET_C ) |
| 4523 | | execute_dbr(); |
| 4399 | execute_dbr(decode); |
| 4524 | 4400 | |
| 4525 | | hyperstone_ICount -= 1; |
| 4401 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4526 | 4402 | } |
| 4527 | 4403 | |
| 4528 | | static void hyperstone_dbse(void) |
| 4404 | INLINE void hyperstone_dbse(struct regs_decode *decode) |
| 4529 | 4405 | { |
| 4530 | 4406 | if( GET_C || GET_Z ) |
| 4531 | | execute_dbr(); |
| 4407 | execute_dbr(decode); |
| 4532 | 4408 | |
| 4533 | | hyperstone_ICount -= 1; |
| 4409 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4534 | 4410 | } |
| 4535 | 4411 | |
| 4536 | | static void hyperstone_dbht(void) |
| 4412 | INLINE void hyperstone_dbht(struct regs_decode *decode) |
| 4537 | 4413 | { |
| 4538 | 4414 | if( !GET_C && !GET_Z ) |
| 4539 | | execute_dbr(); |
| 4415 | execute_dbr(decode); |
| 4540 | 4416 | |
| 4541 | | hyperstone_ICount -= 1; |
| 4417 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4542 | 4418 | } |
| 4543 | 4419 | |
| 4544 | | static void hyperstone_dbn(void) //or DBLT |
| 4420 | INLINE void hyperstone_dbn(struct regs_decode *decode) //or DBLT |
| 4545 | 4421 | { |
| 4546 | 4422 | if( GET_N ) |
| 4547 | | execute_dbr(); |
| 4423 | execute_dbr(decode); |
| 4548 | 4424 | |
| 4549 | | hyperstone_ICount -= 1; |
| 4425 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4550 | 4426 | } |
| 4551 | 4427 | |
| 4552 | | static void hyperstone_dbnn(void) //or DBGE |
| 4428 | INLINE void hyperstone_dbnn(struct regs_decode *decode) //or DBGE |
| 4553 | 4429 | { |
| 4554 | 4430 | if( !GET_N ) |
| 4555 | | execute_dbr(); |
| 4431 | execute_dbr(decode); |
| 4556 | 4432 | |
| 4557 | | hyperstone_ICount -= 1; |
| 4433 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4558 | 4434 | } |
| 4559 | 4435 | |
| 4560 | | static void hyperstone_dble(void) |
| 4436 | INLINE void hyperstone_dble(struct regs_decode *decode) |
| 4561 | 4437 | { |
| 4562 | 4438 | if( GET_N || GET_Z ) |
| 4563 | | execute_dbr(); |
| 4439 | execute_dbr(decode); |
| 4564 | 4440 | |
| 4565 | | hyperstone_ICount -= 1; |
| 4441 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4566 | 4442 | } |
| 4567 | 4443 | |
| 4568 | | static void hyperstone_dbgt(void) |
| 4444 | INLINE void hyperstone_dbgt(struct regs_decode *decode) |
| 4569 | 4445 | { |
| 4570 | 4446 | if( !GET_N && !GET_Z ) |
| 4571 | | execute_dbr(); |
| 4447 | execute_dbr(decode); |
| 4572 | 4448 | |
| 4573 | | hyperstone_ICount -= 1; |
| 4449 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4574 | 4450 | } |
| 4575 | 4451 | |
| 4576 | | static void hyperstone_dbr(void) |
| 4452 | INLINE void hyperstone_dbr(struct regs_decode *decode) |
| 4577 | 4453 | { |
| 4578 | | execute_dbr(); |
| 4454 | execute_dbr(decode); |
| 4579 | 4455 | } |
| 4580 | 4456 | |
| 4581 | | static void hyperstone_frame(void) |
| 4457 | INLINE void hyperstone_frame(struct regs_decode *decode) |
| 4582 | 4458 | { |
| 4583 | 4459 | INT8 difference; // really it's 7 bits |
| 4584 | 4460 | UINT8 realfp = GET_FP - SRC_CODE; |
| r1334 | r1335 | |
| 4617 | 4493 | } |
| 4618 | 4494 | |
| 4619 | 4495 | //TODO: no 1! |
| 4620 | | hyperstone_ICount -= 1; |
| 4496 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4621 | 4497 | } |
| 4622 | 4498 | |
| 4623 | | static void hyperstone_call(void) |
| 4499 | INLINE void hyperstone_call(struct regs_decode *decode) |
| 4624 | 4500 | { |
| 4625 | 4501 | if( SRC_IS_SR ) |
| 4626 | 4502 | SREG = 0; |
| 4627 | 4503 | |
| 4628 | 4504 | if( !DST_CODE ) |
| 4629 | | current_regs.dst = 16; |
| 4505 | decode->dst = 16; |
| 4630 | 4506 | |
| 4631 | 4507 | EXTRA_S = (EXTRA_S & ~1) + SREG; |
| 4632 | 4508 | |
| r1334 | r1335 | |
| 4635 | 4511 | SET_DREG((PC & 0xfffffffe) | GET_S); |
| 4636 | 4512 | SET_DREGF(SR); |
| 4637 | 4513 | |
| 4638 | | SET_FP(GET_FP + current_regs.dst); |
| 4514 | SET_FP(GET_FP + decode->dst); |
| 4639 | 4515 | |
| 4640 | 4516 | SET_FL(6); //default value for call |
| 4641 | 4517 | SET_M(0); |
| r1334 | r1335 | |
| 4649 | 4525 | //TODO: add interrupt locks, errors, .... |
| 4650 | 4526 | |
| 4651 | 4527 | //TODO: no 1! |
| 4652 | | hyperstone_ICount -= 1; |
| 4528 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4653 | 4529 | } |
| 4654 | 4530 | |
| 4655 | | static void hyperstone_bv(void) |
| 4531 | INLINE void hyperstone_bv(struct regs_decode *decode) |
| 4656 | 4532 | { |
| 4657 | 4533 | if( GET_V ) |
| 4658 | | execute_br(); |
| 4534 | execute_br(decode); |
| 4659 | 4535 | else |
| 4660 | | hyperstone_ICount -= 1; |
| 4536 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4661 | 4537 | } |
| 4662 | 4538 | |
| 4663 | | static void hyperstone_bnv(void) |
| 4539 | INLINE void hyperstone_bnv(struct regs_decode *decode) |
| 4664 | 4540 | { |
| 4665 | 4541 | if( !GET_V ) |
| 4666 | | execute_br(); |
| 4542 | execute_br(decode); |
| 4667 | 4543 | else |
| 4668 | | hyperstone_ICount -= 1; |
| 4544 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4669 | 4545 | } |
| 4670 | 4546 | |
| 4671 | | static void hyperstone_be(void) //or BZ |
| 4547 | INLINE void hyperstone_be(struct regs_decode *decode) //or BZ |
| 4672 | 4548 | { |
| 4673 | 4549 | if( GET_Z ) |
| 4674 | | execute_br(); |
| 4550 | execute_br(decode); |
| 4675 | 4551 | else |
| 4676 | | hyperstone_ICount -= 1; |
| 4552 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4677 | 4553 | } |
| 4678 | 4554 | |
| 4679 | | static void hyperstone_bne(void) //or BNZ |
| 4555 | INLINE void hyperstone_bne(struct regs_decode *decode) //or BNZ |
| 4680 | 4556 | { |
| 4681 | 4557 | if( !GET_Z ) |
| 4682 | | execute_br(); |
| 4558 | execute_br(decode); |
| 4683 | 4559 | else |
| 4684 | | hyperstone_ICount -= 1; |
| 4560 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4685 | 4561 | } |
| 4686 | 4562 | |
| 4687 | | static void hyperstone_bc(void) //or BST |
| 4563 | INLINE void hyperstone_bc(struct regs_decode *decode) //or BST |
| 4688 | 4564 | { |
| 4689 | 4565 | if( GET_C ) |
| 4690 | | execute_br(); |
| 4566 | execute_br(decode); |
| 4691 | 4567 | else |
| 4692 | | hyperstone_ICount -= 1; |
| 4568 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4693 | 4569 | } |
| 4694 | 4570 | |
| 4695 | | static void hyperstone_bnc(void) //or BHE |
| 4571 | INLINE void hyperstone_bnc(struct regs_decode *decode) //or BHE |
| 4696 | 4572 | { |
| 4697 | 4573 | if( !GET_C ) |
| 4698 | | execute_br(); |
| 4574 | execute_br(decode); |
| 4699 | 4575 | else |
| 4700 | | hyperstone_ICount -= 1; |
| 4576 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4701 | 4577 | } |
| 4702 | 4578 | |
| 4703 | | static void hyperstone_bse(void) |
| 4579 | INLINE void hyperstone_bse(struct regs_decode *decode) |
| 4704 | 4580 | { |
| 4705 | 4581 | if( GET_C || GET_Z ) |
| 4706 | | execute_br(); |
| 4582 | execute_br(decode); |
| 4707 | 4583 | else |
| 4708 | | hyperstone_ICount -= 1; |
| 4584 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4709 | 4585 | } |
| 4710 | 4586 | |
| 4711 | | static void hyperstone_bht(void) |
| 4587 | INLINE void hyperstone_bht(struct regs_decode *decode) |
| 4712 | 4588 | { |
| 4713 | 4589 | if( !GET_C && !GET_Z ) |
| 4714 | | execute_br(); |
| 4590 | execute_br(decode); |
| 4715 | 4591 | else |
| 4716 | | hyperstone_ICount -= 1; |
| 4592 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4717 | 4593 | } |
| 4718 | 4594 | |
| 4719 | | static void hyperstone_bn(void) //or BLT |
| 4595 | INLINE void hyperstone_bn(struct regs_decode *decode) //or BLT |
| 4720 | 4596 | { |
| 4721 | 4597 | if( GET_N ) |
| 4722 | | execute_br(); |
| 4598 | execute_br(decode); |
| 4723 | 4599 | else |
| 4724 | | hyperstone_ICount -= 1; |
| 4600 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4725 | 4601 | } |
| 4726 | 4602 | |
| 4727 | | static void hyperstone_bnn(void) //or BGE |
| 4603 | INLINE void hyperstone_bnn(struct regs_decode *decode) //or BGE |
| 4728 | 4604 | { |
| 4729 | 4605 | if( !GET_N ) |
| 4730 | | execute_br(); |
| 4606 | execute_br(decode); |
| 4731 | 4607 | else |
| 4732 | | hyperstone_ICount -= 1; |
| 4608 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4733 | 4609 | } |
| 4734 | 4610 | |
| 4735 | | static void hyperstone_ble(void) |
| 4611 | INLINE void hyperstone_ble(struct regs_decode *decode) |
| 4736 | 4612 | { |
| 4737 | 4613 | if( GET_N || GET_Z ) |
| 4738 | | execute_br(); |
| 4614 | execute_br(decode); |
| 4739 | 4615 | else |
| 4740 | | hyperstone_ICount -= 1; |
| 4616 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4741 | 4617 | } |
| 4742 | 4618 | |
| 4743 | | static void hyperstone_bgt(void) |
| 4619 | INLINE void hyperstone_bgt(struct regs_decode *decode) |
| 4744 | 4620 | { |
| 4745 | 4621 | if( !GET_N && !GET_Z ) |
| 4746 | | execute_br(); |
| 4622 | execute_br(decode); |
| 4747 | 4623 | else |
| 4748 | | hyperstone_ICount -= 1; |
| 4624 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4749 | 4625 | } |
| 4750 | 4626 | |
| 4751 | | static void hyperstone_br(void) |
| 4627 | INLINE void hyperstone_br(struct regs_decode *decode) |
| 4752 | 4628 | { |
| 4753 | | execute_br(); |
| 4629 | execute_br(decode); |
| 4754 | 4630 | } |
| 4755 | 4631 | |
| 4756 | | static void hyperstone_trap(void) |
| 4632 | INLINE void hyperstone_trap(struct regs_decode *decode) |
| 4757 | 4633 | { |
| 4758 | 4634 | UINT8 code, trapno; |
| 4759 | 4635 | UINT32 addr; |
| r1334 | r1335 | |
| 4837 | 4713 | break; |
| 4838 | 4714 | } |
| 4839 | 4715 | |
| 4840 | | hyperstone_ICount -= 1; |
| 4716 | hyperstone_ICount -= hyperstone.clock_cycles_1; |
| 4841 | 4717 | } |
| 4842 | 4718 | |
| 4843 | 4719 | |
| 4720 | #include "e132xsop.c" |
| 4721 | |
| 4722 | |
| 4723 | static int hyperstone_execute(int cycles) |
| 4724 | { |
| 4725 | hyperstone_ICount = cycles; |
| 4726 | |
| 4727 | if (hyperstone.intblock < 0) |
| 4728 | hyperstone.intblock = 0; |
| 4729 | check_interrupts(); |
| 4730 | |
| 4731 | do |
| 4732 | { |
| 4733 | UINT32 oldh = SR & 0x00000020; |
| 4734 | UINT16 opcode; |
| 4735 | |
| 4736 | PPC = PC; /* copy PC to previous PC */ |
| 4737 | CALL_MAME_DEBUG; |
| 4738 | |
| 4739 | opcode = READ_OP(PC); |
| 4740 | PC += 2; |
| 4741 | |
| 4742 | hyperstone.instruction_length = 1; |
| 4743 | |
| 4744 | /* execute opcode */ |
| 4745 | (*hyperstone_op[(opcode & 0xff00) >> 8])(opcode); |
| 4746 | |
| 4747 | /* clear the H state if it was previously set */ |
| 4748 | SR ^= oldh; |
| 4749 | |
| 4750 | SET_ILC(hyperstone.instruction_length & 3); |
| 4751 | |
| 4752 | if( GET_T && GET_P && hyperstone.delay.delay_cmd == NO_DELAY ) /* Not in a Delayed Branch instructions */ |
| 4753 | { |
| 4754 | UINT32 addr = get_trap_addr(TRACE_EXCEPTION); |
| 4755 | execute_exception(addr); |
| 4756 | } |
| 4757 | |
| 4758 | if (--hyperstone.intblock == 0) |
| 4759 | check_interrupts(); |
| 4760 | |
| 4761 | } while( hyperstone_ICount > 0 ); |
| 4762 | |
| 4763 | return cycles - hyperstone_ICount; |
| 4764 | } |
| 4765 | |
| 4766 | |
| 4844 | 4767 | /************************************************************************** |
| 4845 | 4768 | * Generic set_info |
| 4846 | 4769 | **************************************************************************/ |
| r1334 | r1335 | |
| 4855 | 4778 | case CPUINFO_INT_REGISTER + E132XS_PC: PC = info->i; change_pc(PC); break; |
| 4856 | 4779 | case CPUINFO_INT_REGISTER + E132XS_SR: SR = info->i; break; |
| 4857 | 4780 | case CPUINFO_INT_REGISTER + E132XS_FER: FER = info->i; break; |
| 4858 | | case CPUINFO_INT_REGISTER + E132XS_G3: hyperstone.global_regs[3] = info->i; break; |
| 4859 | | case CPUINFO_INT_REGISTER + E132XS_G4: hyperstone.global_regs[4] = info->i; break; |
| 4860 | | case CPUINFO_INT_REGISTER + E132XS_G5: hyperstone.global_regs[5] = info->i; break; |
| 4861 | | case CPUINFO_INT_REGISTER + E132XS_G6: hyperstone.global_regs[6] = info->i; break; |
| 4862 | | case CPUINFO_INT_REGISTER + E132XS_G7: hyperstone.global_regs[7] = info->i; break; |
| 4863 | | case CPUINFO_INT_REGISTER + E132XS_G8: hyperstone.global_regs[8] = info->i; break; |
| 4864 | | case CPUINFO_INT_REGISTER + E132XS_G9: hyperstone.global_regs[9] = info->i; break; |
| 4865 | | case CPUINFO_INT_REGISTER + E132XS_G10: hyperstone.global_regs[10] = info->i; break; |
| 4866 | | case CPUINFO_INT_REGISTER + E132XS_G11: hyperstone.global_regs[11] = info->i; break; |
| 4867 | | case CPUINFO_INT_REGISTER + E132XS_G12: hyperstone.global_regs[12] = info->i; break; |
| 4868 | | case CPUINFO_INT_REGISTER + E132XS_G13: hyperstone.global_regs[13] = info->i; break; |
| 4869 | | case CPUINFO_INT_REGISTER + E132XS_G14: hyperstone.global_regs[14] = info->i; break; |
| 4870 | | case CPUINFO_INT_REGISTER + E132XS_G15: hyperstone.global_regs[15] = info->i; break; |
| 4871 | | case CPUINFO_INT_REGISTER + E132XS_G16: hyperstone.global_regs[16] = info->i; break; |
| 4872 | | case CPUINFO_INT_REGISTER + E132XS_G17: hyperstone.global_regs[17] = info->i; break; |
| 4781 | case CPUINFO_INT_REGISTER + E132XS_G3: set_global_register(3, info->i); break; |
| 4782 | case CPUINFO_INT_REGISTER + E132XS_G4: set_global_register(4, info->i); break; |
| 4783 | case CPUINFO_INT_REGISTER + E132XS_G5: set_global_register(5, info->i); break; |
| 4784 | case CPUINFO_INT_REGISTER + E132XS_G6: set_global_register(6, info->i); break; |
| 4785 | case CPUINFO_INT_REGISTER + E132XS_G7: set_global_register(7, info->i); break; |
| 4786 | case CPUINFO_INT_REGISTER + E132XS_G8: set_global_register(8, info->i); break; |
| 4787 | case CPUINFO_INT_REGISTER + E132XS_G9: set_global_register(9, info->i); break; |
| 4788 | case CPUINFO_INT_REGISTER + E132XS_G10: set_global_register(10, info->i); break; |
| 4789 | case CPUINFO_INT_REGISTER + E132XS_G11: set_global_register(11, info->i); break; |
| 4790 | case CPUINFO_INT_REGISTER + E132XS_G12: set_global_register(12, info->i); break; |
| 4791 | case CPUINFO_INT_REGISTER + E132XS_G13: set_global_register(13, info->i); break; |
| 4792 | case CPUINFO_INT_REGISTER + E132XS_G14: set_global_register(14, info->i); break; |
| 4793 | case CPUINFO_INT_REGISTER + E132XS_G15: set_global_register(15, info->i); break; |
| 4794 | case CPUINFO_INT_REGISTER + E132XS_G16: set_global_register(16, info->i); break; |
| 4795 | case CPUINFO_INT_REGISTER + E132XS_G17: set_global_register(17, info->i); break; |
| 4873 | 4796 | case CPUINFO_INT_SP: |
| 4874 | 4797 | case CPUINFO_INT_REGISTER + E132XS_SP: SP = info->i; break; |
| 4875 | 4798 | case CPUINFO_INT_REGISTER + E132XS_UB: UB = info->i; break; |
| 4876 | 4799 | case CPUINFO_INT_REGISTER + E132XS_BCR: BCR = info->i; break; |
| 4877 | 4800 | case CPUINFO_INT_REGISTER + E132XS_TPR: TPR = info->i; break; |
| 4878 | 4801 | case CPUINFO_INT_REGISTER + E132XS_TCR: TCR = info->i; break; |
| 4879 | | case CPUINFO_INT_REGISTER + E132XS_TR: TR = info->i; break; |
| 4802 | case CPUINFO_INT_REGISTER + E132XS_TR: set_global_register(TR_REGISTER, info->i); break; |
| 4880 | 4803 | case CPUINFO_INT_REGISTER + E132XS_WCR: WCR = info->i; break; |
| 4881 | 4804 | case CPUINFO_INT_REGISTER + E132XS_ISR: ISR = info->i; break; |
| 4882 | 4805 | case CPUINFO_INT_REGISTER + E132XS_FCR: FCR = info->i; break; |
| 4883 | 4806 | case CPUINFO_INT_REGISTER + E132XS_MCR: MCR = info->i; break; |
| 4884 | | case CPUINFO_INT_REGISTER + E132XS_G28: hyperstone.global_regs[28] = info->i; break; |
| 4885 | | case CPUINFO_INT_REGISTER + E132XS_G29: hyperstone.global_regs[29] = info->i; break; |
| 4886 | | case CPUINFO_INT_REGISTER + E132XS_G30: hyperstone.global_regs[30] = info->i; break; |
| 4887 | | case CPUINFO_INT_REGISTER + E132XS_G31: hyperstone.global_regs[31] = info->i; break; |
| 4807 | case CPUINFO_INT_REGISTER + E132XS_G28: set_global_register(28, info->i); break; |
| 4808 | case CPUINFO_INT_REGISTER + E132XS_G29: set_global_register(29, info->i); break; |
| 4809 | case CPUINFO_INT_REGISTER + E132XS_G30: set_global_register(30, info->i); break; |
| 4810 | case CPUINFO_INT_REGISTER + E132XS_G31: set_global_register(31, info->i); break; |
| 4888 | 4811 | case CPUINFO_INT_REGISTER + E132XS_CL0: hyperstone.local_regs[(0 + GET_FP) % 64] = info->i; break; |
| 4889 | 4812 | case CPUINFO_INT_REGISTER + E132XS_CL1: hyperstone.local_regs[(1 + GET_FP) % 64] = info->i; break; |
| 4890 | 4813 | case CPUINFO_INT_REGISTER + E132XS_CL2: hyperstone.local_regs[(2 + GET_FP) % 64] = info->i; break; |
| r1334 | r1335 | |
| 4981 | 4904 | * Generic get_info |
| 4982 | 4905 | **************************************************************************/ |
| 4983 | 4906 | |
| 4984 | | void hyperstone_get_info(UINT32 state, cpuinfo *info) |
| 4907 | static void hyperstone_get_info(UINT32 state, cpuinfo *info) |
| 4985 | 4908 | { |
| 4986 | 4909 | switch (state) |
| 4987 | 4910 | { |
| r1334 | r1335 | |
| 5012 | 4935 | case CPUINFO_INT_REGISTER + E132XS_PC: info->i = PC; break; |
| 5013 | 4936 | case CPUINFO_INT_REGISTER + E132XS_SR: info->i = SR; break; |
| 5014 | 4937 | case CPUINFO_INT_REGISTER + E132XS_FER: info->i = FER; break; |
| 5015 | | case CPUINFO_INT_REGISTER + E132XS_G3: info->i = hyperstone.global_regs[3]; break; |
| 5016 | | case CPUINFO_INT_REGISTER + E132XS_G4: info->i = hyperstone.global_regs[4]; break; |
| 5017 | | case CPUINFO_INT_REGISTER + E132XS_G5: info->i = hyperstone.global_regs[5]; break; |
| 5018 | | case CPUINFO_INT_REGISTER + E132XS_G6: info->i = hyperstone.global_regs[6]; break; |
| 5019 | | case CPUINFO_INT_REGISTER + E132XS_G7: info->i = hyperstone.global_regs[7]; break; |
| 5020 | | case CPUINFO_INT_REGISTER + E132XS_G8: info->i = hyperstone.global_regs[8]; break; |
| 5021 | | case CPUINFO_INT_REGISTER + E132XS_G9: info->i = hyperstone.global_regs[9]; break; |
| 5022 | | case CPUINFO_INT_REGISTER + E132XS_G10: info->i = hyperstone.global_regs[10]; break; |
| 5023 | | case CPUINFO_INT_REGISTER + E132XS_G11: info->i = hyperstone.global_regs[11]; break; |
| 5024 | | case CPUINFO_INT_REGISTER + E132XS_G12: info->i = hyperstone.global_regs[12]; break; |
| 5025 | | case CPUINFO_INT_REGISTER + E132XS_G13: info->i = hyperstone.global_regs[13]; break; |
| 5026 | | case CPUINFO_INT_REGISTER + E132XS_G14: info->i = hyperstone.global_regs[14]; break; |
| 5027 | | case CPUINFO_INT_REGISTER + E132XS_G15: info->i = hyperstone.global_regs[15]; break; |
| 5028 | | case CPUINFO_INT_REGISTER + E132XS_G16: info->i = hyperstone.global_regs[16]; break; |
| 5029 | | case CPUINFO_INT_REGISTER + E132XS_G17: info->i = hyperstone.global_regs[17]; break; |
| 4938 | case CPUINFO_INT_REGISTER + E132XS_G3: info->i = get_global_register(3); break; |
| 4939 | case CPUINFO_INT_REGISTER + E132XS_G4: info->i = get_global_register(4); break; |
| 4940 | case CPUINFO_INT_REGISTER + E132XS_G5: info->i = get_global_register(5); break; |
| 4941 | case CPUINFO_INT_REGISTER + E132XS_G6: info->i = get_global_register(6); break; |
| 4942 | case CPUINFO_INT_REGISTER + E132XS_G7: info->i = get_global_register(7); break; |
| 4943 | case CPUINFO_INT_REGISTER + E132XS_G8: info->i = get_global_register(8); break; |
| 4944 | case CPUINFO_INT_REGISTER + E132XS_G9: info->i = get_global_register(9); break; |
| 4945 | case CPUINFO_INT_REGISTER + E132XS_G10: info->i = get_global_register(10); break; |
| 4946 | case CPUINFO_INT_REGISTER + E132XS_G11: info->i = get_global_register(11); break; |
| 4947 | case CPUINFO_INT_REGISTER + E132XS_G12: info->i = get_global_register(12); break; |
| 4948 | case CPUINFO_INT_REGISTER + E132XS_G13: info->i = get_global_register(13); break; |
| 4949 | case CPUINFO_INT_REGISTER + E132XS_G14: info->i = get_global_register(14); break; |
| 4950 | case CPUINFO_INT_REGISTER + E132XS_G15: info->i = get_global_register(15); break; |
| 4951 | case CPUINFO_INT_REGISTER + E132XS_G16: info->i = get_global_register(16); break; |
| 4952 | case CPUINFO_INT_REGISTER + E132XS_G17: info->i = get_global_register(17); break; |
| 5030 | 4953 | case CPUINFO_INT_SP: |
| 5031 | 4954 | case CPUINFO_INT_REGISTER + E132XS_SP: info->i = SP; break; |
| 5032 | 4955 | case CPUINFO_INT_REGISTER + E132XS_UB: info->i = UB; break; |
| r1334 | r1335 | |
| 5038 | 4961 | case CPUINFO_INT_REGISTER + E132XS_ISR: info->i = ISR; break; |
| 5039 | 4962 | case CPUINFO_INT_REGISTER + E132XS_FCR: info->i = FCR; break; |
| 5040 | 4963 | case CPUINFO_INT_REGISTER + E132XS_MCR: info->i = MCR; break; |
| 5041 | | case CPUINFO_INT_REGISTER + E132XS_G28: info->i = hyperstone.global_regs[28]; break; |
| 5042 | | case CPUINFO_INT_REGISTER + E132XS_G29: info->i = hyperstone.global_regs[29]; break; |
| 5043 | | case CPUINFO_INT_REGISTER + E132XS_G30: info->i = hyperstone.global_regs[30]; break; |
| 5044 | | case CPUINFO_INT_REGISTER + E132XS_G31: info->i = hyperstone.global_regs[31]; break; |
| 4964 | case CPUINFO_INT_REGISTER + E132XS_G28: info->i = get_global_register(28); break; |
| 4965 | case CPUINFO_INT_REGISTER + E132XS_G29: info->i = get_global_register(29); break; |
| 4966 | case CPUINFO_INT_REGISTER + E132XS_G30: info->i = get_global_register(30); break; |
| 4967 | case CPUINFO_INT_REGISTER + E132XS_G31: info->i = get_global_register(31); break; |
| 5045 | 4968 | case CPUINFO_INT_REGISTER + E132XS_CL0: info->i = hyperstone.local_regs[(0 + GET_FP) % 64]; break; |
| 5046 | 4969 | case CPUINFO_INT_REGISTER + E132XS_CL1: info->i = hyperstone.local_regs[(1 + GET_FP) % 64]; break; |
| 5047 | 4970 | case CPUINFO_INT_REGISTER + E132XS_CL2: info->i = hyperstone.local_regs[(2 + GET_FP) % 64]; break; |
| r1334 | r1335 | |
| 5127 | 5050 | case CPUINFO_PTR_SET_INFO: info->setinfo = hyperstone_set_info; break; |
| 5128 | 5051 | case CPUINFO_PTR_GET_CONTEXT: info->getcontext = hyperstone_get_context; break; |
| 5129 | 5052 | case CPUINFO_PTR_SET_CONTEXT: info->setcontext = hyperstone_set_context; break; |
| 5130 | | case CPUINFO_PTR_INIT: info->init = hyperstone_init; break; |
| 5053 | case CPUINFO_PTR_INIT: info->init = NULL; break; |
| 5131 | 5054 | case CPUINFO_PTR_RESET: info->reset = hyperstone_reset; break; |
| 5132 | 5055 | case CPUINFO_PTR_EXIT: info->exit = hyperstone_exit; break; |
| 5133 | 5056 | case CPUINFO_PTR_EXECUTE: info->execute = hyperstone_execute; break; |
| r1334 | r1335 | |
| 5295 | 5218 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_4k_iram_map; break; |
| 5296 | 5219 | |
| 5297 | 5220 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5298 | | case CPUINFO_PTR_INIT: info->init = e116_init; break; |
| 5221 | case CPUINFO_PTR_INIT: info->init = e116t_init; break; |
| 5299 | 5222 | |
| 5300 | 5223 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5301 | 5224 | case CPUINFO_STR_NAME: strcpy(info->s, "E1-16T"); break; |
| r1334 | r1335 | |
| 5318 | 5241 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_8k_iram_map; break; |
| 5319 | 5242 | |
| 5320 | 5243 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5321 | | case CPUINFO_PTR_INIT: info->init = e116_init; break; |
| 5244 | case CPUINFO_PTR_INIT: info->init = e116xt_init; break; |
| 5322 | 5245 | |
| 5323 | 5246 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5324 | 5247 | case CPUINFO_STR_NAME: strcpy(info->s, "E1-16XT"); break; |
| r1334 | r1335 | |
| 5341 | 5264 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_16k_iram_map; break; |
| 5342 | 5265 | |
| 5343 | 5266 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5344 | | case CPUINFO_PTR_INIT: info->init = e116_init; break; |
| 5267 | case CPUINFO_PTR_INIT: info->init = e116xs_init; break; |
| 5345 | 5268 | |
| 5346 | 5269 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5347 | 5270 | case CPUINFO_STR_NAME: strcpy(info->s, "E1-16XS"); break; |
| r1334 | r1335 | |
| 5364 | 5287 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_16k_iram_map; break; |
| 5365 | 5288 | |
| 5366 | 5289 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5367 | | case CPUINFO_PTR_INIT: info->init = e116_init; break; |
| 5290 | case CPUINFO_PTR_INIT: info->init = e116xsr_init; break; |
| 5368 | 5291 | |
| 5369 | 5292 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5370 | 5293 | case CPUINFO_STR_NAME: strcpy(info->s, "E1-16XSR"); break; |
| r1334 | r1335 | |
| 5387 | 5310 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break; |
| 5388 | 5311 | |
| 5389 | 5312 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5390 | | case CPUINFO_PTR_INIT: info->init = e132_init; break; |
| 5313 | case CPUINFO_PTR_INIT: info->init = e132n_init; break; |
| 5391 | 5314 | |
| 5392 | 5315 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5393 | 5316 | case CPUINFO_STR_NAME: strcpy(info->s, "E1-32N"); break; |
| r1334 | r1335 | |
| 5410 | 5333 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break; |
| 5411 | 5334 | |
| 5412 | 5335 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5413 | | case CPUINFO_PTR_INIT: info->init = e132_init; break; |
| 5336 | case CPUINFO_PTR_INIT: info->init = e132t_init; break; |
| 5414 | 5337 | |
| 5415 | 5338 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5416 | 5339 | case CPUINFO_STR_NAME: strcpy(info->s, "E1-32T"); break; |
| r1334 | r1335 | |
| 5433 | 5356 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break; |
| 5434 | 5357 | |
| 5435 | 5358 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5436 | | case CPUINFO_PTR_INIT: info->init = e132_init; break; |
| 5359 | case CPUINFO_PTR_INIT: info->init = e132xn_init; break; |
| 5437 | 5360 | |
| 5438 | 5361 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5439 | 5362 | case CPUINFO_STR_NAME: strcpy(info->s, "E1-32XN"); break; |
| r1334 | r1335 | |
| 5456 | 5379 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break; |
| 5457 | 5380 | |
| 5458 | 5381 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5459 | | case CPUINFO_PTR_INIT: info->init = e132_init; break; |
| 5382 | case CPUINFO_PTR_INIT: info->init = e132xt_init; break; |
| 5460 | 5383 | |
| 5461 | 5384 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5462 | 5385 | case CPUINFO_STR_NAME: strcpy(info->s, "E1-32XT"); break; |
| r1334 | r1335 | |
| 5479 | 5402 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_16k_iram_map; break; |
| 5480 | 5403 | |
| 5481 | 5404 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5482 | | case CPUINFO_PTR_INIT: info->init = e132_init; break; |
| 5405 | case CPUINFO_PTR_INIT: info->init = e132xs_init; break; |
| 5483 | 5406 | |
| 5484 | 5407 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5485 | 5408 | case CPUINFO_STR_NAME: strcpy(info->s, "E1-32XS"); break; |
| r1334 | r1335 | |
| 5502 | 5425 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_16k_iram_map; break; |
| 5503 | 5426 | |
| 5504 | 5427 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5505 | | case CPUINFO_PTR_INIT: info->init = e132_init; break; |
| 5428 | case CPUINFO_PTR_INIT: info->init = e132xsr_init; break; |
| 5506 | 5429 | |
| 5507 | 5430 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5508 | 5431 | case CPUINFO_STR_NAME: strcpy(info->s, "E1-32XSR"); break; |
| r1334 | r1335 | |
| 5525 | 5448 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_4k_iram_map; break; |
| 5526 | 5449 | |
| 5527 | 5450 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5528 | | case CPUINFO_PTR_INIT: info->init = e116_init; break; |
| 5451 | case CPUINFO_PTR_INIT: info->init = gms30c2116_init; break; |
| 5529 | 5452 | |
| 5530 | 5453 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5531 | 5454 | case CPUINFO_STR_NAME: strcpy(info->s, "GMS30C2116"); break; |
| r1334 | r1335 | |
| 5548 | 5471 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break; |
| 5549 | 5472 | |
| 5550 | 5473 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5551 | | case CPUINFO_PTR_INIT: info->init = e132_init; break; |
| 5474 | case CPUINFO_PTR_INIT: info->init = gms30c2132_init; break; |
| 5552 | 5475 | |
| 5553 | 5476 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5554 | 5477 | case CPUINFO_STR_NAME: strcpy(info->s, "GMS30C2132"); break; |
| r1334 | r1335 | |
| 5571 | 5494 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_8k_iram_map; break; |
| 5572 | 5495 | |
| 5573 | 5496 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5574 | | case CPUINFO_PTR_INIT: info->init = e116_init; break; |
| 5497 | case CPUINFO_PTR_INIT: info->init = gms30c2216_init; break; |
| 5575 | 5498 | |
| 5576 | 5499 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5577 | 5500 | case CPUINFO_STR_NAME: strcpy(info->s, "GMS30C2216"); break; |
| r1334 | r1335 | |
| 5594 | 5517 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break; |
| 5595 | 5518 | |
| 5596 | 5519 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 5597 | | case CPUINFO_PTR_INIT: info->init = e132_init; break; |
| 5520 | case CPUINFO_PTR_INIT: info->init = gms30c2232_init; break; |
| 5598 | 5521 | |
| 5599 | 5522 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 5600 | 5523 | case CPUINFO_STR_NAME: strcpy(info->s, "GMS30C2232"); break; |