src/emu/cpu/dsp56k/inst.h
| r8846 | r8847 | |
| 26 | 26 | Instruction(const Opcode* oco) : m_valid(false), |
| 27 | 27 | m_oco(oco), |
| 28 | 28 | m_sizeIncrement(0), |
| 29 | | m_opcode(""), |
| 30 | 29 | m_source(iINVALID), |
| 31 | 30 | m_destination(iINVALID) { } |
| 32 | 31 | virtual ~Instruction() {} |
| r8846 | r8847 | |
| 58 | 57 | size_t m_sizeIncrement; |
| 59 | 58 | |
| 60 | 59 | // Parameters nearly everyone has |
| 61 | | std::string m_opcode; |
| 62 | 60 | reg_id m_source; |
| 63 | 61 | reg_id m_destination; |
| 64 | 62 | }; |
| r8846 | r8847 | |
| 79 | 77 | bool decode(const UINT16 word0, const UINT16 word1) |
| 80 | 78 | { |
| 81 | 79 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 82 | | m_opcode = "abs"; |
| 83 | 80 | return true; |
| 84 | 81 | } |
| 85 | 82 | void disassemble(std::string& retString) const |
| 86 | 83 | { |
| 87 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 84 | retString = "abs " + regIdAsString(m_destination); |
| 88 | 85 | } |
| 89 | 86 | void evaluate(dsp56k_core* cpustate) {} |
| 90 | 87 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 103 | 100 | { |
| 104 | 101 | decode_JF_table(BITSn(word0,0x0001), BITSn(word0,0x0008), |
| 105 | 102 | m_source, m_destination); |
| 106 | | m_opcode = "adc"; |
| 107 | 103 | return true; |
| 108 | 104 | } |
| 109 | 105 | void disassemble(std::string& retString) const |
| 110 | 106 | { |
| 111 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 107 | retString = "adc " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 112 | 108 | } |
| 113 | 109 | void evaluate(dsp56k_core* cpustate) {} |
| 114 | 110 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 127 | 123 | { |
| 128 | 124 | decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08), |
| 129 | 125 | m_source, m_destination); |
| 130 | | m_opcode = "add"; |
| 131 | 126 | return true; |
| 132 | 127 | } |
| 133 | 128 | void disassemble(std::string& retString) const |
| 134 | 129 | { |
| 135 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 130 | retString = "add " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 136 | 131 | } |
| 137 | 132 | void evaluate(dsp56k_core* cpustate) {} |
| 138 | 133 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 147 | 142 | Add_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 148 | 143 | { |
| 149 | 144 | m_arg = ""; |
| 145 | m_opcode = ""; |
| 150 | 146 | m_valid = decode(word0, word1); |
| 151 | 147 | } |
| 152 | 148 | bool decode(const UINT16 word0, const UINT16 word1) |
| r8846 | r8847 | |
| 165 | 161 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 166 | 162 | |
| 167 | 163 | private: |
| 164 | std::string m_opcode; |
| 168 | 165 | std::string m_arg; // TODO: get rid of this Add|Sub thing. |
| 169 | 166 | }; |
| 170 | 167 | |
| r8846 | r8847 | |
| 180 | 177 | { |
| 181 | 178 | decode_JJF_table(BITSn(word0,0x03),BITSn(word0,0x08), |
| 182 | 179 | m_source, m_destination); |
| 183 | | m_opcode = "and"; |
| 184 | 180 | return true; |
| 185 | 181 | } |
| 186 | 182 | void disassemble(std::string& retString) const |
| 187 | 183 | { |
| 188 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 184 | retString = "and " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 189 | 185 | } |
| 190 | 186 | void evaluate(dsp56k_core* cpustate) {} |
| 191 | 187 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 205 | 201 | { |
| 206 | 202 | m_immediate = BITSn(word0,0x00ff); |
| 207 | 203 | decode_EE_table(BITSn(word0,0x0600), m_destination); |
| 208 | | |
| 209 | | m_opcode = "andi"; |
| 210 | | // NEW // sprintf(opcode_str, "and(i)"); |
| 211 | 204 | return true; |
| 212 | 205 | } |
| 213 | 206 | void disassemble(std::string& retString) const |
| 214 | 207 | { |
| 215 | 208 | char temp[32]; |
| 216 | 209 | sprintf(temp, "#$%x,%s", m_immediate, regIdAsString(m_destination).c_str()); |
| 217 | | retString = m_opcode + " " + std::string(temp); |
| 210 | retString = "andi " + std::string(temp); |
| 211 | // NEW // sprintf(opcode_str, "and(i)"); |
| 218 | 212 | } |
| 219 | 213 | void evaluate(dsp56k_core* cpustate) {} |
| 220 | 214 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 235 | 229 | bool decode(const UINT16 word0, const UINT16 word1) |
| 236 | 230 | { |
| 237 | 231 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 238 | | m_opcode = "asl"; |
| 239 | 232 | return true; |
| 240 | 233 | } |
| 241 | 234 | void disassemble(std::string& retString) const |
| 242 | 235 | { |
| 243 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 236 | retString = "asl " + regIdAsString(m_destination); |
| 244 | 237 | } |
| 245 | 238 | void evaluate(dsp56k_core* cpustate) {} |
| 246 | 239 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 258 | 251 | bool decode(const UINT16 word0, const UINT16 word1) |
| 259 | 252 | { |
| 260 | 253 | decode_F_table(BITSn(word0,0x0008), m_destination); |
| 261 | | m_opcode = "asl4"; |
| 262 | 254 | return true; |
| 263 | 255 | } |
| 264 | 256 | void disassemble(std::string& retString) const |
| 265 | 257 | { |
| 266 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 258 | retString = "asl4 " + regIdAsString(m_destination); |
| 267 | 259 | } |
| 268 | 260 | void evaluate(dsp56k_core* cpustate) {} |
| 269 | 261 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 281 | 273 | bool decode(const UINT16 word0, const UINT16 word1) |
| 282 | 274 | { |
| 283 | 275 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 284 | | m_opcode = "asr"; |
| 285 | 276 | return true; |
| 286 | 277 | } |
| 287 | 278 | void disassemble(std::string& retString) const |
| 288 | 279 | { |
| 289 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 280 | retString = "asr " + regIdAsString(m_destination); |
| 290 | 281 | } |
| 291 | 282 | void evaluate(dsp56k_core* cpustate) {} |
| 292 | 283 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 304 | 295 | bool decode(const UINT16 word0, const UINT16 word1) |
| 305 | 296 | { |
| 306 | 297 | decode_F_table(BITSn(word0,0x0008), m_destination); |
| 307 | | m_opcode = "asr4"; |
| 308 | 298 | return true; |
| 309 | 299 | } |
| 310 | 300 | void disassemble(std::string& retString) const |
| 311 | 301 | { |
| 312 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 302 | retString = "asr4 " + regIdAsString(m_destination); |
| 313 | 303 | } |
| 314 | 304 | void evaluate(dsp56k_core* cpustate) {} |
| 315 | 305 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 327 | 317 | bool decode(const UINT16 word0, const UINT16 word1) |
| 328 | 318 | { |
| 329 | 319 | decode_F_table(BITSn(word0,0x0008), m_destination); |
| 330 | | m_opcode = "asr16"; |
| 331 | 320 | return true; |
| 332 | 321 | } |
| 333 | 322 | void disassemble(std::string& retString) const |
| 334 | 323 | { |
| 335 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 324 | retString = "asr16 " + regIdAsString(m_destination); |
| 336 | 325 | } |
| 337 | 326 | void evaluate(dsp56k_core* cpustate) {} |
| 338 | 327 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 350 | 339 | BfInstruction(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 351 | 340 | { |
| 352 | 341 | dString = ""; |
| 342 | m_opcode = ""; |
| 353 | 343 | m_iVal = 0x0000; |
| 354 | 344 | m_valid = decode(word0, word1); |
| 355 | 345 | } |
| r8846 | r8847 | |
| 387 | 377 | { |
| 388 | 378 | char temp[32]; |
| 389 | 379 | sprintf(temp, "#$%x", m_iVal); |
| 380 | retString = m_opcode + " " + std::string(temp) + "," + dString; |
| 390 | 381 | // NEW // sprintf(temp, "#$%04x", iVal); |
| 391 | | std::string source = temp; |
| 392 | | |
| 393 | | retString = m_opcode + " " + source + "," + dString; |
| 394 | 382 | } |
| 395 | 383 | void evaluate(dsp56k_core* cpustate) {} |
| 396 | 384 | size_t size() const { return 2; } |
| 397 | 385 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 398 | 386 | private: |
| 399 | 387 | UINT16 m_iVal; |
| 388 | std::string m_opcode; |
| 400 | 389 | std::string dString; |
| 401 | 390 | }; |
| 402 | 391 | |
| r8846 | r8847 | |
| 410 | 399 | public: |
| 411 | 400 | BfInstruction_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 412 | 401 | { |
| 402 | m_opcode = ""; |
| 413 | 403 | m_r = iINVALID; |
| 414 | 404 | m_iVal = 0x0000; |
| 415 | 405 | m_valid = decode(word0, word1); |
| r8846 | r8847 | |
| 448 | 438 | { |
| 449 | 439 | char temp[32]; |
| 450 | 440 | sprintf(temp, "#$%x", m_iVal); |
| 451 | | // NEW // sprintf(temp, "#$%04x", m_iVal); |
| 452 | 441 | std::string source = temp; |
| 453 | 442 | |
| 454 | 443 | sprintf(temp, "X:(%s)", regIdAsString(m_r).c_str()); |
| 455 | 444 | std::string destination = temp; |
| 456 | 445 | |
| 457 | 446 | retString = m_opcode + " " + source + "," + destination; |
| 447 | // NEW // sprintf(temp, "#$%04x", m_iVal); |
| 458 | 448 | } |
| 459 | 449 | void evaluate(dsp56k_core* cpustate) {} |
| 460 | 450 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 463 | 453 | private: |
| 464 | 454 | reg_id m_r; |
| 465 | 455 | UINT16 m_iVal; |
| 456 | std::string m_opcode; |
| 466 | 457 | }; |
| 467 | 458 | |
| 468 | 459 | /* BFCHG : 0001 0100 100D DDDD BBB1 0010 iiii iiii : A-38 */ |
| r8846 | r8847 | |
| 475 | 466 | public: |
| 476 | 467 | BfInstruction_3(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 477 | 468 | { |
| 469 | m_opcode = ""; |
| 478 | 470 | m_iVal = 0x0000; |
| 479 | 471 | m_valid = decode(word0, word1); |
| 480 | 472 | } |
| r8846 | r8847 | |
| 512 | 504 | { |
| 513 | 505 | char temp[32]; |
| 514 | 506 | sprintf(temp, "#$%x", m_iVal); |
| 515 | | // NEW // sprintf(temp, "#$%04x", m_iVal); |
| 516 | 507 | std::string source = temp; |
| 517 | 508 | |
| 518 | 509 | retString = m_opcode + " " + source + "," + regIdAsString(m_destination); |
| 510 | // NEW // sprintf(temp, "#$%04x", m_iVal); |
| 519 | 511 | } |
| 520 | 512 | void evaluate(dsp56k_core* cpustate) {} |
| 521 | 513 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 523 | 515 | |
| 524 | 516 | private: |
| 525 | 517 | UINT16 m_iVal; |
| 518 | std::string m_opcode; |
| 526 | 519 | }; |
| 527 | 520 | |
| 528 | 521 | // Bcc : 0000 0111 --11 cccc xxxx xxxx xxxx xxxx : A-48 //////////////////////// |
| r8846 | r8847 | |
| 531 | 524 | public: |
| 532 | 525 | Bcc(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 533 | 526 | { |
| 527 | m_mnem = oINVALID; |
| 534 | 528 | m_immediate = 0; |
| 535 | 529 | m_valid = decode(word0, word1); |
| 536 | 530 | } |
| 537 | 531 | bool decode(const UINT16 word0, const UINT16 word1) |
| 538 | 532 | { |
| 539 | 533 | m_immediate = (INT16)word1; |
| 540 | | |
| 541 | | std::string M; |
| 542 | | decode_cccc_table(BITSn(word0,0x000f), M); |
| 543 | | m_opcode = "b" + M; |
| 544 | | // NEW // sprintf(opcode_str, "b.%s", M); |
| 534 | decode_cccc_table(BITSn(word0,0x000f), m_mnem); |
| 545 | 535 | return true; |
| 546 | 536 | } |
| 547 | 537 | void disassemble(std::string& retString) const |
| 548 | 538 | { |
| 539 | std::string opcode = "b" + opMnemonicAsString(m_mnem); |
| 540 | // NEW // sprintf(opcode_str, "b.%s", M); |
| 541 | |
| 549 | 542 | char temp[32]; |
| 550 | 543 | sprintf(temp, ">*+$%x", 2 + m_immediate); |
| 551 | 544 | // NEW // sprintf(temp, "$%04x (%d)", pc + 2 + (INT16)word1, (INT16)word1); |
| 552 | | retString = m_opcode + " " + std::string(temp); |
| 545 | retString = opcode + " " + std::string(temp); |
| 553 | 546 | } |
| 554 | 547 | void evaluate(dsp56k_core* cpustate) {} |
| 555 | 548 | size_t size() const { return 2; } |
| 556 | 549 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 557 | 550 | |
| 558 | 551 | private: |
| 552 | op_mnem m_mnem; |
| 559 | 553 | INT16 m_immediate; |
| 560 | 554 | }; |
| 561 | 555 | |
| r8846 | r8847 | |
| 566 | 560 | Bcc_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 567 | 561 | { |
| 568 | 562 | m_immediate = 0; |
| 563 | m_mnem = oINVALID; |
| 569 | 564 | m_valid = decode(word0, word1); |
| 570 | 565 | } |
| 571 | 566 | bool decode(const UINT16 word0, const UINT16 word1) |
| 572 | 567 | { |
| 573 | | std::string M; |
| 574 | | decode_cccc_table(BITSn(word0,0x3c0), M); |
| 568 | decode_cccc_table(BITSn(word0,0x3c0), m_mnem); |
| 575 | 569 | m_immediate = get_6_bit_signed_value(BITSn(word0,0x003f)); |
| 576 | | m_opcode = "b" + M; |
| 577 | | // NEW // sprintf(opcode_str, "b.%s", M); |
| 578 | 570 | return true; |
| 579 | 571 | } |
| 580 | 572 | void disassemble(std::string& retString) const |
| 581 | 573 | { |
| 574 | std::string opcode = "b" + opMnemonicAsString(m_mnem); |
| 575 | // NEW // sprintf(opcode_str, "b.%s", M); |
| 576 | |
| 582 | 577 | char temp[32]; |
| 583 | 578 | if (m_immediate >= 0) sprintf(temp, "<*+$%x", m_immediate + 1); |
| 584 | 579 | else sprintf(temp, "<*-$%x", 1 - m_immediate - 2); |
| 585 | 580 | // NEW // sprintf(temp, "$%04x (%d)", pc + 1 + relativeInt, relativeInt); |
| 586 | | retString = m_opcode + " " + std::string(temp); |
| 581 | |
| 582 | retString = opcode + " " + std::string(temp); |
| 587 | 583 | } |
| 588 | 584 | void evaluate(dsp56k_core* cpustate) {} |
| 589 | 585 | size_t size() const { return 1; } |
| 590 | 586 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 591 | 587 | |
| 592 | 588 | private: |
| 589 | op_mnem m_mnem; |
| 593 | 590 | INT8 m_immediate; |
| 594 | 591 | }; |
| 595 | 592 | |
| r8846 | r8847 | |
| 599 | 596 | public: |
| 600 | 597 | Bcc_3(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 601 | 598 | { |
| 599 | m_mnem = oINVALID; |
| 602 | 600 | m_valid = decode(word0, word1); |
| 603 | 601 | } |
| 604 | 602 | bool decode(const UINT16 word0, const UINT16 word1) |
| 605 | 603 | { |
| 606 | 604 | decode_RR_table(BITSn(word0,0x00c0), m_destination); |
| 607 | | |
| 608 | | std::string M; |
| 609 | | decode_cccc_table(BITSn(word0,0x000f), M); |
| 610 | | m_opcode = "b" + M; |
| 611 | | // NEW // sprintf(opcode_str, "b.%s", M); |
| 605 | decode_cccc_table(BITSn(word0,0x000f), m_mnem); |
| 612 | 606 | return true; |
| 613 | 607 | } |
| 614 | 608 | void disassemble(std::string& retString) const |
| 615 | 609 | { |
| 616 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 610 | std::string opcode = "b" + opMnemonicAsString(m_mnem); |
| 611 | retString = opcode + " " + regIdAsString(m_destination); |
| 612 | // NEW // sprintf(opcode_str, "b.%s", M); |
| 617 | 613 | } |
| 618 | 614 | void evaluate(dsp56k_core* cpustate) {} |
| 619 | 615 | size_t size() const { return 1; } |
| 620 | 616 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 617 | |
| 618 | private: |
| 619 | op_mnem m_mnem; |
| 621 | 620 | }; |
| 622 | 621 | |
| 623 | 622 | // BRA : 0000 0001 0011 11-- xxxx xxxx xxxx xxxx : A-50 //////////////////////// |
| r8846 | r8847 | |
| 632 | 631 | bool decode(const UINT16 word0, const UINT16 word1) |
| 633 | 632 | { |
| 634 | 633 | m_immediate = (INT16)word1; |
| 635 | | |
| 636 | | m_opcode = "bra"; |
| 637 | 634 | return true; |
| 638 | 635 | } |
| 639 | 636 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 641 | 638 | char temp[32]; |
| 642 | 639 | sprintf(temp, ">*+$%x", 2 + m_immediate); |
| 643 | 640 | // NEW // sprintf(temp, "$%04x (%d)", pc + 2 + word1, (INT16)word1); |
| 644 | | retString = m_opcode + " " + std::string(temp); |
| 641 | retString = "bra " + std::string(temp); |
| 645 | 642 | } |
| 646 | 643 | void evaluate(dsp56k_core* cpustate) {} |
| 647 | 644 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 663 | 660 | bool decode(const UINT16 word0, const UINT16 word1) |
| 664 | 661 | { |
| 665 | 662 | m_immediate = (INT8)BITSn(word0,0x00ff); |
| 666 | | m_opcode = "bra"; |
| 667 | 663 | return true; |
| 668 | 664 | } |
| 669 | 665 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 672 | 668 | if (m_immediate >= 0) sprintf(temp, "<*+$%x", 1 + m_immediate); |
| 673 | 669 | else sprintf(temp, "<*-$%x", 1 - m_immediate - 2); |
| 674 | 670 | // NEW // sprintf(temp, "$%04x (%d)", pc + 1 + iVal, iVal); |
| 675 | | retString = m_opcode + " " + std::string(temp); |
| 671 | retString = "bra " + std::string(temp); |
| 676 | 672 | } |
| 677 | 673 | void evaluate(dsp56k_core* cpustate) {} |
| 678 | 674 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 693 | 689 | bool decode(const UINT16 word0, const UINT16 word1) |
| 694 | 690 | { |
| 695 | 691 | decode_RR_table(BITSn(word0,0x0003), m_destination); |
| 696 | | |
| 697 | | m_opcode = "bra"; |
| 698 | 692 | return true; |
| 699 | 693 | } |
| 700 | 694 | void disassemble(std::string& retString) const |
| 701 | 695 | { |
| 702 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 696 | retString = "bra " + regIdAsString(m_destination); |
| 703 | 697 | } |
| 704 | 698 | void evaluate(dsp56k_core* cpustate) {} |
| 705 | 699 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 712 | 706 | public: |
| 713 | 707 | Brkcc(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 714 | 708 | { |
| 709 | m_mnem = oINVALID; |
| 715 | 710 | m_valid = decode(word0, word1); |
| 716 | 711 | } |
| 717 | 712 | bool decode(const UINT16 word0, const UINT16 word1) |
| 718 | 713 | { |
| 719 | | std::string M; |
| 720 | | decode_cccc_table(BITSn(word0,0x000f), M); |
| 721 | | m_opcode = "brk" + M; |
| 722 | | // NEW // sprintf(opcode_str, "brk.%s", M); |
| 714 | decode_cccc_table(BITSn(word0,0x000f), m_mnem); |
| 723 | 715 | return true; |
| 724 | 716 | } |
| 725 | 717 | void disassemble(std::string& retString) const |
| 726 | 718 | { |
| 727 | | retString = m_opcode; |
| 719 | std::string opcode = "brk" + opMnemonicAsString(m_mnem); |
| 720 | retString = opcode; |
| 721 | // NEW // sprintf(opcode_str, "brk.%s", M); |
| 728 | 722 | } |
| 729 | 723 | void evaluate(dsp56k_core* cpustate) {} |
| 730 | 724 | size_t size() const { return 1; } |
| 731 | 725 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 726 | |
| 727 | private: |
| 728 | op_mnem m_mnem; |
| 732 | 729 | }; |
| 733 | 730 | |
| 734 | 731 | // BScc : 0000 0111 --01 cccc xxxx xxxx xxxx xxxx : A-54 /////////////////////// |
| r8846 | r8847 | |
| 738 | 735 | Bscc(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 739 | 736 | { |
| 740 | 737 | m_immediate = 0; |
| 738 | m_mnem = oINVALID; |
| 741 | 739 | m_valid = decode(word0, word1); |
| 742 | 740 | } |
| 743 | 741 | bool decode(const UINT16 word0, const UINT16 word1) |
| 744 | 742 | { |
| 745 | 743 | m_immediate = (INT16)word1; |
| 746 | | |
| 747 | | std::string M; |
| 748 | | decode_cccc_table(BITSn(word0,0x000f), M); |
| 749 | | m_opcode = "bs" + M; |
| 750 | | // NEW // sprintf(opcode_str, "bs.%s", M); |
| 744 | decode_cccc_table(BITSn(word0,0x000f), m_mnem); |
| 751 | 745 | return true; |
| 752 | 746 | } |
| 753 | 747 | void disassemble(std::string& retString) const |
| 754 | 748 | { |
| 749 | std::string opcode = "bs" + opMnemonicAsString(m_mnem); |
| 750 | // NEW // sprintf(opcode_str, "bs.%s", M); |
| 751 | |
| 755 | 752 | char temp[32]; |
| 756 | 753 | if (m_immediate >= 0) sprintf(temp, ">*+$%x", 2 + m_immediate); |
| 757 | 754 | else sprintf(temp, ">*-$%x", 1 - m_immediate - 1 - 2); |
| 758 | 755 | //sprintf(temp, ">*+$%x", 2 + m_immediate); |
| 759 | 756 | // NEW // sprintf(temp, "$%04x (%d)", pc + 2 + (INT16)word1, (INT16)word1); |
| 760 | | retString = m_opcode + " " + std::string(temp); |
| 757 | retString = opcode + " " + std::string(temp); |
| 761 | 758 | } |
| 762 | 759 | void evaluate(dsp56k_core* cpustate) {} |
| 763 | 760 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 765 | 762 | size_t flags() { return DASMFLAG_STEP_OVER; } |
| 766 | 763 | |
| 767 | 764 | private: |
| 765 | op_mnem m_mnem; |
| 768 | 766 | INT16 m_immediate; |
| 769 | 767 | }; |
| 770 | 768 | |
| r8846 | r8847 | |
| 774 | 772 | public: |
| 775 | 773 | Bscc_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 776 | 774 | { |
| 775 | m_mnem = oINVALID; |
| 777 | 776 | m_valid = decode(word0, word1); |
| 778 | 777 | } |
| 779 | 778 | bool decode(const UINT16 word0, const UINT16 word1) |
| 780 | 779 | { |
| 781 | 780 | decode_RR_table(BITSn(word0,0x00c0), m_destination); |
| 782 | | |
| 783 | | std::string M; |
| 784 | | decode_cccc_table(BITSn(word0,0x000f), M); |
| 785 | | |
| 786 | | m_opcode = "bs" + M; |
| 787 | | // NEW // sprintf(opcode_str, "bs.%s", M); |
| 781 | decode_cccc_table(BITSn(word0,0x000f), m_mnem); |
| 788 | 782 | return true; |
| 789 | 783 | } |
| 790 | 784 | void disassemble(std::string& retString) const |
| 791 | 785 | { |
| 792 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 786 | std::string opcode = "bs" + opMnemonicAsString(m_mnem); |
| 787 | retString = opcode + " " + regIdAsString(m_destination); |
| 788 | // NEW // sprintf(opcode_str, "bs.%s", M); |
| 793 | 789 | } |
| 794 | 790 | void evaluate(dsp56k_core* cpustate) {} |
| 795 | 791 | size_t size() const { return 1; } |
| 796 | 792 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 797 | 793 | size_t flags() { return DASMFLAG_STEP_OVER; } |
| 794 | |
| 795 | private: |
| 796 | op_mnem m_mnem; |
| 798 | 797 | }; |
| 799 | 798 | |
| 800 | 799 | // BSR : 0000 0001 0011 10-- xxxx xxxx xxxx xxxx : A-56 //////////////////////// |
| r8846 | r8847 | |
| 809 | 808 | bool decode(const UINT16 word0, const UINT16 word1) |
| 810 | 809 | { |
| 811 | 810 | m_immediate = (INT16)word1; |
| 812 | | |
| 813 | | m_opcode = "bsr"; |
| 814 | 811 | return true; |
| 815 | 812 | } |
| 816 | 813 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 819 | 816 | if (m_immediate >= 0) sprintf(temp, ">*+$%x", 2 + m_immediate); |
| 820 | 817 | else sprintf(temp, ">*-$%x", 1 - m_immediate - 1 - 2); |
| 821 | 818 | // NEW // sprintf(temp, "$%04x (%d)", pc + 2 + (INT16)word1, (INT16)word1); |
| 822 | | retString = m_opcode + " " + std::string(temp); |
| 819 | retString = "bsr " + std::string(temp); |
| 823 | 820 | } |
| 824 | 821 | void evaluate(dsp56k_core* cpustate) {} |
| 825 | 822 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 841 | 838 | bool decode(const UINT16 word0, const UINT16 word1) |
| 842 | 839 | { |
| 843 | 840 | decode_RR_table(BITSn(word0,0x0003), m_destination); |
| 844 | | |
| 845 | | m_opcode = "bsr"; |
| 846 | 841 | return true; |
| 847 | 842 | } |
| 848 | 843 | void disassemble(std::string& retString) const |
| 849 | 844 | { |
| 850 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 845 | retString = "bsr " + regIdAsString(m_destination); |
| 851 | 846 | } |
| 852 | 847 | void evaluate(dsp56k_core* cpustate) {} |
| 853 | 848 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 865 | 860 | } |
| 866 | 861 | bool decode(const UINT16 word0, const UINT16 word1) |
| 867 | 862 | { |
| 868 | | m_opcode = "chkaau"; |
| 869 | 863 | return true; |
| 870 | 864 | } |
| 871 | 865 | void disassemble(std::string& retString) const |
| 872 | 866 | { |
| 873 | | retString = m_opcode; |
| 867 | retString = "chkaau"; |
| 874 | 868 | } |
| 875 | 869 | void evaluate(dsp56k_core* cpustate) {} |
| 876 | 870 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 888 | 882 | bool decode(const UINT16 word0, const UINT16 word1) |
| 889 | 883 | { |
| 890 | 884 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 891 | | m_opcode = "clr"; |
| 892 | 885 | return true; |
| 893 | 886 | } |
| 894 | 887 | void disassemble(std::string& retString) const |
| 895 | 888 | { |
| 896 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 889 | retString = "clr " + regIdAsString(m_destination); |
| 897 | 890 | } |
| 898 | 891 | void evaluate(dsp56k_core* cpustate) {} |
| 899 | 892 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 911 | 904 | bool decode(const UINT16 word0, const UINT16 word1) |
| 912 | 905 | { |
| 913 | 906 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 914 | | m_opcode = "clr24"; |
| 915 | 907 | return true; |
| 916 | 908 | } |
| 917 | 909 | void disassemble(std::string& retString) const |
| 918 | 910 | { |
| 919 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 911 | retString = "clr24 " + regIdAsString(m_destination); |
| 920 | 912 | } |
| 921 | 913 | void evaluate(dsp56k_core* cpustate) {} |
| 922 | 914 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 937 | 929 | in before cmp, so the same decode function can be used. */ |
| 938 | 930 | decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08), |
| 939 | 931 | m_source, m_destination); |
| 940 | | m_opcode = "cmp"; |
| 941 | 932 | return true; |
| 942 | 933 | } |
| 943 | 934 | void disassemble(std::string& retString) const |
| 944 | 935 | { |
| 945 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 936 | retString = "cmp " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 946 | 937 | } |
| 947 | 938 | void evaluate(dsp56k_core* cpustate) {} |
| 948 | 939 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 963 | 954 | in before cmp, so the same decode function can be used. */ |
| 964 | 955 | decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08), |
| 965 | 956 | m_source, m_destination); |
| 966 | | m_opcode = "cmpm"; |
| 967 | 957 | return true; |
| 968 | 958 | } |
| 969 | 959 | void disassemble(std::string& retString) const |
| 970 | 960 | { |
| 971 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 961 | retString = "cmpm " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 972 | 962 | } |
| 973 | 963 | void evaluate(dsp56k_core* cpustate) {} |
| 974 | 964 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 985 | 975 | } |
| 986 | 976 | bool decode(const UINT16 word0, const UINT16 word1) |
| 987 | 977 | { |
| 988 | | m_opcode = "debug"; |
| 989 | 978 | return true; |
| 990 | 979 | } |
| 991 | 980 | void disassemble(std::string& retString) const |
| 992 | 981 | { |
| 993 | | retString = m_opcode; |
| 982 | retString = "debug"; |
| 994 | 983 | } |
| 995 | 984 | void evaluate(dsp56k_core* cpustate) {} |
| 996 | 985 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1003 | 992 | public: |
| 1004 | 993 | Debugcc(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 1005 | 994 | { |
| 995 | m_mnem = oINVALID; |
| 1006 | 996 | m_valid = decode(word0, word1); |
| 1007 | 997 | } |
| 1008 | 998 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1009 | 999 | { |
| 1010 | | std::string M; |
| 1011 | | decode_cccc_table(BITSn(word0,0x000f), M); |
| 1012 | | m_opcode = "debug" + M; |
| 1013 | | // NEW // sprintf(opcode_str, "debug.%s", M); |
| 1000 | decode_cccc_table(BITSn(word0,0x000f), m_mnem); |
| 1014 | 1001 | return true; |
| 1015 | 1002 | } |
| 1016 | 1003 | void disassemble(std::string& retString) const |
| 1017 | 1004 | { |
| 1018 | | retString = m_opcode; |
| 1005 | std::string opcode = "debug" + opMnemonicAsString(m_mnem); |
| 1006 | retString = opcode; |
| 1007 | // NEW // sprintf(opcode_str, "debug.%s", M); |
| 1019 | 1008 | } |
| 1020 | 1009 | void evaluate(dsp56k_core* cpustate) {} |
| 1021 | 1010 | size_t size() const { return 1; } |
| 1022 | 1011 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 1012 | |
| 1013 | private: |
| 1014 | op_mnem m_mnem; |
| 1023 | 1015 | }; |
| 1024 | 1016 | |
| 1025 | 1017 | // DEC : .... .... 0110 F010 : A-72 //////////////////////////////////////////// |
| r8846 | r8847 | |
| 1033 | 1025 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1034 | 1026 | { |
| 1035 | 1027 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 1036 | | m_opcode = "dec"; |
| 1037 | 1028 | return true; |
| 1038 | 1029 | } |
| 1039 | 1030 | void disassemble(std::string& retString) const |
| 1040 | 1031 | { |
| 1041 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 1032 | retString = "dec " + regIdAsString(m_destination); |
| 1042 | 1033 | } |
| 1043 | 1034 | void evaluate(dsp56k_core* cpustate) {} |
| 1044 | 1035 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1056 | 1047 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1057 | 1048 | { |
| 1058 | 1049 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 1059 | | m_opcode = "dec24"; |
| 1060 | 1050 | return true; |
| 1061 | 1051 | } |
| 1062 | 1052 | void disassemble(std::string& retString) const |
| 1063 | 1053 | { |
| 1064 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 1054 | retString = "dec24 " + regIdAsString(m_destination); |
| 1065 | 1055 | } |
| 1066 | 1056 | void evaluate(dsp56k_core* cpustate) {} |
| 1067 | 1057 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1080 | 1070 | { |
| 1081 | 1071 | decode_DDF_table(BITSn(word0,0x0003), BITSn(word0,0x0008), |
| 1082 | 1072 | m_source, m_destination); |
| 1083 | | m_opcode = "div"; |
| 1084 | 1073 | return true; |
| 1085 | 1074 | } |
| 1086 | 1075 | void disassemble(std::string& retString) const |
| 1087 | 1076 | { |
| 1088 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 1077 | retString = "div " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 1089 | 1078 | } |
| 1090 | 1079 | void evaluate(dsp56k_core* cpustate) {} |
| 1091 | 1080 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1098 | 1087 | public: |
| 1099 | 1088 | Dmac(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 1100 | 1089 | { |
| 1090 | m_mnem = oINVALID; |
| 1101 | 1091 | m_source2 = iINVALID; |
| 1102 | 1092 | m_valid = decode(word0, word1); |
| 1103 | 1093 | } |
| r8846 | r8847 | |
| 1106 | 1096 | decode_QQF_special_table(BITSn(word0,0x0003), BITSn(word0,0x0008), |
| 1107 | 1097 | m_source, m_source2, m_destination); |
| 1108 | 1098 | |
| 1109 | | std::string a; |
| 1110 | | decode_ss_table(BITSn(word0,0x0024), a); |
| 1111 | | if (a == "!!") return false; |
| 1112 | | |
| 1113 | | m_opcode = "dmac" + a; |
| 1114 | | // NEW // sprintf(opcode_str, "dmac(%s)", A); |
| 1099 | decode_ss_table(BITSn(word0,0x0024), m_mnem); |
| 1100 | if (m_mnem == oINVALID) return false; |
| 1115 | 1101 | return true; |
| 1116 | 1102 | } |
| 1117 | 1103 | void disassemble(std::string& retString) const |
| 1118 | 1104 | { |
| 1119 | | retString = m_opcode + " " + |
| 1105 | std::string opcode = "dmac" + opMnemonicAsString(m_mnem); |
| 1106 | |
| 1107 | retString = opcode + " " + |
| 1120 | 1108 | regIdAsString(m_source) + "," + |
| 1121 | 1109 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 1110 | // NEW // sprintf(opcode_str, "dmac(%s)", A); |
| 1122 | 1111 | } |
| 1123 | 1112 | void evaluate(dsp56k_core* cpustate) {} |
| 1124 | 1113 | size_t size() const { return 1; } |
| 1125 | 1114 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 1126 | 1115 | |
| 1127 | 1116 | private: |
| 1117 | op_mnem m_mnem; |
| 1128 | 1118 | reg_id m_source2; |
| 1129 | 1119 | }; |
| 1130 | 1120 | |
| r8846 | r8847 | |
| 1140 | 1130 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1141 | 1131 | { |
| 1142 | 1132 | m_immediate = word1; |
| 1143 | | |
| 1144 | 1133 | decode_RR_table(BITSn(word0,0x0003), m_source); |
| 1145 | | |
| 1146 | | m_opcode = "do"; |
| 1147 | 1134 | return true; |
| 1148 | 1135 | } |
| 1149 | 1136 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 1156 | 1143 | sprintf(temp, "X:(%s)", regIdAsString(m_source).c_str()); |
| 1157 | 1144 | std::string source = temp; |
| 1158 | 1145 | |
| 1159 | | retString = m_opcode + " " + source + "," + destination; |
| 1146 | retString = "do " + source + "," + destination; |
| 1160 | 1147 | } |
| 1161 | 1148 | void evaluate(dsp56k_core* cpustate) {} |
| 1162 | 1149 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 1180 | 1167 | { |
| 1181 | 1168 | m_immediate = BITSn(word0,0x00ff); |
| 1182 | 1169 | m_displacement = word1; |
| 1183 | | |
| 1184 | | m_opcode = "do"; |
| 1185 | 1170 | return true; |
| 1186 | 1171 | } |
| 1187 | 1172 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 1189 | 1174 | char temp[32]; |
| 1190 | 1175 | sprintf(temp, "#<$%x,*+$%x", m_immediate, 2 + m_displacement); |
| 1191 | 1176 | // NEW // sprintf(temp, "#$%02x,$%04x", BITSn(word0,0x00ff), pc + 2 + word1); |
| 1192 | | retString = m_opcode + " " + std::string(temp); |
| 1177 | retString = "do " + std::string(temp); |
| 1193 | 1178 | } |
| 1194 | 1179 | void evaluate(dsp56k_core* cpustate) {} |
| 1195 | 1180 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 1214 | 1199 | m_displacement = word1; |
| 1215 | 1200 | |
| 1216 | 1201 | decode_DDDDD_table(BITSn(word0,0x001f), m_source); |
| 1217 | | if (m_source == iSSH) return false; // NEW // |
| 1218 | | if (m_source == iINVALID) return false; // NEW // |
| 1219 | | m_opcode = "do"; |
| 1202 | if (m_source == iSSH) return false; |
| 1203 | if (m_source == iINVALID) return false; |
| 1220 | 1204 | return true; |
| 1221 | 1205 | } |
| 1222 | 1206 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 1224 | 1208 | char temp[32]; |
| 1225 | 1209 | sprintf(temp, "*+$%x", 2 + m_displacement); |
| 1226 | 1210 | // NEW // sprintf(temp, "%s,$%04x", S1, pc + 2 + word1); |
| 1227 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + std::string(temp); |
| 1211 | retString = "do " + regIdAsString(m_source) + "," + std::string(temp); |
| 1228 | 1212 | } |
| 1229 | 1213 | void evaluate(dsp56k_core* cpustate) {} |
| 1230 | 1214 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 1246 | 1230 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1247 | 1231 | { |
| 1248 | 1232 | m_displacement = word1; |
| 1249 | | m_opcode = "do forever"; |
| 1250 | 1233 | return true; |
| 1251 | 1234 | } |
| 1252 | 1235 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 1255 | 1238 | sprintf(temp, "*+$%x", m_displacement + 2); |
| 1256 | 1239 | // NEW // sprintf(temp, "*+$%x", pc + word1); |
| 1257 | 1240 | // NEW // sprintf(temp, "$%04x", pc + 2 + word1); |
| 1258 | | retString = m_opcode + ", " + std::string(temp); |
| 1241 | retString = "do forever, " + std::string(temp); |
| 1259 | 1242 | } |
| 1260 | 1243 | void evaluate(dsp56k_core* cpustate) {} |
| 1261 | 1244 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 1275 | 1258 | } |
| 1276 | 1259 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1277 | 1260 | { |
| 1278 | | m_opcode = "enddo"; |
| 1279 | 1261 | return true; |
| 1280 | 1262 | } |
| 1281 | 1263 | void disassemble(std::string& retString) const |
| 1282 | 1264 | { |
| 1283 | | retString = m_opcode; |
| 1265 | retString = "enddo"; |
| 1284 | 1266 | } |
| 1285 | 1267 | void evaluate(dsp56k_core* cpustate) {} |
| 1286 | 1268 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1299 | 1281 | { |
| 1300 | 1282 | decode_JJF_table(BITSn(word0,0x03),BITSn(word0,0x08), |
| 1301 | 1283 | m_source, m_destination); |
| 1302 | | m_opcode = "eor"; |
| 1303 | 1284 | return true; |
| 1304 | 1285 | } |
| 1305 | 1286 | void disassemble(std::string& retString) const |
| 1306 | 1287 | { |
| 1307 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 1288 | retString = "eor " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 1308 | 1289 | } |
| 1309 | 1290 | void evaluate(dsp56k_core* cpustate) {} |
| 1310 | 1291 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1322 | 1303 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1323 | 1304 | { |
| 1324 | 1305 | decode_F_table(BITSn(word0,0x0008), m_destination); |
| 1325 | | m_opcode = "ext"; |
| 1326 | 1306 | return true; |
| 1327 | 1307 | } |
| 1328 | 1308 | void disassemble(std::string& retString) const |
| 1329 | 1309 | { |
| 1330 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 1310 | retString = "ext " + regIdAsString(m_destination); |
| 1331 | 1311 | } |
| 1332 | 1312 | void evaluate(dsp56k_core* cpustate) {} |
| 1333 | 1313 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1344 | 1324 | } |
| 1345 | 1325 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1346 | 1326 | { |
| 1347 | | m_opcode = "illegal"; |
| 1348 | 1327 | return true; |
| 1349 | 1328 | } |
| 1350 | 1329 | void disassemble(std::string& retString) const |
| 1351 | 1330 | { |
| 1352 | | retString = m_opcode; |
| 1331 | retString = "illegal"; |
| 1353 | 1332 | } |
| 1354 | 1333 | void evaluate(dsp56k_core* cpustate) {} |
| 1355 | 1334 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1369 | 1348 | { |
| 1370 | 1349 | decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008), |
| 1371 | 1350 | m_source, m_source2, m_destination); |
| 1372 | | m_opcode = "imac"; |
| 1373 | 1351 | return true; |
| 1374 | 1352 | } |
| 1375 | 1353 | void disassemble(std::string& retString) const |
| 1376 | 1354 | { |
| 1377 | | retString = m_opcode + " " + |
| 1355 | retString = "imac " + |
| 1378 | 1356 | regIdAsString(m_source) + "," + |
| 1379 | 1357 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 1380 | 1358 | } |
| r8846 | r8847 | |
| 1399 | 1377 | { |
| 1400 | 1378 | decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008), |
| 1401 | 1379 | m_source, m_source2, m_destination); |
| 1402 | | m_opcode = "impy"; |
| 1403 | 1380 | return true; |
| 1404 | 1381 | } |
| 1405 | 1382 | void disassemble(std::string& retString) const |
| 1406 | 1383 | { |
| 1407 | | retString = m_opcode + " " + |
| 1384 | retString = "impy " + |
| 1408 | 1385 | regIdAsString(m_source) + "," + |
| 1409 | 1386 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 1410 | 1387 | } |
| r8846 | r8847 | |
| 1427 | 1404 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1428 | 1405 | { |
| 1429 | 1406 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 1430 | | m_opcode = "inc"; |
| 1431 | 1407 | return true; |
| 1432 | 1408 | } |
| 1433 | 1409 | void disassemble(std::string& retString) const |
| 1434 | 1410 | { |
| 1435 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 1411 | retString = "inc " + regIdAsString(m_destination); |
| 1436 | 1412 | } |
| 1437 | 1413 | void evaluate(dsp56k_core* cpustate) {} |
| 1438 | 1414 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1450 | 1426 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1451 | 1427 | { |
| 1452 | 1428 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 1453 | | m_opcode = "inc24"; |
| 1454 | 1429 | return true; |
| 1455 | 1430 | } |
| 1456 | 1431 | void disassemble(std::string& retString) const |
| 1457 | 1432 | { |
| 1458 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 1433 | retString = "inc24 " + regIdAsString(m_destination); |
| 1459 | 1434 | } |
| 1460 | 1435 | void evaluate(dsp56k_core* cpustate) {} |
| 1461 | 1436 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1468 | 1443 | public: |
| 1469 | 1444 | Jcc(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 1470 | 1445 | { |
| 1446 | m_mnem = oINVALID; |
| 1471 | 1447 | m_displacement = 0; |
| 1472 | 1448 | m_valid = decode(word0, word1); |
| 1473 | 1449 | } |
| 1474 | 1450 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1475 | 1451 | { |
| 1476 | 1452 | m_displacement = word1; |
| 1477 | | |
| 1478 | | std::string M; |
| 1479 | | decode_cccc_table(BITSn(word0,0x000f), M); |
| 1480 | | m_opcode = "j" + M; |
| 1481 | | // NEW // sprintf(opcode_str, "j.%s", M); |
| 1453 | decode_cccc_table(BITSn(word0,0x000f), m_mnem); |
| 1482 | 1454 | return true; |
| 1483 | 1455 | } |
| 1484 | 1456 | void disassemble(std::string& retString) const |
| 1485 | 1457 | { |
| 1458 | std::string opcode = "j" + opMnemonicAsString(m_mnem); |
| 1459 | // NEW // sprintf(opcode_str, "j.%s", M); |
| 1460 | |
| 1486 | 1461 | char temp[32]; |
| 1487 | 1462 | sprintf(temp, ">$%x", m_displacement); |
| 1488 | 1463 | // NEW // sprintf(temp, "$%04x", word1); |
| 1489 | | retString = m_opcode + " " + std::string(temp); |
| 1464 | retString = opcode + " " + std::string(temp); |
| 1490 | 1465 | } |
| 1491 | 1466 | void evaluate(dsp56k_core* cpustate) {} |
| 1492 | 1467 | size_t size() const { return 2; } |
| 1493 | 1468 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 1494 | 1469 | |
| 1495 | 1470 | private: |
| 1471 | op_mnem m_mnem; |
| 1496 | 1472 | UINT16 m_displacement; |
| 1497 | 1473 | }; |
| 1498 | 1474 | |
| r8846 | r8847 | |
| 1502 | 1478 | public: |
| 1503 | 1479 | Jcc_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 1504 | 1480 | { |
| 1481 | m_mnem = oINVALID; |
| 1505 | 1482 | m_valid = decode(word0, word1); |
| 1506 | 1483 | } |
| 1507 | 1484 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1508 | 1485 | { |
| 1509 | 1486 | decode_RR_table(BITSn(word0,0x00c0), m_destination); |
| 1510 | | |
| 1511 | | std::string M; |
| 1512 | | decode_cccc_table(BITSn(word0,0x000f), M); |
| 1513 | | m_opcode = "j" + M; |
| 1514 | | // NEW // sprintf(opcode_str, "j.%s", M); |
| 1487 | decode_cccc_table(BITSn(word0,0x000f), m_mnem); |
| 1515 | 1488 | return true; |
| 1516 | 1489 | } |
| 1517 | 1490 | void disassemble(std::string& retString) const |
| 1518 | 1491 | { |
| 1519 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 1492 | std::string opcode = "j" + opMnemonicAsString(m_mnem); |
| 1493 | retString = opcode + " " + regIdAsString(m_destination); |
| 1494 | // NEW // sprintf(opcode_str, "j.%s", M); |
| 1520 | 1495 | } |
| 1521 | 1496 | void evaluate(dsp56k_core* cpustate) {} |
| 1522 | 1497 | size_t size() const { return 1; } |
| 1523 | 1498 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 1499 | |
| 1500 | private: |
| 1501 | op_mnem m_mnem; |
| 1524 | 1502 | }; |
| 1525 | 1503 | |
| 1526 | 1504 | // JMP : 0000 0001 0011 01-- xxxx xxxx xxxx xxxx : A-110 /////////////////////// |
| r8846 | r8847 | |
| 1535 | 1513 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1536 | 1514 | { |
| 1537 | 1515 | m_displacement = word1; |
| 1538 | | |
| 1539 | | m_opcode = "jmp"; |
| 1540 | 1516 | return true; |
| 1541 | 1517 | } |
| 1542 | 1518 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 1544 | 1520 | char temp[32]; |
| 1545 | 1521 | sprintf(temp, ">$%x", m_displacement); |
| 1546 | 1522 | // NEW // sprintf(temp, "$%04x", word1); |
| 1547 | | retString = m_opcode + " " + std::string(temp); |
| 1523 | retString = "jmp " + std::string(temp); |
| 1548 | 1524 | } |
| 1549 | 1525 | void evaluate(dsp56k_core* cpustate) |
| 1550 | 1526 | { |
| r8846 | r8847 | |
| 1573 | 1549 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1574 | 1550 | { |
| 1575 | 1551 | decode_RR_table(BITSn(word0,0x0003), m_destination); |
| 1576 | | |
| 1577 | | m_opcode = "jmp"; |
| 1578 | 1552 | return true; |
| 1579 | 1553 | } |
| 1580 | 1554 | void disassemble(std::string& retString) const |
| 1581 | 1555 | { |
| 1582 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 1556 | retString = "jmp " + regIdAsString(m_destination); |
| 1583 | 1557 | } |
| 1584 | 1558 | void evaluate(dsp56k_core* cpustate) |
| 1585 | 1559 | { |
| r8846 | r8847 | |
| 1602 | 1576 | public: |
| 1603 | 1577 | Jscc(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 1604 | 1578 | { |
| 1579 | m_mnem = oINVALID; |
| 1605 | 1580 | m_displacement = 0; |
| 1606 | 1581 | m_valid = decode(word0, word1); |
| 1607 | 1582 | } |
| 1608 | 1583 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1609 | 1584 | { |
| 1610 | 1585 | m_displacement = word1; |
| 1611 | | |
| 1612 | | std::string M; |
| 1613 | | decode_cccc_table(BITSn(word0,0x000f), M); |
| 1614 | | m_opcode = "js" + M; |
| 1615 | | // NEW // sprintf(opcode_str, "js.%s", M); |
| 1586 | decode_cccc_table(BITSn(word0,0x000f), m_mnem); |
| 1616 | 1587 | return true; |
| 1617 | 1588 | } |
| 1618 | 1589 | void disassemble(std::string& retString) const |
| 1619 | 1590 | { |
| 1591 | std::string opcode = "js" + opMnemonicAsString(m_mnem); |
| 1592 | // NEW // sprintf(opcode_str, "js.%s", M); |
| 1593 | |
| 1620 | 1594 | char temp[32]; |
| 1621 | 1595 | sprintf(temp, ">$%x", m_displacement); |
| 1622 | 1596 | // NEW // sprintf(temp, "$%04x", word1); |
| 1623 | | retString = m_opcode + " " + std::string(temp); |
| 1597 | retString = opcode + " " + std::string(temp); |
| 1624 | 1598 | } |
| 1625 | 1599 | void evaluate(dsp56k_core* cpustate) {} |
| 1626 | 1600 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 1628 | 1602 | size_t flags() { return DASMFLAG_STEP_OVER; } |
| 1629 | 1603 | |
| 1630 | 1604 | private: |
| 1605 | op_mnem m_mnem; |
| 1631 | 1606 | UINT16 m_displacement; |
| 1632 | 1607 | }; |
| 1633 | 1608 | |
| r8846 | r8847 | |
| 1637 | 1612 | public: |
| 1638 | 1613 | Jscc_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 1639 | 1614 | { |
| 1615 | m_mnem = oINVALID; |
| 1640 | 1616 | m_valid = decode(word0, word1); |
| 1641 | 1617 | } |
| 1642 | 1618 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1643 | 1619 | { |
| 1644 | 1620 | decode_RR_table(BITSn(word0,0x00c0), m_destination); |
| 1645 | | |
| 1646 | | std::string M; |
| 1647 | | decode_cccc_table(BITSn(word0,0x000f), M); |
| 1648 | | m_opcode = "js" + M; |
| 1649 | | // NEW // sprintf(opcode_str, "js.%s", M); |
| 1621 | decode_cccc_table(BITSn(word0,0x000f), m_mnem); |
| 1650 | 1622 | return true; |
| 1651 | 1623 | } |
| 1652 | 1624 | void disassemble(std::string& retString) const |
| 1653 | 1625 | { |
| 1654 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 1626 | std::string opcode = "js" + opMnemonicAsString(m_mnem); |
| 1627 | retString = opcode + " " + regIdAsString(m_destination); |
| 1628 | // NEW // sprintf(opcode_str, "js.%s", M); |
| 1655 | 1629 | } |
| 1656 | 1630 | void evaluate(dsp56k_core* cpustate) {} |
| 1657 | 1631 | size_t size() const { return 1; } |
| 1658 | 1632 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 1659 | 1633 | size_t flags() { return DASMFLAG_STEP_OVER; } |
| 1634 | |
| 1635 | private: |
| 1636 | op_mnem m_mnem; |
| 1660 | 1637 | }; |
| 1661 | 1638 | |
| 1662 | 1639 | // JSR : 0000 0001 0011 00-- xxxx xxxx xxxx xxxx : A-114 /////////////////////// |
| r8846 | r8847 | |
| 1671 | 1648 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1672 | 1649 | { |
| 1673 | 1650 | m_displacement = word1; |
| 1674 | | |
| 1675 | | m_opcode = "jsr"; |
| 1676 | 1651 | return true; |
| 1677 | 1652 | } |
| 1678 | 1653 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 1680 | 1655 | char temp[32]; |
| 1681 | 1656 | sprintf(temp, ">$%x", m_displacement); |
| 1682 | 1657 | // NEW // sprintf(temp, "$%04x", word1); |
| 1683 | | retString = m_opcode + " " + std::string(temp); |
| 1658 | retString = "jsr " + std::string(temp); |
| 1684 | 1659 | } |
| 1685 | 1660 | void evaluate(dsp56k_core* cpustate) {} |
| 1686 | 1661 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 1703 | 1678 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1704 | 1679 | { |
| 1705 | 1680 | m_bAddr = BITSn(word0,0x00ff); |
| 1706 | | |
| 1707 | | m_opcode = "jsr"; |
| 1708 | 1681 | return true; |
| 1709 | 1682 | } |
| 1710 | 1683 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 1712 | 1685 | char temp[32]; |
| 1713 | 1686 | sprintf(temp, "<$%x", m_bAddr); |
| 1714 | 1687 | // NEW // sprintf(temp, "#$%02x", BITSn(word0,0x00ff)); |
| 1715 | | retString = m_opcode + " " + std::string(temp); |
| 1688 | retString = "jsr " + std::string(temp); |
| 1716 | 1689 | } |
| 1717 | 1690 | void evaluate(dsp56k_core* cpustate) {} |
| 1718 | 1691 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1734 | 1707 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1735 | 1708 | { |
| 1736 | 1709 | decode_RR_table(BITSn(word0,0x0003), m_destination); |
| 1737 | | |
| 1738 | | m_opcode = "jsr"; |
| 1739 | 1710 | return true; |
| 1740 | 1711 | } |
| 1741 | 1712 | void disassemble(std::string& retString) const |
| 1742 | 1713 | { |
| 1743 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 1714 | retString = "jsr " + regIdAsString(m_destination); |
| 1744 | 1715 | } |
| 1745 | 1716 | void evaluate(dsp56k_core* cpustate) {} |
| 1746 | 1717 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1765 | 1736 | |
| 1766 | 1737 | INT8 rNum = BITSn(word0,0x0003); |
| 1767 | 1738 | assemble_ea_from_MM_table(BITSn(word0,0x000c), rNum, m_ea); |
| 1768 | | |
| 1769 | | m_opcode = "lea"; |
| 1739 | |
| 1770 | 1740 | return true; |
| 1771 | 1741 | } |
| 1772 | 1742 | void disassemble(std::string& retString) const |
| 1773 | 1743 | { |
| 1774 | 1744 | // HACK |
| 1775 | | retString = m_opcode + " " + m_ea + "," + regIdAsString(m_destination); |
| 1745 | retString = "lea " + m_ea + "," + regIdAsString(m_destination); |
| 1776 | 1746 | } |
| 1777 | 1747 | void evaluate(dsp56k_core* cpustate) {} |
| 1778 | 1748 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1799 | 1769 | INT8 rNum = BITSn(word0,0x0003); |
| 1800 | 1770 | assemble_ea_from_MM_table(BITSn(word0,0x000c), rNum, m_ea); |
| 1801 | 1771 | |
| 1802 | | m_opcode = "lea"; |
| 1803 | 1772 | return true; |
| 1804 | 1773 | } |
| 1805 | 1774 | void disassemble(std::string& retString) const |
| 1806 | 1775 | { |
| 1807 | 1776 | // HACK |
| 1808 | | retString = m_opcode + " " + m_ea + "," + regIdAsString(m_destination); |
| 1777 | retString = "lea " + m_ea + "," + regIdAsString(m_destination); |
| 1809 | 1778 | } |
| 1810 | 1779 | void evaluate(dsp56k_core* cpustate) {} |
| 1811 | 1780 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1826 | 1795 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1827 | 1796 | { |
| 1828 | 1797 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 1829 | | m_opcode = "lsl"; |
| 1830 | 1798 | return true; |
| 1831 | 1799 | } |
| 1832 | 1800 | void disassemble(std::string& retString) const |
| 1833 | 1801 | { |
| 1834 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 1802 | retString = "lsl " + regIdAsString(m_destination); |
| 1835 | 1803 | } |
| 1836 | 1804 | void evaluate(dsp56k_core* cpustate) {} |
| 1837 | 1805 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1849 | 1817 | bool decode(const UINT16 word0, const UINT16 word1) |
| 1850 | 1818 | { |
| 1851 | 1819 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 1852 | | m_opcode = "lsr"; |
| 1853 | 1820 | return true; |
| 1854 | 1821 | } |
| 1855 | 1822 | void disassemble(std::string& retString) const |
| 1856 | 1823 | { |
| 1857 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 1824 | retString = "lsr " + regIdAsString(m_destination); |
| 1858 | 1825 | } |
| 1859 | 1826 | void evaluate(dsp56k_core* cpustate) {} |
| 1860 | 1827 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 1877 | 1844 | m_source, m_source2, m_destination); |
| 1878 | 1845 | |
| 1879 | 1846 | decode_kSign_table(BITSn(word0,0x40), m_sign); |
| 1880 | | |
| 1881 | | m_opcode = "mac"; |
| 1882 | 1847 | return true; |
| 1883 | 1848 | } |
| 1884 | 1849 | void disassemble(std::string& retString) const |
| 1885 | 1850 | { |
| 1886 | 1851 | std::string ts = m_sign; |
| 1887 | 1852 | if (ts != "-") ts = ""; |
| 1888 | | retString = m_opcode + " " + |
| 1853 | retString = "mac " + |
| 1889 | 1854 | ts + |
| 1890 | 1855 | regIdAsString(m_source) + "," + |
| 1891 | 1856 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| r8846 | r8847 | |
| 1912 | 1877 | { |
| 1913 | 1878 | decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08), |
| 1914 | 1879 | m_source, m_source2, m_destination); |
| 1915 | | |
| 1916 | | m_opcode = "mac"; |
| 1917 | 1880 | return true; |
| 1918 | 1881 | } |
| 1919 | 1882 | void disassemble(std::string& retString) const |
| 1920 | 1883 | { |
| 1921 | | retString = m_opcode + " " + |
| 1884 | retString = "mac " + |
| 1922 | 1885 | regIdAsString(m_source) + "," + |
| 1923 | 1886 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 1924 | 1887 | } |
| r8846 | r8847 | |
| 1943 | 1906 | { |
| 1944 | 1907 | decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008), |
| 1945 | 1908 | m_source, m_source2, m_destination); |
| 1946 | | m_opcode = "mac"; |
| 1947 | 1909 | return true; |
| 1948 | 1910 | } |
| 1949 | 1911 | void disassemble(std::string& retString) const |
| 1950 | 1912 | { |
| 1951 | | retString = m_opcode + " " + |
| 1913 | retString = "mac " + |
| 1952 | 1914 | regIdAsString(m_source) + "," + |
| 1953 | 1915 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 1954 | 1916 | } |
| r8846 | r8847 | |
| 1976 | 1938 | m_source, m_source2, m_destination); |
| 1977 | 1939 | |
| 1978 | 1940 | decode_kSign_table(BITSn(word0,0x40), m_sign); |
| 1979 | | |
| 1980 | | m_opcode = "macr"; |
| 1981 | 1941 | return true; |
| 1982 | 1942 | } |
| 1983 | 1943 | void disassemble(std::string& retString) const |
| 1984 | 1944 | { |
| 1985 | 1945 | std::string ts = m_sign; |
| 1986 | 1946 | if (ts != "-") ts = ""; |
| 1987 | | retString = m_opcode + " " + |
| 1947 | retString = "macr " + |
| 1988 | 1948 | ts + |
| 1989 | 1949 | regIdAsString(m_source) + "," + |
| 1990 | 1950 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| r8846 | r8847 | |
| 2011 | 1971 | { |
| 2012 | 1972 | decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08), |
| 2013 | 1973 | m_source, m_source2, m_destination); |
| 2014 | | m_opcode = "macr"; |
| 2015 | 1974 | return true; |
| 2016 | 1975 | } |
| 2017 | 1976 | void disassemble(std::string& retString) const |
| 2018 | 1977 | { |
| 2019 | | retString = m_opcode + " " + |
| 1978 | retString = "macr " + |
| 2020 | 1979 | regIdAsString(m_source) + "," + |
| 2021 | 1980 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 2022 | 1981 | } |
| r8846 | r8847 | |
| 2034 | 1993 | public: |
| 2035 | 1994 | Macsuuu(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 2036 | 1995 | { |
| 1996 | m_mnem = oINVALID; |
| 2037 | 1997 | m_source2 = iINVALID; |
| 2038 | 1998 | m_valid = decode(word0, word1); |
| 2039 | 1999 | } |
| r8846 | r8847 | |
| 2043 | 2003 | decode_QQF_special_table(BITSn(word0,0x0003), BITSn(word0,0x0008), |
| 2044 | 2004 | m_source, m_source2, m_destination); |
| 2045 | 2005 | |
| 2046 | | std::string a; |
| 2047 | | decode_s_table(BITSn(word0,0x0004), a); |
| 2048 | | m_opcode = "mac" + a; |
| 2049 | | // NEW // sprintf(opcode_str, "mac(%s)", A); |
| 2006 | decode_s_table(BITSn(word0,0x0004), m_mnem); |
| 2050 | 2007 | return true; |
| 2051 | 2008 | } |
| 2052 | 2009 | void disassemble(std::string& retString) const |
| 2053 | 2010 | { |
| 2054 | | retString = m_opcode + " " + |
| 2011 | std::string opcode = "mac" + opMnemonicAsString(m_mnem); |
| 2012 | |
| 2013 | retString = opcode + " " + |
| 2055 | 2014 | regIdAsString(m_source) + "," + |
| 2056 | 2015 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 2016 | // NEW // sprintf(opcode_str, "mac(%s)", A); |
| 2057 | 2017 | } |
| 2058 | 2018 | void evaluate(dsp56k_core* cpustate) {} |
| 2059 | 2019 | size_t size() const { return 1; } |
| 2060 | 2020 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 2061 | 2021 | |
| 2062 | 2022 | private: |
| 2023 | op_mnem m_mnem; |
| 2063 | 2024 | reg_id m_source2; |
| 2064 | 2025 | }; |
| 2065 | 2026 | |
| r8846 | r8847 | |
| 2088 | 2049 | if (BITSn == 0x4a || BITSn == 0x4b) |
| 2089 | 2050 | m_isNop = true; |
| 2090 | 2051 | |
| 2091 | | m_opcode = "move"; |
| 2092 | 2052 | return true; |
| 2093 | 2053 | } |
| 2094 | 2054 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2096 | 2056 | if (m_isNop) |
| 2097 | 2057 | retString = "nop"; |
| 2098 | 2058 | else |
| 2099 | | retString = m_opcode; |
| 2059 | retString = "move"; |
| 2100 | 2060 | } |
| 2101 | 2061 | void evaluate(dsp56k_core* cpustate) {} |
| 2102 | 2062 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2123 | 2083 | else |
| 2124 | 2084 | m_destination = iA; |
| 2125 | 2085 | |
| 2126 | | m_opcode = "move"; |
| 2127 | 2086 | return true; |
| 2128 | 2087 | } |
| 2129 | 2088 | void disassemble(std::string& retString) const |
| 2130 | 2089 | { |
| 2131 | | retString = m_opcode; |
| 2090 | retString = "move"; |
| 2132 | 2091 | } |
| 2133 | 2092 | void evaluate(dsp56k_core* cpustate) {} |
| 2134 | 2093 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2151 | 2110 | m_b = BITSn(word0,0x00ff); |
| 2152 | 2111 | m_W = BITSn(word1,0x0100); |
| 2153 | 2112 | decode_HHH_table(BITSn(word1,0x0e00), m_SD); |
| 2154 | | |
| 2155 | | m_opcode = "move"; |
| 2156 | 2113 | return true; |
| 2157 | 2114 | } |
| 2158 | 2115 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2160 | 2117 | std::string source; |
| 2161 | 2118 | std::string destination; |
| 2162 | 2119 | assemble_reg_from_W_table(m_W, 'X', m_SD, m_b, source, destination); |
| 2163 | | retString = m_opcode + " " + source + "," + destination; |
| 2120 | retString = "move " + source + "," + destination; |
| 2164 | 2121 | } |
| 2165 | 2122 | void evaluate(dsp56k_core* cpustate) {} |
| 2166 | 2123 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 2191 | 2148 | m_W = BITSn(word0,0x0400); |
| 2192 | 2149 | decode_DDDDD_table(BITSn(word0,0x03e0), m_SD); |
| 2193 | 2150 | if (m_SD == iINVALID) return false; |
| 2194 | | |
| 2195 | | m_opcode = "move"; |
| 2196 | | // NEW // sprintf(opcode_str, "move(c)"); |
| 2197 | 2151 | return true; |
| 2198 | 2152 | } |
| 2199 | 2153 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2201 | 2155 | std::string source; |
| 2202 | 2156 | std::string destination; |
| 2203 | 2157 | assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); |
| 2204 | | retString = m_opcode + " " + source + "," + destination; |
| 2158 | retString = "move " + source + "," + destination; |
| 2159 | // NEW // sprintf(opcode_str, "move(c)"); |
| 2205 | 2160 | } |
| 2206 | 2161 | void evaluate(dsp56k_core* cpustate) {} |
| 2207 | 2162 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2232 | 2187 | decode_DDDDD_table(BITSn(word0,0x03e0), m_SD); |
| 2233 | 2188 | m_W = BITSn(word0,0x0400); |
| 2234 | 2189 | if (m_SD == iINVALID) return false; |
| 2235 | | |
| 2236 | | m_opcode = "move"; |
| 2237 | | // NEW // sprintf(opcode_str, "move(c)"); |
| 2238 | 2190 | return true; |
| 2239 | 2191 | } |
| 2240 | 2192 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2242 | 2194 | std::string source; |
| 2243 | 2195 | std::string destination; |
| 2244 | 2196 | assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); |
| 2245 | | retString = m_opcode + " " + source + "," + destination; |
| 2197 | retString = "move " + source + "," + destination; |
| 2198 | // NEW // sprintf(opcode_str, "move(c)"); |
| 2246 | 2199 | } |
| 2247 | 2200 | void evaluate(dsp56k_core* cpustate) {} |
| 2248 | 2201 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2272 | 2225 | decode_DDDDD_table(BITSn(word0,0x03e0), m_SD); |
| 2273 | 2226 | m_W = BITSn(word0,0x0400); |
| 2274 | 2227 | if (m_SD == iINVALID) return false; |
| 2275 | | |
| 2276 | | m_opcode = "move"; |
| 2277 | | // NEW // sprintf(opcode_str, "move(c)"); |
| 2278 | 2228 | return true; |
| 2279 | 2229 | } |
| 2280 | 2230 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2282 | 2232 | std::string source; |
| 2283 | 2233 | std::string destination; |
| 2284 | 2234 | assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); |
| 2285 | | retString = m_opcode + " " + source + "," + destination; |
| 2235 | retString = "move " + source + "," + destination; |
| 2236 | // NEW // sprintf(opcode_str, "move(c)"); |
| 2286 | 2237 | } |
| 2287 | 2238 | void evaluate(dsp56k_core* cpustate) {} |
| 2288 | 2239 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2318 | 2269 | if ((word0 & 0x000c) == 0x000c && (word0 & 0x0400) == 0x0000) |
| 2319 | 2270 | return false; |
| 2320 | 2271 | |
| 2321 | | m_opcode = "move"; |
| 2322 | | // NEW // sprintf(opcode_str, "move(c)"); |
| 2323 | 2272 | return true; |
| 2324 | 2273 | } |
| 2325 | 2274 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2327 | 2276 | std::string ea; |
| 2328 | 2277 | assemble_ea_from_t_table(m_t, m_value, ea); |
| 2329 | 2278 | |
| 2330 | | retString = m_opcode + " "; |
| 2279 | retString = "move "; |
| 2331 | 2280 | if (m_W) retString += ea + "," + regIdAsString(m_sd); |
| 2332 | 2281 | else retString += regIdAsString(m_sd) + "," + ea; |
| 2282 | // NEW // sprintf(opcode_str, "move(c)"); |
| 2333 | 2283 | } |
| 2334 | 2284 | void evaluate(dsp56k_core* cpustate) |
| 2335 | 2285 | { |
| r8846 | r8847 | |
| 2389 | 2339 | |
| 2390 | 2340 | if (m_source == iINVALID || m_destination == iINVALID) return false; |
| 2391 | 2341 | if (m_source == iSSH && m_destination == iSSH) return false; |
| 2392 | | |
| 2393 | | m_opcode = "move"; |
| 2394 | | // NEW // sprintf(opcode_str, "move(c)"); |
| 2395 | 2342 | return true; |
| 2396 | 2343 | } |
| 2397 | 2344 | void disassemble(std::string& retString) const |
| 2398 | 2345 | { |
| 2399 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 2346 | retString = "move " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 2347 | // NEW // sprintf(opcode_str, "move(c)"); |
| 2400 | 2348 | } |
| 2401 | 2349 | void evaluate(dsp56k_core* cpustate) {} |
| 2402 | 2350 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2412 | 2360 | m_W = 0; |
| 2413 | 2361 | m_b = 0; |
| 2414 | 2362 | m_SD = iINVALID; |
| 2363 | m_mnem = oINVALID; |
| 2415 | 2364 | m_valid = decode(word0, word1); |
| 2416 | 2365 | } |
| 2417 | 2366 | bool decode(const UINT16 word0, const UINT16 word1) |
| r8846 | r8847 | |
| 2419 | 2368 | m_b = BITSn(word0,0x00ff); |
| 2420 | 2369 | m_W = BITSn(word1,0x0400); |
| 2421 | 2370 | decode_DDDDD_table(BITSn(word1,0x03e0), m_SD); |
| 2422 | | |
| 2423 | | m_opcode = "move"; |
| 2424 | | // NEW // m_opcode = "move(c)"; |
| 2425 | 2371 | return true; |
| 2426 | 2372 | } |
| 2427 | 2373 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2429 | 2375 | std::string source; |
| 2430 | 2376 | std::string destination; |
| 2431 | 2377 | assemble_reg_from_W_table(m_W, 'X', m_SD, m_b, source, destination); |
| 2432 | | retString = m_opcode + " " + source + "," + destination; |
| 2378 | retString = "move " + source + "," + destination; |
| 2379 | // NEW // opcode = "move(c)"; |
| 2433 | 2380 | } |
| 2434 | 2381 | void evaluate(dsp56k_core* cpustate) {} |
| 2435 | 2382 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 2439 | 2386 | INT8 m_b; |
| 2440 | 2387 | UINT8 m_W; |
| 2441 | 2388 | reg_id m_SD; |
| 2389 | op_mnem m_mnem; |
| 2442 | 2390 | }; |
| 2443 | 2391 | |
| 2444 | 2392 | // MOVE(I) : 0010 00DD BBBB BBBB : A-150 /////////////////////////////////////// |
| r8846 | r8847 | |
| 2453 | 2401 | bool decode(const UINT16 word0, const UINT16 word1) |
| 2454 | 2402 | { |
| 2455 | 2403 | m_immediate = (INT8)BITSn(word0,0x00ff); |
| 2456 | | |
| 2457 | 2404 | decode_DD_table(BITSn(word0,0x0300), m_destination); |
| 2458 | | |
| 2459 | | m_opcode = "move"; |
| 2460 | | // NEW // sprintf(opcode_str, "move(i)"); |
| 2461 | 2405 | return true; |
| 2462 | 2406 | } |
| 2463 | 2407 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2467 | 2411 | else sprintf(temp, "#<-$%x", 1 - m_immediate - 1); |
| 2468 | 2412 | // NEW // sprintf(temp, "#$%02x,%s", BITSn(word0,0x00ff), D1); |
| 2469 | 2413 | |
| 2470 | | retString = m_opcode + " " + |
| 2414 | retString = "move " + |
| 2471 | 2415 | std::string(temp) + "," + regIdAsString(m_destination); |
| 2416 | // NEW // sprintf(opcode_str, "move(i)"); |
| 2472 | 2417 | } |
| 2473 | 2418 | void evaluate(dsp56k_core* cpustate) {} |
| 2474 | 2419 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2496 | 2441 | decode_HHH_table(BITSn(word0,0x0007), m_SD); |
| 2497 | 2442 | assemble_ea_from_MM_table(BITSn(word0,0x0018), rNum, m_ea); |
| 2498 | 2443 | m_W = BITSn(word0,0x0100); |
| 2499 | | |
| 2500 | | m_opcode = "move"; |
| 2501 | | // NEW // sprintf(opcode_str, "move(m)"); |
| 2502 | 2444 | return true; |
| 2503 | 2445 | } |
| 2504 | 2446 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2506 | 2448 | std::string source; |
| 2507 | 2449 | std::string destination; |
| 2508 | 2450 | assemble_arguments_from_W_table(m_W, 'P', m_SD, m_ea, source, destination); |
| 2509 | | retString = m_opcode + " " + source + "," + destination; |
| 2451 | retString = "move " + source + "," + destination; |
| 2452 | // NEW // sprintf(opcode_str, "move(m)"); |
| 2510 | 2453 | } |
| 2511 | 2454 | void evaluate(dsp56k_core* cpustate) {} |
| 2512 | 2455 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2533 | 2476 | { |
| 2534 | 2477 | m_W = BITSn(word0,0x0100); |
| 2535 | 2478 | assemble_eas_from_mm_table(BITSn(word0,0x000c), BITSn(word0,0x00c0), BITSn(word0,0x0003), m_ea, m_ea2); |
| 2536 | | |
| 2537 | | m_opcode = "move"; |
| 2538 | | // NEW // sprintf(opcode_str, "move(m)*"); |
| 2539 | 2479 | return true; |
| 2540 | 2480 | } |
| 2541 | 2481 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2552 | 2492 | source = "P:" + m_ea; |
| 2553 | 2493 | destination = "X:" + m_ea2; |
| 2554 | 2494 | } |
| 2555 | | retString = m_opcode + " " + source + "," + destination; |
| 2495 | retString = "move " + source + "," + destination; |
| 2496 | // NEW // sprintf(opcode_str, "move(m)*"); |
| 2556 | 2497 | } |
| 2557 | 2498 | void evaluate(dsp56k_core* cpustate) {} |
| 2558 | 2499 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2572 | 2513 | { |
| 2573 | 2514 | m_b = 0; |
| 2574 | 2515 | m_SD = iINVALID; |
| 2516 | m_mnem = oINVALID; |
| 2575 | 2517 | m_valid = decode(word0, word1); |
| 2576 | 2518 | } |
| 2577 | 2519 | bool decode(const UINT16 word0, const UINT16 word1) |
| r8846 | r8847 | |
| 2579 | 2521 | m_b = BITSn(word0,0x00ff); |
| 2580 | 2522 | m_W = BITSn(word1,0x0100); |
| 2581 | 2523 | decode_HHH_table(BITSn(word1,0x0007), m_SD); |
| 2582 | | |
| 2583 | | m_opcode = "move"; |
| 2584 | | // NEW // m_opcode = "move(m)"; |
| 2585 | 2524 | return true; |
| 2586 | 2525 | } |
| 2587 | 2526 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2589 | 2528 | std::string source; |
| 2590 | 2529 | std::string destination; |
| 2591 | 2530 | assemble_reg_from_W_table(m_W, 'P', m_SD, m_b, source, destination); |
| 2592 | | retString = m_opcode + " " + source + "," + destination; |
| 2531 | retString = "move " + source + "," + destination; |
| 2532 | // NEW // opcode = "move(m)"; |
| 2593 | 2533 | } |
| 2594 | 2534 | void evaluate(dsp56k_core* cpustate) {} |
| 2595 | 2535 | size_t size() const { return 2; } |
| r8846 | r8847 | |
| 2599 | 2539 | INT8 m_b; |
| 2600 | 2540 | UINT8 m_W; |
| 2601 | 2541 | reg_id m_SD; |
| 2542 | op_mnem m_mnem; |
| 2602 | 2543 | }; |
| 2603 | 2544 | |
| 2604 | 2545 | // MOVE(P) : 0001 100W HH1p pppp : A-156 /////////////////////////////////////// |
| r8846 | r8847 | |
| 2620 | 2561 | m_ea = "<<$" + m_ea; |
| 2621 | 2562 | |
| 2622 | 2563 | m_W = BITSn(word0,0x0100); |
| 2623 | | |
| 2624 | | m_opcode = "movep"; |
| 2625 | | // NEW // sprintf(opcode_str, "move(p)"); |
| 2626 | 2564 | return true; |
| 2627 | 2565 | } |
| 2628 | 2566 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2630 | 2568 | std::string source; |
| 2631 | 2569 | std::string destination; |
| 2632 | 2570 | assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); |
| 2633 | | retString = m_opcode + " " + source + "," + destination; |
| 2571 | retString = "movep " + source + "," + destination; |
| 2572 | // NEW // sprintf(opcode_str, "move(p)"); |
| 2634 | 2573 | } |
| 2635 | 2574 | void evaluate(dsp56k_core* cpustate) {} |
| 2636 | 2575 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2665 | 2604 | m_W = BITSn(word0,0x0100); |
| 2666 | 2605 | m_SD = "X:<<$" + fullAddy; |
| 2667 | 2606 | // NEW // sprintf(SD, "X:$%s", fullAddy); |
| 2668 | | |
| 2669 | | m_opcode = "movep"; |
| 2670 | | // NEW // sprintf(opcode_str, "move(p)*"); |
| 2671 | 2607 | return true; |
| 2672 | 2608 | } |
| 2673 | 2609 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2675 | 2611 | std::string source; |
| 2676 | 2612 | std::string destination; |
| 2677 | 2613 | assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); |
| 2678 | | retString = m_opcode + " " + source + "," + destination; |
| 2614 | retString = "movep " + source + "," + destination; |
| 2615 | // NEW // sprintf(opcode_str, "move(p)*"); |
| 2679 | 2616 | } |
| 2680 | 2617 | void evaluate(dsp56k_core* cpustate) {} |
| 2681 | 2618 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2707 | 2644 | m_ea = temp; |
| 2708 | 2645 | |
| 2709 | 2646 | m_W = BITSn(word0,0x0100); |
| 2710 | | |
| 2711 | | m_opcode = "moves"; |
| 2712 | | // NEW // sprintf(opcode_str, "move(s)"); |
| 2713 | 2647 | return true; |
| 2714 | 2648 | } |
| 2715 | 2649 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 2717 | 2651 | std::string source; |
| 2718 | 2652 | std::string destination; |
| 2719 | 2653 | assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); |
| 2720 | | retString = m_opcode + " " + source + "," + destination; |
| 2654 | retString = "moves " + source + "," + destination; |
| 2655 | // NEW // sprintf(opcode_str, "move(s)"); |
| 2721 | 2656 | } |
| 2722 | 2657 | void evaluate(dsp56k_core* cpustate) {} |
| 2723 | 2658 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2747 | 2682 | m_source, m_source2, m_destination); |
| 2748 | 2683 | |
| 2749 | 2684 | decode_kSign_table(BITSn(word0,0x40), m_sign); |
| 2750 | | |
| 2751 | | m_opcode = "mpy"; |
| 2752 | 2685 | return true; |
| 2753 | 2686 | } |
| 2754 | 2687 | void disassemble(std::string& retString) const |
| 2755 | 2688 | { |
| 2756 | 2689 | std::string ts = m_sign; |
| 2757 | 2690 | if (ts != "-") ts = ""; |
| 2758 | | retString = m_opcode + " " + |
| 2691 | retString = "mpy " + |
| 2759 | 2692 | ts + |
| 2760 | 2693 | regIdAsString(m_source) + "," + |
| 2761 | 2694 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| r8846 | r8847 | |
| 2782 | 2715 | { |
| 2783 | 2716 | decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08), |
| 2784 | 2717 | m_source, m_source2, m_destination); |
| 2785 | | |
| 2786 | | m_opcode = "mpy"; |
| 2787 | 2718 | return true; |
| 2788 | 2719 | } |
| 2789 | 2720 | void disassemble(std::string& retString) const |
| 2790 | 2721 | { |
| 2791 | | retString = m_opcode + " " + |
| 2722 | retString = "mpy " + |
| 2792 | 2723 | regIdAsString(m_source) + "," + |
| 2793 | 2724 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 2794 | 2725 | } |
| r8846 | r8847 | |
| 2813 | 2744 | { |
| 2814 | 2745 | decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008), |
| 2815 | 2746 | m_source, m_source2, m_destination); |
| 2816 | | |
| 2817 | | m_opcode = "mpy"; |
| 2818 | 2747 | return true; |
| 2819 | 2748 | } |
| 2820 | 2749 | void disassemble(std::string& retString) const |
| 2821 | 2750 | { |
| 2822 | | retString = m_opcode + " " + |
| 2751 | retString = "mpy " + |
| 2823 | 2752 | regIdAsString(m_source) + "," + |
| 2824 | 2753 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 2825 | 2754 | } |
| r8846 | r8847 | |
| 2849 | 2778 | m_source, m_source2, m_destination); |
| 2850 | 2779 | |
| 2851 | 2780 | decode_kSign_table(BITSn(word0,0x40), m_sign); |
| 2852 | | |
| 2853 | | m_opcode = "mpyr"; |
| 2854 | 2781 | return true; |
| 2855 | 2782 | } |
| 2856 | 2783 | void disassemble(std::string& retString) const |
| 2857 | 2784 | { |
| 2858 | 2785 | std::string ts = m_sign; |
| 2859 | 2786 | if (ts != "-") ts = ""; |
| 2860 | | retString = m_opcode + " " + |
| 2787 | retString = "mpyr " + |
| 2861 | 2788 | ts + |
| 2862 | 2789 | regIdAsString(m_source) + "," + |
| 2863 | 2790 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| r8846 | r8847 | |
| 2884 | 2811 | { |
| 2885 | 2812 | decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08), |
| 2886 | 2813 | m_source, m_source2, m_destination); |
| 2887 | | |
| 2888 | | m_opcode = "mpyr"; |
| 2889 | 2814 | return true; |
| 2890 | 2815 | } |
| 2891 | 2816 | void disassemble(std::string& retString) const |
| 2892 | 2817 | { |
| 2893 | | retString = m_opcode + " " + |
| 2818 | retString = "mpyr " + |
| 2894 | 2819 | regIdAsString(m_source) + "," + |
| 2895 | 2820 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 2896 | 2821 | } |
| r8846 | r8847 | |
| 2908 | 2833 | public: |
| 2909 | 2834 | Mpysuuu(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 2910 | 2835 | { |
| 2836 | m_mnem = oINVALID; |
| 2911 | 2837 | m_source2 = iINVALID; |
| 2912 | 2838 | m_valid = decode(word0, word1); |
| 2913 | 2839 | } |
| r8846 | r8847 | |
| 2916 | 2842 | decode_QQF_special_table(BITSn(word0,0x0003), BITSn(word0,0x0008), |
| 2917 | 2843 | m_source, m_source2, m_destination); |
| 2918 | 2844 | |
| 2919 | | std::string a; |
| 2920 | | decode_s_table(BITSn(word0,0x0004), a); |
| 2921 | | m_opcode = "mpy" + a; |
| 2922 | | // NEW // sprintf(opcode_str, "mpy(%s)", A); |
| 2845 | decode_s_table(BITSn(word0,0x0004), m_mnem); |
| 2923 | 2846 | return true; |
| 2924 | 2847 | } |
| 2925 | 2848 | void disassemble(std::string& retString) const |
| 2926 | 2849 | { |
| 2927 | | retString = m_opcode + " " + |
| 2850 | std::string opcode = "mpy" + opMnemonicAsString(m_mnem); |
| 2851 | |
| 2852 | retString = opcode + " " + |
| 2928 | 2853 | regIdAsString(m_source) + "," + |
| 2929 | 2854 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 2855 | // NEW // sprintf(opcode_str, "mpy(%s)", A); |
| 2930 | 2856 | } |
| 2931 | 2857 | void evaluate(dsp56k_core* cpustate) {} |
| 2932 | 2858 | size_t size() const { return 1; } |
| 2933 | 2859 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 2934 | 2860 | |
| 2935 | 2861 | private: |
| 2862 | op_mnem m_mnem; |
| 2936 | 2863 | reg_id m_source2; |
| 2937 | 2864 | }; |
| 2938 | 2865 | |
| r8846 | r8847 | |
| 2947 | 2874 | bool decode(const UINT16 word0, const UINT16 word1) |
| 2948 | 2875 | { |
| 2949 | 2876 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 2950 | | |
| 2951 | | m_opcode = "neg"; |
| 2952 | 2877 | return true; |
| 2953 | 2878 | } |
| 2954 | 2879 | void disassemble(std::string& retString) const |
| 2955 | 2880 | { |
| 2956 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 2881 | retString = "neg " + regIdAsString(m_destination); |
| 2957 | 2882 | } |
| 2958 | 2883 | void evaluate(dsp56k_core* cpustate) {} |
| 2959 | 2884 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2971 | 2896 | bool decode(const UINT16 word0, const UINT16 word1) |
| 2972 | 2897 | { |
| 2973 | 2898 | decode_F_table(BITSn(word0,0x0008), m_destination); |
| 2974 | | m_opcode = "negc"; |
| 2975 | 2899 | return true; |
| 2976 | 2900 | } |
| 2977 | 2901 | void disassemble(std::string& retString) const |
| 2978 | 2902 | { |
| 2979 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 2903 | retString = "negc " + regIdAsString(m_destination); |
| 2980 | 2904 | } |
| 2981 | 2905 | void evaluate(dsp56k_core* cpustate) {} |
| 2982 | 2906 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 2993 | 2917 | } |
| 2994 | 2918 | bool decode(const UINT16 word0, const UINT16 word1) |
| 2995 | 2919 | { |
| 2996 | | m_opcode = "nop"; |
| 2997 | 2920 | return true; |
| 2998 | 2921 | } |
| 2999 | 2922 | void disassemble(std::string& retString) const |
| 3000 | 2923 | { |
| 3001 | | retString = m_opcode; |
| 2924 | retString = "nop"; |
| 3002 | 2925 | } |
| 3003 | 2926 | void evaluate(dsp56k_core* cpustate) {} |
| 3004 | 2927 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3018 | 2941 | decode_F_table(BITSn(word0,0x0008), m_destination); |
| 3019 | 2942 | |
| 3020 | 2943 | decode_RR_table(BITSn(word0,0x0003), m_source); |
| 3021 | | |
| 3022 | | m_opcode = "norm"; |
| 3023 | 2944 | return true; |
| 3024 | 2945 | } |
| 3025 | 2946 | void disassemble(std::string& retString) const |
| 3026 | 2947 | { |
| 3027 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 2948 | retString = "norm " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3028 | 2949 | } |
| 3029 | 2950 | void evaluate(dsp56k_core* cpustate) {} |
| 3030 | 2951 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3042 | 2963 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3043 | 2964 | { |
| 3044 | 2965 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 3045 | | |
| 3046 | | m_opcode = "not"; |
| 3047 | 2966 | return true; |
| 3048 | 2967 | } |
| 3049 | 2968 | void disassemble(std::string& retString) const |
| 3050 | 2969 | { |
| 3051 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 2970 | retString = "not " + regIdAsString(m_destination); |
| 3052 | 2971 | } |
| 3053 | 2972 | void evaluate(dsp56k_core* cpustate) {} |
| 3054 | 2973 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3067 | 2986 | { |
| 3068 | 2987 | decode_JJF_table(BITSn(word0,0x03),BITSn(word0,0x08), |
| 3069 | 2988 | m_source, m_destination); |
| 3070 | | m_opcode = "or"; |
| 3071 | 2989 | return true; |
| 3072 | 2990 | } |
| 3073 | 2991 | void disassemble(std::string& retString) const |
| 3074 | 2992 | { |
| 3075 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 2993 | retString = "or " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3076 | 2994 | } |
| 3077 | 2995 | void evaluate(dsp56k_core* cpustate) {} |
| 3078 | 2996 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3091 | 3009 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3092 | 3010 | { |
| 3093 | 3011 | m_immediate = BITSn(word0,0x00ff); |
| 3094 | | |
| 3095 | 3012 | decode_EE_table(BITSn(word0,0x0600), m_destination); |
| 3096 | | m_opcode = "ori"; |
| 3097 | | // NEW // sprintf(opcode_str, "or(i)"); |
| 3098 | 3013 | return true; |
| 3099 | 3014 | } |
| 3100 | 3015 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 3102 | 3017 | char temp[32]; |
| 3103 | 3018 | sprintf(temp, "#$%x", m_immediate); |
| 3104 | 3019 | // NEW // sprintf(temp, "#$%02x", BITSn(word0,0x00ff)); |
| 3105 | | retString = m_opcode + " " + std::string(temp) + "," + regIdAsString(m_destination); |
| 3020 | retString = "ori " + std::string(temp) + "," + regIdAsString(m_destination); |
| 3021 | // NEW // sprintf(opcode_str, "or(i)"); |
| 3106 | 3022 | } |
| 3107 | 3023 | void evaluate(dsp56k_core* cpustate) {} |
| 3108 | 3024 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3123 | 3039 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3124 | 3040 | { |
| 3125 | 3041 | decode_RR_table(BITSn(word0,0x0003), m_source); |
| 3126 | | |
| 3127 | | m_opcode = "rep"; |
| 3128 | 3042 | return true; |
| 3129 | 3043 | } |
| 3130 | 3044 | void disassemble(std::string& retString) const |
| 3131 | 3045 | { |
| 3132 | 3046 | char temp[32]; |
| 3133 | 3047 | sprintf(temp, "X:(%s)", regIdAsString(m_source).c_str()); |
| 3134 | | retString = m_opcode + " " + std::string(temp); |
| 3048 | retString = "rep " + std::string(temp); |
| 3135 | 3049 | } |
| 3136 | 3050 | void evaluate(dsp56k_core* cpustate) {} |
| 3137 | 3051 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3150 | 3064 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3151 | 3065 | { |
| 3152 | 3066 | m_immediate = BITSn(word0,0x00ff); |
| 3153 | | m_opcode = "rep"; |
| 3154 | 3067 | return true; |
| 3155 | 3068 | } |
| 3156 | 3069 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 3158 | 3071 | char temp[32]; |
| 3159 | 3072 | sprintf(temp, "#$%x", m_immediate); |
| 3160 | 3073 | // NEW // sprintf(temp, "#$%02x (%d)", BITSn(word0,0x00ff), BITSn(word0,0x00ff)); |
| 3161 | | retString = m_opcode + " " + std::string(temp); |
| 3074 | retString = "rep " + std::string(temp); |
| 3162 | 3075 | } |
| 3163 | 3076 | void evaluate(dsp56k_core* cpustate) {} |
| 3164 | 3077 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3180 | 3093 | { |
| 3181 | 3094 | decode_DDDDD_table(BITSn(word0,0x001f), m_source); |
| 3182 | 3095 | if (m_source == iINVALID) return false; |
| 3183 | | |
| 3184 | | m_opcode = "rep"; |
| 3185 | 3096 | return true; |
| 3186 | 3097 | } |
| 3187 | 3098 | void disassemble(std::string& retString) const |
| 3188 | 3099 | { |
| 3189 | | retString = m_opcode + " " + regIdAsString(m_source); |
| 3100 | retString = "rep " + regIdAsString(m_source); |
| 3190 | 3101 | } |
| 3191 | 3102 | void evaluate(dsp56k_core* cpustate) {} |
| 3192 | 3103 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3199 | 3110 | public: |
| 3200 | 3111 | Repcc(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 3201 | 3112 | { |
| 3113 | m_mnem = oINVALID; |
| 3202 | 3114 | m_valid = decode(word0, word1); |
| 3203 | 3115 | } |
| 3204 | 3116 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3205 | 3117 | { |
| 3206 | | std::string M; |
| 3207 | | decode_cccc_table(BITSn(word0,0x000f), M); |
| 3208 | | m_opcode = "rep" + M; |
| 3209 | | // NEW // sprintf(opcode_str, "rep.%s", M); |
| 3118 | decode_cccc_table(BITSn(word0,0x000f), m_mnem); |
| 3210 | 3119 | return true; |
| 3211 | 3120 | } |
| 3212 | 3121 | void disassemble(std::string& retString) const |
| 3213 | 3122 | { |
| 3214 | | retString = m_opcode; |
| 3123 | std::string opcode = "rep" + opMnemonicAsString(m_mnem); |
| 3124 | retString = opcode; |
| 3125 | // NEW // sprintf(opcode_str, "rep.%s", M); |
| 3215 | 3126 | } |
| 3216 | 3127 | void evaluate(dsp56k_core* cpustate) {} |
| 3217 | 3128 | size_t size() const { return 1; } |
| 3218 | 3129 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 3130 | |
| 3131 | private: |
| 3132 | op_mnem m_mnem; |
| 3219 | 3133 | }; |
| 3220 | 3134 | |
| 3221 | 3135 | // RESET : 0000 0000 0000 1000 : A-186 ///////////////////////////////////////// |
| r8846 | r8847 | |
| 3228 | 3142 | } |
| 3229 | 3143 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3230 | 3144 | { |
| 3231 | | m_opcode = "reset"; |
| 3232 | 3145 | return true; |
| 3233 | 3146 | } |
| 3234 | 3147 | void disassemble(std::string& retString) const |
| 3235 | 3148 | { |
| 3236 | | retString = m_opcode; |
| 3149 | retString = "reset"; |
| 3237 | 3150 | } |
| 3238 | 3151 | void evaluate(dsp56k_core* cpustate) {} |
| 3239 | 3152 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3251 | 3164 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3252 | 3165 | { |
| 3253 | 3166 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 3254 | | |
| 3255 | | m_opcode = "rnd"; |
| 3256 | 3167 | return true; |
| 3257 | 3168 | } |
| 3258 | 3169 | void disassemble(std::string& retString) const |
| 3259 | 3170 | { |
| 3260 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 3171 | retString = "rnd " + regIdAsString(m_destination); |
| 3261 | 3172 | } |
| 3262 | 3173 | void evaluate(dsp56k_core* cpustate) {} |
| 3263 | 3174 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3275 | 3186 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3276 | 3187 | { |
| 3277 | 3188 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 3278 | | |
| 3279 | | m_opcode = "rol"; |
| 3280 | 3189 | return true; |
| 3281 | 3190 | } |
| 3282 | 3191 | void disassemble(std::string& retString) const |
| 3283 | 3192 | { |
| 3284 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 3193 | retString = "rol " + regIdAsString(m_destination); |
| 3285 | 3194 | } |
| 3286 | 3195 | void evaluate(dsp56k_core* cpustate) {} |
| 3287 | 3196 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3299 | 3208 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3300 | 3209 | { |
| 3301 | 3210 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 3302 | | |
| 3303 | | m_opcode = "ror"; |
| 3304 | 3211 | return true; |
| 3305 | 3212 | } |
| 3306 | 3213 | void disassemble(std::string& retString) const |
| 3307 | 3214 | { |
| 3308 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 3215 | retString = "ror " + regIdAsString(m_destination); |
| 3309 | 3216 | } |
| 3310 | 3217 | void evaluate(dsp56k_core* cpustate) {} |
| 3311 | 3218 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3322 | 3229 | } |
| 3323 | 3230 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3324 | 3231 | { |
| 3325 | | m_opcode = "rti"; |
| 3326 | 3232 | return true; |
| 3327 | 3233 | } |
| 3328 | 3234 | void disassemble(std::string& retString) const |
| 3329 | 3235 | { |
| 3330 | | retString = m_opcode; |
| 3236 | retString = "rti"; |
| 3331 | 3237 | } |
| 3332 | 3238 | void evaluate(dsp56k_core* cpustate) {} |
| 3333 | 3239 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3345 | 3251 | } |
| 3346 | 3252 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3347 | 3253 | { |
| 3348 | | m_opcode = "rts"; |
| 3349 | 3254 | return true; |
| 3350 | 3255 | } |
| 3351 | 3256 | void disassemble(std::string& retString) const |
| 3352 | 3257 | { |
| 3353 | | retString = m_opcode; |
| 3258 | retString = "rts"; |
| 3354 | 3259 | } |
| 3355 | 3260 | void evaluate(dsp56k_core* cpustate) {} |
| 3356 | 3261 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3370 | 3275 | { |
| 3371 | 3276 | decode_JF_table(BITSn(word0,0x01), BITSn(word0,0x08), |
| 3372 | 3277 | m_source, m_destination); |
| 3373 | | |
| 3374 | | m_opcode = "sbc"; |
| 3375 | 3278 | return true; |
| 3376 | 3279 | } |
| 3377 | 3280 | void disassemble(std::string& retString) const |
| 3378 | 3281 | { |
| 3379 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3282 | retString = "sbc " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3380 | 3283 | } |
| 3381 | 3284 | void evaluate(dsp56k_core* cpustate) {} |
| 3382 | 3285 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3393 | 3296 | } |
| 3394 | 3297 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3395 | 3298 | { |
| 3396 | | m_opcode = "stop"; |
| 3397 | 3299 | return true; |
| 3398 | 3300 | } |
| 3399 | 3301 | void disassemble(std::string& retString) const |
| 3400 | 3302 | { |
| 3401 | | retString = m_opcode; |
| 3303 | retString = "stop"; |
| 3402 | 3304 | } |
| 3403 | 3305 | void evaluate(dsp56k_core* cpustate) {} |
| 3404 | 3306 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3417 | 3319 | { |
| 3418 | 3320 | decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08), |
| 3419 | 3321 | m_source, m_destination); |
| 3420 | | m_opcode = "sub"; |
| 3421 | 3322 | return true; |
| 3422 | 3323 | } |
| 3423 | 3324 | void disassemble(std::string& retString) const |
| 3424 | 3325 | { |
| 3425 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3326 | retString = "sub " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3426 | 3327 | } |
| 3427 | 3328 | void evaluate(dsp56k_core* cpustate) {} |
| 3428 | 3329 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3435 | 3336 | public: |
| 3436 | 3337 | Sub_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 3437 | 3338 | { |
| 3339 | m_opcode = ""; |
| 3438 | 3340 | m_valid = decode(word0, word1); |
| 3439 | 3341 | } |
| 3440 | 3342 | bool decode(const UINT16 word0, const UINT16 word1) |
| r8846 | r8847 | |
| 3452 | 3354 | void evaluate(dsp56k_core* cpustate) {} |
| 3453 | 3355 | size_t size() const { return 1; } |
| 3454 | 3356 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 3357 | |
| 3358 | private: |
| 3359 | std::string m_opcode; |
| 3455 | 3360 | }; |
| 3456 | 3361 | |
| 3457 | 3362 | // SUBL : .... .... 0100 F001 : A-204 ////////////////////////////////////////// |
| r8846 | r8847 | |
| 3475 | 3380 | m_source = iA; |
| 3476 | 3381 | m_destination = iB; |
| 3477 | 3382 | } |
| 3478 | | |
| 3479 | | m_opcode = "subl"; |
| 3480 | 3383 | return true; |
| 3481 | 3384 | } |
| 3482 | 3385 | void disassemble(std::string& retString) const |
| 3483 | 3386 | { |
| 3484 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3387 | retString = "subl " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3485 | 3388 | } |
| 3486 | 3389 | void evaluate(dsp56k_core* cpustate) {} |
| 3487 | 3390 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3499 | 3402 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3500 | 3403 | { |
| 3501 | 3404 | decode_F_table(BITSn(word0,0x0008), m_destination); |
| 3502 | | |
| 3503 | | m_opcode = "swap"; |
| 3504 | 3405 | return true; |
| 3505 | 3406 | } |
| 3506 | 3407 | void disassemble(std::string& retString) const |
| 3507 | 3408 | { |
| 3508 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 3409 | retString = "swap " + regIdAsString(m_destination); |
| 3509 | 3410 | } |
| 3510 | 3411 | void evaluate(dsp56k_core* cpustate) {} |
| 3511 | 3412 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3522 | 3423 | } |
| 3523 | 3424 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3524 | 3425 | { |
| 3525 | | m_opcode = "swi"; |
| 3526 | 3426 | return true; |
| 3527 | 3427 | } |
| 3528 | 3428 | void disassemble(std::string& retString) const |
| 3529 | 3429 | { |
| 3530 | | retString = m_opcode; |
| 3430 | retString = "swi"; |
| 3531 | 3431 | } |
| 3532 | 3432 | void evaluate(dsp56k_core* cpustate) {} |
| 3533 | 3433 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3540 | 3440 | public: |
| 3541 | 3441 | Tcc(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco) |
| 3542 | 3442 | { |
| 3443 | m_mnem = oINVALID; |
| 3543 | 3444 | m_destination2 = iINVALID; |
| 3544 | 3445 | m_valid = decode(word0, word1); |
| 3545 | 3446 | } |
| r8846 | r8847 | |
| 3550 | 3451 | |
| 3551 | 3452 | decode_RR_table(BITSn(word0,0x0030), m_destination2); |
| 3552 | 3453 | |
| 3553 | | std::string M; |
| 3554 | | decode_cccc_table(BITSn(word0,0x03c0), M); |
| 3555 | | m_opcode = "t" + M; |
| 3556 | | // NEW // sprintf(opcode_str, "t.%s", M); |
| 3454 | decode_cccc_table(BITSn(word0,0x03c0), m_mnem); |
| 3557 | 3455 | if (m_source != m_destination) |
| 3558 | 3456 | return true; |
| 3559 | 3457 | if (m_destination2 != iR0) |
| r8846 | r8847 | |
| 3563 | 3461 | } |
| 3564 | 3462 | void disassemble(std::string& retString) const |
| 3565 | 3463 | { |
| 3566 | | retString = m_opcode; |
| 3464 | std::string opcode = "t" + opMnemonicAsString(m_mnem); |
| 3465 | // NEW // sprintf(opcode_str, "t.%s", M); |
| 3466 | |
| 3467 | retString = opcode; |
| 3567 | 3468 | if (m_source != m_destination) |
| 3568 | 3469 | retString += std::string(" ") + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3569 | 3470 | |
| r8846 | r8847 | |
| 3575 | 3476 | size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } |
| 3576 | 3477 | |
| 3577 | 3478 | private: |
| 3479 | op_mnem m_mnem; |
| 3578 | 3480 | reg_id m_destination2; |
| 3579 | 3481 | }; |
| 3580 | 3482 | |
| r8846 | r8847 | |
| 3590 | 3492 | { |
| 3591 | 3493 | decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08), |
| 3592 | 3494 | m_source, m_destination); |
| 3593 | | |
| 3594 | | m_opcode = "tfr"; |
| 3595 | 3495 | return true; |
| 3596 | 3496 | } |
| 3597 | 3497 | void disassemble(std::string& retString) const |
| 3598 | 3498 | { |
| 3599 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3499 | retString = "tfr " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3600 | 3500 | } |
| 3601 | 3501 | void evaluate(dsp56k_core* cpustate) {} |
| 3602 | 3502 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3615 | 3515 | { |
| 3616 | 3516 | decode_DDF_table(BITSn(word0,0x03), BITSn(word0,0x08), |
| 3617 | 3517 | m_source, m_destination); |
| 3618 | | |
| 3619 | | m_opcode = "tfr"; |
| 3620 | 3518 | return true; |
| 3621 | 3519 | } |
| 3622 | 3520 | void disassemble(std::string& retString) const |
| 3623 | 3521 | { |
| 3624 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3522 | retString = "tfr " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3625 | 3523 | } |
| 3626 | 3524 | void evaluate(dsp56k_core* cpustate) {} |
| 3627 | 3525 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3640 | 3538 | { |
| 3641 | 3539 | decode_JF_table(BITSn(word0,0x0001),BITSn(word0,0x0008), |
| 3642 | 3540 | m_destination, m_source); |
| 3643 | | |
| 3644 | | m_opcode = "tfr2"; |
| 3645 | 3541 | return true; |
| 3646 | 3542 | } |
| 3647 | 3543 | void disassemble(std::string& retString) const |
| 3648 | 3544 | { |
| 3649 | | retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3545 | retString = "tfr2 " + regIdAsString(m_source) + "," + regIdAsString(m_destination); |
| 3650 | 3546 | } |
| 3651 | 3547 | void evaluate(dsp56k_core* cpustate) {} |
| 3652 | 3548 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3679 | 3575 | assemble_ea_from_m_table(BITSn(word0,0x0200), rNum, m_ea); |
| 3680 | 3576 | |
| 3681 | 3577 | m_W = BITSn(word0,0x0100); |
| 3682 | | |
| 3683 | | m_opcode = "tfr3"; |
| 3684 | 3578 | return true; |
| 3685 | 3579 | } |
| 3686 | 3580 | void disassemble(std::string& retString) const |
| r8846 | r8847 | |
| 3688 | 3582 | std::string source2; |
| 3689 | 3583 | std::string destination2; |
| 3690 | 3584 | assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source2, destination2); |
| 3691 | | retString = m_opcode + " " + |
| 3585 | retString = "tfr3 " + |
| 3692 | 3586 | regIdAsString(m_source) + "," + regIdAsString(m_destination) + " " + |
| 3693 | 3587 | source2 + "," + destination2; |
| 3694 | 3588 | } |
| r8846 | r8847 | |
| 3715 | 3609 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3716 | 3610 | { |
| 3717 | 3611 | decode_F_table(BITSn(word0,0x08), m_destination); |
| 3718 | | |
| 3719 | | m_opcode = "tst"; |
| 3720 | 3612 | return true; |
| 3721 | 3613 | } |
| 3722 | 3614 | void disassemble(std::string& retString) const |
| 3723 | 3615 | { |
| 3724 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 3616 | retString = "tst " + regIdAsString(m_destination); |
| 3725 | 3617 | } |
| 3726 | 3618 | void evaluate(dsp56k_core* cpustate) {} |
| 3727 | 3619 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3739 | 3631 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3740 | 3632 | { |
| 3741 | 3633 | decode_DD_table(BITSn(word0,0x0003), m_source); |
| 3742 | | |
| 3743 | | m_opcode = "tst2"; |
| 3744 | 3634 | return true; |
| 3745 | 3635 | } |
| 3746 | 3636 | void disassemble(std::string& retString) const |
| 3747 | 3637 | { |
| 3748 | | retString = m_opcode + " " + regIdAsString(m_source); |
| 3638 | retString = "tst2 " + regIdAsString(m_source); |
| 3749 | 3639 | } |
| 3750 | 3640 | void evaluate(dsp56k_core* cpustate) {} |
| 3751 | 3641 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3762 | 3652 | } |
| 3763 | 3653 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3764 | 3654 | { |
| 3765 | | m_opcode = "wait"; |
| 3766 | 3655 | return true; |
| 3767 | 3656 | } |
| 3768 | 3657 | void disassemble(std::string& retString) const |
| 3769 | 3658 | { |
| 3770 | | retString = m_opcode; |
| 3659 | retString = "wait"; |
| 3771 | 3660 | } |
| 3772 | 3661 | void evaluate(dsp56k_core* cpustate) {} |
| 3773 | 3662 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3785 | 3674 | bool decode(const UINT16 word0, const UINT16 word1) |
| 3786 | 3675 | { |
| 3787 | 3676 | decode_F_table(BITSn(word0,0x0008), m_destination); |
| 3788 | | |
| 3789 | | m_opcode = "zero"; |
| 3790 | 3677 | return true; |
| 3791 | 3678 | } |
| 3792 | 3679 | void disassemble(std::string& retString) const |
| 3793 | 3680 | { |
| 3794 | | retString = m_opcode + " " + regIdAsString(m_destination); |
| 3681 | retString = "zero " + regIdAsString(m_destination); |
| 3795 | 3682 | } |
| 3796 | 3683 | void evaluate(dsp56k_core* cpustate) {} |
| 3797 | 3684 | size_t size() const { return 1; } |
| r8846 | r8847 | |
| 3826 | 3713 | m_source = iX1; |
| 3827 | 3714 | m_source2 = iY1; |
| 3828 | 3715 | } |
| 3829 | | |
| 3830 | | m_opcode = "shfl"; |
| 3831 | 3716 | return true; |
| 3832 | 3717 | } |
| 3833 | 3718 | void disassemble(std::string& retString) const |
| 3834 | 3719 | { |
| 3835 | | retString = m_opcode + " " + |
| 3720 | retString = "shfl " + |
| 3836 | 3721 | regIdAsString(m_source) + "," + |
| 3837 | 3722 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 3838 | 3723 | } |
| r8846 | r8847 | |
| 3872 | 3757 | m_source = iX1; |
| 3873 | 3758 | m_source2 = iY1; |
| 3874 | 3759 | } |
| 3875 | | |
| 3876 | | m_opcode = "shfr"; |
| 3877 | 3760 | return true; |
| 3878 | 3761 | } |
| 3879 | 3762 | void disassemble(std::string& retString) const |
| 3880 | 3763 | { |
| 3881 | | retString = m_opcode + " " + |
| 3764 | retString = "shfr " + |
| 3882 | 3765 | regIdAsString(m_source) + "," + |
| 3883 | 3766 | regIdAsString(m_source2) + "," + regIdAsString(m_destination); |
| 3884 | 3767 | } |
src/emu/addrmap.h
| r8846 | r8847 | |
| 438 | 438 | // ADDRESS MAP MACROS |
| 439 | 439 | //************************************************************************** |
| 440 | 440 | |
| 441 | // |
| 442 | // There are two versions of the macros below |
| 443 | // |
| 444 | // By default, the legacy forms are enabled; however, if ADDRESS_MAP_MODERN is #defined |
| 445 | // prior to including this file, the new format are enabled instead. |
| 446 | // |
| 447 | |
| 441 | 448 | // so that "0" can be used for unneeded address maps |
| 442 | 449 | #define construct_address_map_0 NULL |
| 443 | 450 | |
| 444 | 451 | |
| 452 | #ifndef ADDRESS_MAP_MODERN |
| 453 | |
| 454 | // |
| 455 | // Legacy ADDRESS_MAPs |
| 456 | // |
| 457 | |
| 445 | 458 | // start/end tags for the address map |
| 446 | 459 | #define ADDRESS_MAP_NAME(_name) construct_address_map_##_name |
| 447 | 460 | |
| r8846 | r8847 | |
| 573 | 586 | curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \ |
| 574 | 587 | |
| 575 | 588 | |
| 589 | // special-case accesses |
| 590 | #define AM_ROM \ |
| 591 | curentry->set_read_type(AMH_ROM); \ |
| 592 | |
| 593 | #define AM_RAM \ |
| 594 | curentry->set_read_type(AMH_RAM); \ |
| 595 | curentry->set_write_type(AMH_RAM); \ |
| 596 | |
| 597 | #define AM_READONLY \ |
| 598 | curentry->set_read_type(AMH_RAM); \ |
| 599 | |
| 600 | #define AM_WRITEONLY \ |
| 601 | curentry->set_write_type(AMH_RAM); \ |
| 602 | |
| 603 | #define AM_UNMAP \ |
| 604 | curentry->set_read_type(AMH_UNMAP); \ |
| 605 | curentry->set_write_type(AMH_UNMAP); \ |
| 606 | |
| 607 | #define AM_NOP \ |
| 608 | curentry->set_read_type(AMH_NOP); \ |
| 609 | curentry->set_write_type(AMH_NOP); \ |
| 610 | |
| 611 | #define AM_READNOP \ |
| 612 | curentry->set_read_type(AMH_NOP); \ |
| 613 | |
| 614 | #define AM_WRITENOP \ |
| 615 | curentry->set_write_type(AMH_NOP); \ |
| 616 | |
| 617 | |
| 618 | // port accesses |
| 619 | #define AM_READ_PORT(_tag) \ |
| 620 | curentry->set_read_port(devconfig, _tag); \ |
| 621 | |
| 622 | #define AM_WRITE_PORT(_tag) \ |
| 623 | curentry->set_write_port(devconfig, _tag); \ |
| 624 | |
| 625 | #define AM_READWRITE_PORT(_tag) \ |
| 626 | curentry->set_readwrite_port(devconfig, _tag); \ |
| 627 | |
| 628 | |
| 629 | // bank accesses |
| 630 | #define AM_READ_BANK(_tag) \ |
| 631 | curentry->set_read_bank(devconfig, _tag); \ |
| 632 | |
| 633 | #define AM_WRITE_BANK(_tag) \ |
| 634 | curentry->set_write_bank(devconfig, _tag); \ |
| 635 | |
| 636 | #define AM_READWRITE_BANK(_tag) \ |
| 637 | curentry->set_readwrite_bank(devconfig, _tag); \ |
| 638 | |
| 639 | |
| 640 | // attributes for accesses |
| 641 | #define AM_REGION(_tag, _offs) \ |
| 642 | curentry->set_region(_tag, _offs); \ |
| 643 | |
| 644 | #define AM_SHARE(_tag) \ |
| 645 | curentry->set_share(_tag); \ |
| 646 | |
| 647 | #define AM_BASE(_base) \ |
| 648 | curentry->set_baseptr(_base); \ |
| 649 | |
| 650 | #define myoffsetof(_struct, _member) ((FPTR)&((_struct *)0x1000)->_member - 0x1000) |
| 651 | #define AM_BASE_MEMBER(_struct, _member) \ |
| 652 | curentry->set_member_baseptr(myoffsetof(_struct, _member)); \ |
| 653 | |
| 654 | #define AM_BASE_GENERIC(_member) \ |
| 655 | curentry->set_generic_baseptr(myoffsetof(generic_pointers, _member)); \ |
| 656 | |
| 657 | #define AM_SIZE(_size) \ |
| 658 | curentry->set_sizeptr(_size); \ |
| 659 | |
| 660 | #define AM_SIZE_MEMBER(_struct, _member) \ |
| 661 | curentry->set_member_sizeptr(myoffsetof(_struct, _member)); \ |
| 662 | |
| 663 | #define AM_SIZE_GENERIC(_member) \ |
| 664 | curentry->set_generic_sizeptr(myoffsetof(generic_pointers, _member##_size)); \ |
| 665 | |
| 666 | |
| 667 | // common shortcuts |
| 668 | #define AM_ROMBANK(_bank) AM_READ_BANK(_bank) |
| 669 | #define AM_RAMBANK(_bank) AM_READWRITE_BANK(_bank) |
| 670 | #define AM_RAM_READ(_read) AM_READ(_read) AM_WRITEONLY |
| 671 | #define AM_RAM_WRITE(_write) AM_READONLY AM_WRITE(_write) |
| 672 | #define AM_RAM_DEVREAD(_tag, _read) AM_DEVREAD(_tag, _read) AM_WRITEONLY |
| 673 | #define AM_RAM_DEVWRITE(_tag, _write) AM_READONLY AM_DEVWRITE(_tag, _write) |
| 674 | |
| 675 | #define AM_BASE_SIZE_MEMBER(_struct, _base, _size) AM_BASE_MEMBER(_struct, _base) AM_SIZE_MEMBER(_struct, _size) |
| 676 | #define AM_BASE_SIZE_GENERIC(_member) AM_BASE_GENERIC(_member) AM_SIZE_GENERIC(_member) |
| 677 | |
| 678 | |
| 679 | #else |
| 680 | |
| 681 | // |
| 682 | // Modern ADDRESS_MAPs |
| 683 | // |
| 684 | |
| 685 | // start/end tags for the address map |
| 686 | #define ADDRESS_MAP_NAME(_name) construct_address_map_##_name |
| 687 | |
| 688 | #define ADDRESS_MAP_START(_name, _space, _bits, _class) \ |
| 689 | void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \ |
| 690 | { \ |
| 691 | typedef read##_bits##_proto_delegate read_proto_delegate; \ |
| 692 | typedef write##_bits##_proto_delegate write_proto_delegate; \ |
| 693 | address_map_entry##_bits *curentry = NULL; \ |
| 694 | (void)curentry; \ |
| 695 | map.configure(_space, _bits); \ |
| 696 | typedef _class drivdata_class; \ |
| 697 | |
| 698 | #define ADDRESS_MAP_END \ |
| 699 | } |
| 700 | |
| 701 | // use this to declare external references to an address map |
| 702 | #define ADDRESS_MAP_EXTERN(_name, _bits) \ |
| 703 | extern void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) |
| 704 | |
| 705 | |
| 706 | // global controls |
| 707 | #define ADDRESS_MAP_GLOBAL_MASK(_mask) \ |
| 708 | map.set_global_mask(_mask); \ |
| 709 | |
| 710 | #define ADDRESS_MAP_UNMAP_LOW \ |
| 711 | map.set_unmap_value(0); \ |
| 712 | |
| 713 | #define ADDRESS_MAP_UNMAP_HIGH \ |
| 714 | map.set_unmap_value(~0); \ |
| 715 | |
| 716 | |
| 717 | // importing data from other address maps |
| 718 | #define AM_IMPORT_FROM(_name) \ |
| 719 | ADDRESS_MAP_NAME(_name)(map, devconfig); \ |
| 720 | |
| 721 | |
| 722 | // address ranges |
| 723 | #define AM_RANGE(_start, _end) \ |
| 724 | curentry = map.add(_start, _end, curentry); \ |
| 725 | |
| 726 | #define AM_MASK(_mask) \ |
| 727 | curentry->set_mask(_mask); \ |
| 728 | |
| 729 | #define AM_MIRROR(_mirror) \ |
| 730 | curentry->set_mirror(_mirror); \ |
| 731 | |
| 732 | |
| 733 | // legacy space reads |
| 734 | #define AM_READ_LEGACY(_handler) \ |
| 735 | curentry->set_handler(_handler, #_handler); \ |
| 736 | |
| 737 | #define AM_READ8_LEGACY(_handler, _unitmask) \ |
| 738 | curentry->set_handler(_handler, #_handler, _unitmask); \ |
| 739 | |
| 740 | #define AM_READ16_LEGACY(_handler, _unitmask) \ |
| 741 | curentry->set_handler(_handler, #_handler, _unitmask); \ |
| 742 | |
| 743 | #define AM_READ32_LEGACY(_handler, _unitmask) \ |
| 744 | curentry->set_handler(_handler, #_handler, _unitmask); \ |
| 745 | |
| 746 | |
| 747 | // legacy space writes |
| 748 | #define AM_WRITE_LEGACY(_handler) \ |
| 749 | curentry->set_handler(_handler, #_handler); \ |
| 750 | |
| 751 | #define AM_WRITE8_LEGACY(_handler, _unitmask) \ |
| 752 | curentry->set_handler(_handler, #_handler, _unitmask); \ |
| 753 | |
| 754 | #define AM_WRITE16_LEGACY(_handler, _unitmask) \ |
| 755 | curentry->set_handler(_handler, #_handler, _unitmask); \ |
| 756 | |
| 757 | #define AM_WRITE32_LEGACY(_handler, _unitmask) \ |
| 758 | curentry->set_handler(_handler, #_handler, _unitmask); \ |
| 759 | |
| 760 | |
| 761 | // legacy space reads/writes |
| 762 | #define AM_READWRITE_LEGACY(_rhandler, _whandler) \ |
| 763 | curentry->set_handler(_rhandler, #_rhandler, _whandler, #_whandler); \ |
| 764 | |
| 765 | #define AM_READWRITE8_LEGACY(_rhandler, _whandler, _unitmask) \ |
| 766 | curentry->set_handler(_rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \ |
| 767 | |
| 768 | #define AM_READWRITE16_LEGACY(_rhandler, _whandler, _unitmask) \ |
| 769 | curentry->set_handler(_rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \ |
| 770 | |
| 771 | #define AM_READWRITE32_LEGACY(_rhandler, _whandler, _unitmask) \ |
| 772 | curentry->set_handler(_rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \ |
| 773 | |
| 774 | |
| 775 | // legacy device reads |
| 776 | #define AM_DEVREAD_LEGACY(_tag, _handler) \ |
| 777 | curentry->set_handler(devconfig, _tag, _handler, #_handler); \ |
| 778 | |
| 779 | #define AM_DEVREAD8_LEGACY(_tag, _handler, _unitmask) \ |
| 780 | curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \ |
| 781 | |
| 782 | #define AM_DEVREAD16_LEGACY(_tag, _handler, _unitmask) \ |
| 783 | curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \ |
| 784 | |
| 785 | #define AM_DEVREAD32_LEGACY(_tag, _handler, _unitmask) \ |
| 786 | curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \ |
| 787 | |
| 788 | |
| 789 | // legacy device writes |
| 790 | #define AM_DEVWRITE_LEGACY(_tag, _handler) \ |
| 791 | curentry->set_handler(devconfig, _tag, _handler, #_handler); \ |
| 792 | |
| 793 | #define AM_DEVWRITE8_LEGACY(_tag, _handler, _unitmask) \ |
| 794 | curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \ |
| 795 | |
| 796 | #define AM_DEVWRITE16_LEGACY(_tag, _handler, _unitmask) \ |
| 797 | curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \ |
| 798 | |
| 799 | #define AM_DEVWRITE32_LEGACY(_tag, _handler, _unitmask) \ |
| 800 | curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \ |
| 801 | |
| 802 | |
| 803 | // legacy device reads/writes |
| 804 | #define AM_DEVREADWRITE_LEGACY(_tag, _rhandler, _whandler) \ |
| 805 | curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler); \ |
| 806 | |
| 807 | #define AM_DEVREADWRITE8_LEGACY(_tag, _rhandler, _whandler, _unitmask) \ |
| 808 | curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \ |
| 809 | |
| 810 | #define AM_DEVREADWRITE16_LEGACY(_tag, _rhandler, _whandler, _unitmask) \ |
| 811 | curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \ |
| 812 | |
| 813 | #define AM_DEVREADWRITE32_LEGACY(_tag, _rhandler, _whandler, _unitmask) \ |
| 814 | curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \ |
| 815 | |
| 816 | |
| 576 | 817 | // driver data reads |
| 577 | | #define AM_READ_MEMBER(_class, _handler) \ |
| 578 | | curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \ |
| 818 | #define AM_READ(_handler) \ |
| 819 | curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler)); \ |
| 579 | 820 | |
| 580 | | #define AM_READ8_MEMBER(_class, _handler, _unitmask) \ |
| 581 | | curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 821 | #define AM_READ8(_handler, _unitmask) \ |
| 822 | curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \ |
| 582 | 823 | |
| 583 | | #define AM_READ16_MEMBER(_class, _handler, _unitmask) \ |
| 584 | | curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 824 | #define AM_READ16(_handler, _unitmask) \ |
| 825 | curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \ |
| 585 | 826 | |
| 586 | | #define AM_READ32_MEMBER(_class, _handler, _unitmask) \ |
| 587 | | curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 827 | #define AM_READ32(_handler, _unitmask) \ |
| 828 | curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \ |
| 588 | 829 | |
| 589 | 830 | |
| 590 | 831 | // driver data writes |
| 591 | | #define AM_WRITE_MEMBER(_class, _handler) \ |
| 592 | | curentry->set_handler(devconfig, NULL, write_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \ |
| 832 | #define AM_WRITE(_handler) \ |
| 833 | curentry->set_handler(devconfig, NULL, write_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler)); \ |
| 593 | 834 | |
| 594 | | #define AM_WRITE8_MEMBER(_class, _handler, _unitmask) \ |
| 595 | | curentry->set_handler(devconfig, NULL, write8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 835 | #define AM_WRITE8(_handler, _unitmask) \ |
| 836 | curentry->set_handler(devconfig, NULL, write8_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \ |
| 596 | 837 | |
| 597 | | #define AM_WRITE16_MEMBER(_class, _handler, _unitmask) \ |
| 598 | | curentry->set_handler(devconfig, NULL, write16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 838 | #define AM_WRITE16(_handler, _unitmask) \ |
| 839 | curentry->set_handler(devconfig, NULL, write16_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \ |
| 599 | 840 | |
| 600 | | #define AM_WRITE32_MEMBER(_class, _handler, _unitmask) \ |
| 601 | | curentry->set_handler(devconfig, NULL, write32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 841 | #define AM_WRITE32(_handler, _unitmask) \ |
| 842 | curentry->set_handler(devconfig, NULL, write32_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \ |
| 602 | 843 | |
| 603 | 844 | |
| 604 | 845 | // driver data reads/writes |
| 605 | | #define AM_READWRITE_MEMBER(_class, _rhandler, _whandler) \ |
| 606 | | curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler)); \ |
| 846 | #define AM_READWRITE(_rhandler, _whandler) \ |
| 847 | curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<drivdata_class, &drivdata_class::_rhandler>("driver_data::" #_rhandler), write_proto_delegate::_create_member<drivdata_class, &drivdata_class::_whandler>("driver_data::" #_whandler)); \ |
| 607 | 848 | |
| 608 | | #define AM_READWRITE8_MEMBER(_class, _rhandler, _whandler, _unitmask) \ |
| 609 | | curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write8_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ |
| 849 | #define AM_READWRITE8(_rhandler, _whandler, _unitmask) \ |
| 850 | curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<drivdata_class, &drivdata_class::_rhandler>("driver_data::" #_rhandler), write8_proto_delegate::_create_member<drivdata_class, &drivdata_class::_whandler>("driver_data::" #_whandler), _unitmask); \ |
| 610 | 851 | |
| 611 | | #define AM_READWRITE16_MEMBER(_class, _rhandler, _whandler, _unitmask) \ |
| 612 | | curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write16_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ |
| 852 | #define AM_READWRITE16(_rhandler, _whandler, _unitmask) \ |
| 853 | curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<drivdata_class, &drivdata_class::_rhandler>("driver_data::" #_rhandler), write16_proto_delegate::_create_member<drivdata_class, &drivdata_class::_whandler>("driver_data::" #_whandler), _unitmask); \ |
| 613 | 854 | |
| 614 | | #define AM_READWRITE32_MEMBER(_class, _rhandler, _whandler, _unitmask) \ |
| 615 | | curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write32_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ |
| 855 | #define AM_READWRITE32(_rhandler, _whandler, _unitmask) \ |
| 856 | curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<drivdata_class, &drivdata_class::_rhandler>("driver_data::" #_rhandler), write32_proto_delegate::_create_member<drivdata_class, &drivdata_class::_whandler>("driver_data::" #_whandler), _unitmask); \ |
| 616 | 857 | |
| 617 | 858 | |
| 618 | 859 | // device reads |
| 619 | | #define AM_DEVREAD_MEMBER(_tag, _class, _handler) \ |
| 860 | #define AM_DEVREAD(_tag, _class, _handler) \ |
| 620 | 861 | curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \ |
| 621 | 862 | |
| 622 | | #define AM_DEVREAD8_MEMBER(_tag, _class, _handler, _unitmask) \ |
| 863 | #define AM_DEVREAD8(_tag, _class, _handler, _unitmask) \ |
| 623 | 864 | curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 624 | 865 | |
| 625 | | #define AM_DEVREAD16_MEMBER(_tag, _class, _handler, _unitmask) \ |
| 866 | #define AM_DEVREAD16(_tag, _class, _handler, _unitmask) \ |
| 626 | 867 | curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 627 | 868 | |
| 628 | | #define AM_DEVREAD32_MEMBER(_tag, _class, _handler, _unitmask) \ |
| 869 | #define AM_DEVREAD32(_tag, _class, _handler, _unitmask) \ |
| 629 | 870 | curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 630 | 871 | |
| 631 | 872 | |
| 632 | 873 | // device writes |
| 633 | | #define AM_DEVWRITE_MEMBER(_tag, _class, _handler) \ |
| 874 | #define AM_DEVWRITE(_tag, _class, _handler) \ |
| 634 | 875 | curentry->set_handler(devconfig, _tag, write_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \ |
| 635 | 876 | |
| 636 | | #define AM_DEVWRITE8_MEMBER(_tag, _class, _handler, _unitmask) \ |
| 877 | #define AM_DEVWRITE8(_tag, _class, _handler, _unitmask) \ |
| 637 | 878 | curentry->set_handler(devconfig, _tag, write8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 638 | 879 | |
| 639 | | #define AM_DEVWRITE16_MEMBER(_tag, _class, _handler, _unitmask) \ |
| 880 | #define AM_DEVWRITE16(_tag, _class, _handler, _unitmask) \ |
| 640 | 881 | curentry->set_handler(devconfig, _tag, write16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 641 | 882 | |
| 642 | | #define AM_DEVWRITE32_MEMBER(_tag, _class, _handler, _unitmask) \ |
| 883 | #define AM_DEVWRITE32(_tag, _class, _handler, _unitmask) \ |
| 643 | 884 | curentry->set_handler(devconfig, _tag, write32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ |
| 644 | 885 | |
| 645 | 886 | |
| 646 | 887 | // device reads/writes |
| 647 | | #define AM_DEVREADWRITE_MEMBER(_tag, _class, _rhandler, _whandler) \ |
| 888 | #define AM_DEVREADWRITE(_tag, _class, _rhandler, _whandler) \ |
| 648 | 889 | curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler)); \ |
| 649 | 890 | |
| 650 | | #define AM_DEVREADWRITE8_MEMBER(_tag, _class, _rhandler, _whandler, _unitmask) \ |
| 891 | #define AM_DEVREADWRITE8(_tag, _class, _rhandler, _whandler, _unitmask) \ |
| 651 | 892 | curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write8_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ |
| 652 | 893 | |
| 653 | | #define AM_DEVREADWRITE16_MEMBER(_tag, _class, _rhandler, _whandler, _unitmask) \ |
| 894 | #define AM_DEVREADWRITE16(_tag, _class, _rhandler, _whandler, _unitmask) \ |
| 654 | 895 | curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write16_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ |
| 655 | 896 | |
| 656 | | #define AM_DEVREADWRITE32_MEMBER(_tag, _class, _rhandler, _whandler, _unitmask) \ |
| 897 | #define AM_DEVREADWRITE32(_tag, _class, _rhandler, _whandler, _unitmask) \ |
| 657 | 898 | curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write32_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ |
| 658 | 899 | |
| 659 | 900 | |
| r8846 | r8847 | |
| 715 | 956 | #define AM_SHARE(_tag) \ |
| 716 | 957 | curentry->set_share(_tag); \ |
| 717 | 958 | |
| 718 | | #define AM_BASE(_base) \ |
| 959 | #define AM_BASE_LEGACY(_base) \ |
| 719 | 960 | curentry->set_baseptr(_base); \ |
| 720 | 961 | |
| 721 | 962 | #define myoffsetof(_struct, _member) ((FPTR)&((_struct *)0x1000)->_member - 0x1000) |
| 722 | | #define AM_BASE_MEMBER(_struct, _member) \ |
| 723 | | curentry->set_member_baseptr(myoffsetof(_struct, _member)); \ |
| 963 | #define AM_BASE(_member) \ |
| 964 | curentry->set_member_baseptr(myoffsetof(drivdata_class, _member)); \ |
| 724 | 965 | |
| 725 | 966 | #define AM_BASE_GENERIC(_member) \ |
| 726 | 967 | curentry->set_generic_baseptr(myoffsetof(generic_pointers, _member)); \ |
| 727 | 968 | |
| 728 | | #define AM_SIZE(_size) \ |
| 969 | #define AM_SIZE_LEGACY(_size) \ |
| 729 | 970 | curentry->set_sizeptr(_size); \ |
| 730 | 971 | |
| 731 | | #define AM_SIZE_MEMBER(_struct, _member) \ |
| 732 | | curentry->set_member_sizeptr(myoffsetof(_struct, _member)); \ |
| 972 | #define AM_SIZE(_struct, _member) \ |
| 973 | curentry->set_member_sizeptr(myoffsetof(drivdata_class, _member)); \ |
| 733 | 974 | |
| 734 | 975 | #define AM_SIZE_GENERIC(_member) \ |
| 735 | 976 | curentry->set_generic_sizeptr(myoffsetof(generic_pointers, _member##_size)); \ |
| r8846 | r8847 | |
| 739 | 980 | #define AM_ROMBANK(_bank) AM_READ_BANK(_bank) |
| 740 | 981 | #define AM_RAMBANK(_bank) AM_READWRITE_BANK(_bank) |
| 741 | 982 | #define AM_RAM_READ(_read) AM_READ(_read) AM_WRITEONLY |
| 742 | | #define AM_RAM_READ_MEMBER(_class, _read) AM_READ_MEMBER(_class, _read) AM_WRITEONLY |
| 743 | 983 | #define AM_RAM_WRITE(_write) AM_READONLY AM_WRITE(_write) |
| 744 | | #define AM_RAM_WRITE_MEMBER(_class, _write) AM_READONLY AM_WRITE_MEMBER(_class, _write) |
| 745 | | #define AM_RAM_DEVREAD(_tag, _read) AM_DEVREAD(_tag, _read) AM_WRITEONLY |
| 746 | | #define AM_RAM_DEVREAD_MEMBER(_tag, _class, _read) AM_DEVREAD_MEMBER(_tag, _class, _read) AM_WRITEONLY |
| 747 | | #define AM_RAM_DEVWRITE(_tag, _write) AM_READONLY AM_DEVWRITE(_tag, _write) |
| 748 | | #define AM_RAM_DEVWRITE_MEMBER(_tag, _class, _write) AM_READONLY AM_DEVWRITE_MEMBER(_tag, _class, _write) |
| 984 | #define AM_RAM_DEVREAD(_tag, _class, _read) AM_DEVREAD(_tag, _class, _read) AM_WRITEONLY |
| 985 | #define AM_RAM_DEVWRITE(_tag, _class, _write) AM_READONLY AM_DEVWRITE(_tag, _class, _write) |
| 749 | 986 | |
| 750 | | #define AM_BASE_SIZE_MEMBER(_struct, _base, _size) AM_BASE_MEMBER(_struct, _base) AM_SIZE_MEMBER(_struct, _size) |
| 987 | #define AM_BASE_SIZE(_base, _size) AM_BASE_MEMBER(_base) AM_SIZE_MEMBER(_size) |
| 751 | 988 | #define AM_BASE_SIZE_GENERIC(_member) AM_BASE_GENERIC(_member) AM_SIZE_GENERIC(_member) |
| 752 | 989 | |
| 990 | #endif |
| 753 | 991 | |
| 754 | 992 | |
| 993 | |
| 755 | 994 | //************************************************************************** |
| 756 | 995 | // GLOBAL VARIABLES |
| 757 | 996 | //************************************************************************** |