trunk/src/emu/cpu/arcompact/arcompactdasm_ops.c
| r242362 | r242363 | |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | |
| 390 | | int arcompact_handle04_helper_dasm(char *output, offs_t pc, UINT32 op, const UINT8* oprom, const char* optext, int ignore_dst) |
| 390 | int arcompact_handle04_helper_dasm(char *output, offs_t pc, UINT32 op, const UINT8* oprom, const char* optext, int ignore_dst, int b_reserved) |
| 391 | 391 | { |
| 392 | 392 | // PP |
| 393 | 393 | // 0010 0bbb 00ii iiii FBBB CCCC CCAA AAAA |
| r242362 | r242363 | |
| 401 | 401 | |
| 402 | 402 | output += sprintf( output, "%s", optext); |
| 403 | 403 | output += sprintf( output, "%s", flagbit[F]); |
| 404 | | output += sprintf( output, " p(%d)", p); |
| 405 | | output += sprintf( output, " %s, ", regnames[breg]); |
| 404 | // output += sprintf( output, " p(%d)", p); |
| 405 | |
| 406 | |
| 407 | if (!b_reserved) |
| 408 | { |
| 409 | output += sprintf(output, " %s, ", regnames[breg]); |
| 410 | } |
| 411 | else |
| 412 | { |
| 413 | if (breg) output += sprintf(output, "reserved(%s), ", regnames[breg]); |
| 414 | } |
| 406 | 415 | |
| 416 | |
| 407 | 417 | if (p == 0) |
| 408 | 418 | { |
| 409 | 419 | // 0010 0bbb 00ii iiii FBBB CCCC CCAA AAAA |
| r242362 | r242363 | |
| 417 | 427 | GET_LIMM_32; |
| 418 | 428 | size = 8; |
| 419 | 429 | output += sprintf( output, "(%08x) ", limm ); |
| 420 | | if (!ignore_dst) output += sprintf( output, "A(%s)", regnames[A]); |
| 421 | | else output += sprintf( output, "unused(%s)", regnames[A]); |
| 430 | if (!ignore_dst) output += sprintf( output, "DST(%s)", regnames[A]); |
| 431 | else |
| 432 | { |
| 433 | if (A) output += sprintf(output, "unused(%s)", regnames[A]); |
| 434 | } |
| 422 | 435 | } |
| 423 | 436 | else |
| 424 | 437 | { |
| 425 | 438 | output += sprintf( output, "C(%s) ", regnames[C]); |
| 426 | | if (!ignore_dst) output += sprintf( output, "A(%s)", regnames[A]); |
| 427 | | else output += sprintf( output, "unused(%s)", regnames[A]); |
| 439 | if (!ignore_dst) output += sprintf( output, "DST(%s)", regnames[A]); |
| 440 | else |
| 441 | { |
| 442 | if (A) output += sprintf(output, "unused(%s)", regnames[A]); |
| 443 | } |
| 428 | 444 | |
| 429 | 445 | } |
| 430 | 446 | } |
| r242362 | r242363 | |
| 435 | 451 | int A = (op & 0x0000003f) >> 0; op &= ~0x0000003f; |
| 436 | 452 | |
| 437 | 453 | output += sprintf( output, "U(%02x) ", U ); |
| 438 | | if (!ignore_dst) output += sprintf( output, "A(%s)", regnames[A]); |
| 439 | | else output += sprintf( output, "unused(%s)", regnames[A]); |
| 454 | if (!ignore_dst) output += sprintf( output, "DST(%s)", regnames[A]); |
| 455 | else |
| 456 | { |
| 457 | if (A) output += sprintf(output, "unused(%s)", regnames[A]); |
| 458 | } |
| 440 | 459 | } |
| 441 | 460 | else if (p == 2) |
| 442 | 461 | { |
| r242362 | r242363 | |
| 472 | 491 | |
| 473 | 492 | int arcompact_handle04_00_dasm(DASM_OPS_32) |
| 474 | 493 | { |
| 475 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD", 0); |
| 494 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD", 0,0); |
| 476 | 495 | } |
| 477 | 496 | |
| 478 | 497 | int arcompact_handle04_01_dasm(DASM_OPS_32) |
| 479 | 498 | { |
| 480 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADC", 0); |
| 499 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADC", 0,0); |
| 481 | 500 | } |
| 482 | 501 | |
| 483 | 502 | int arcompact_handle04_02_dasm(DASM_OPS_32) |
| 484 | 503 | { |
| 485 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB", 0); |
| 504 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB", 0,0); |
| 486 | 505 | } |
| 487 | 506 | |
| 488 | 507 | int arcompact_handle04_03_dasm(DASM_OPS_32) |
| 489 | 508 | { |
| 490 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SBC", 0); |
| 509 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SBC", 0,0); |
| 491 | 510 | } |
| 492 | 511 | |
| 493 | 512 | int arcompact_handle04_04_dasm(DASM_OPS_32) |
| 494 | 513 | { |
| 495 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "AND", 0); |
| 514 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "AND", 0,0); |
| 496 | 515 | } |
| 497 | 516 | |
| 498 | 517 | int arcompact_handle04_05_dasm(DASM_OPS_32) |
| 499 | 518 | { |
| 500 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "OR", 0); |
| 519 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "OR", 0,0); |
| 501 | 520 | } |
| 502 | 521 | |
| 503 | 522 | int arcompact_handle04_06_dasm(DASM_OPS_32) |
| 504 | 523 | { |
| 505 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BIC", 0); |
| 524 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BIC", 0,0); |
| 506 | 525 | } |
| 507 | 526 | |
| 508 | 527 | int arcompact_handle04_07_dasm(DASM_OPS_32) |
| 509 | 528 | { |
| 510 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "XOR", 0); |
| 529 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "XOR", 0,0); |
| 511 | 530 | } |
| 512 | 531 | |
| 513 | 532 | int arcompact_handle04_08_dasm(DASM_OPS_32) |
| 514 | 533 | { |
| 515 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MAX", 0); |
| 534 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MAX", 0,0); |
| 516 | 535 | } |
| 517 | 536 | |
| 518 | 537 | int arcompact_handle04_09_dasm(DASM_OPS_32) |
| 519 | 538 | { |
| 520 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MIN", 0); |
| 539 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MIN", 0,0); |
| 521 | 540 | } |
| 522 | 541 | |
| 523 | 542 | |
| 524 | 543 | int arcompact_handle04_0a_dasm(DASM_OPS_32) |
| 525 | 544 | { |
| 526 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MOV", 1); |
| 545 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MOV", 1,0); |
| 527 | 546 | } |
| 528 | 547 | |
| 529 | 548 | int arcompact_handle04_0b_dasm(DASM_OPS_32) |
| 530 | 549 | { |
| 531 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "TST", 1); |
| 550 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "TST", 1,0); |
| 532 | 551 | } |
| 533 | 552 | |
| 534 | 553 | int arcompact_handle04_0c_dasm(DASM_OPS_32) |
| 535 | 554 | { |
| 536 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "CMP", 1); |
| 555 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "CMP", 1,0); |
| 537 | 556 | } |
| 538 | 557 | |
| 539 | 558 | int arcompact_handle04_0d_dasm(DASM_OPS_32) |
| 540 | 559 | { |
| 541 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "RCMP", 1); |
| 560 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "RCMP", 1,0); |
| 542 | 561 | } |
| 543 | 562 | |
| 544 | 563 | int arcompact_handle04_0e_dasm(DASM_OPS_32) |
| 545 | 564 | { |
| 546 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "RSUB", 0); |
| 565 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "RSUB", 0,0); |
| 547 | 566 | } |
| 548 | 567 | |
| 549 | 568 | int arcompact_handle04_0f_dasm(DASM_OPS_32) |
| 550 | 569 | { |
| 551 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BSET", 0); |
| 570 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BSET", 0,0); |
| 552 | 571 | } |
| 553 | 572 | |
| 554 | 573 | int arcompact_handle04_10_dasm(DASM_OPS_32) |
| 555 | 574 | { |
| 556 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BCLR", 0); |
| 575 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BCLR", 0,0); |
| 557 | 576 | } |
| 558 | 577 | |
| 559 | 578 | int arcompact_handle04_11_dasm(DASM_OPS_32) |
| 560 | 579 | { |
| 561 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BTST", 0); |
| 580 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BTST", 0,0); |
| 562 | 581 | } |
| 563 | 582 | |
| 564 | 583 | int arcompact_handle04_12_dasm(DASM_OPS_32) |
| 565 | 584 | { |
| 566 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BXOR", 0); |
| 585 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BXOR", 0,0); |
| 567 | 586 | } |
| 568 | 587 | |
| 569 | 588 | int arcompact_handle04_13_dasm(DASM_OPS_32) |
| 570 | 589 | { |
| 571 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BMSK", 0); |
| 590 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BMSK", 0,0); |
| 572 | 591 | } |
| 573 | 592 | |
| 574 | 593 | int arcompact_handle04_14_dasm(DASM_OPS_32) |
| 575 | 594 | { |
| 576 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD1", 0); |
| 595 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD1", 0,0); |
| 577 | 596 | } |
| 578 | 597 | |
| 579 | 598 | int arcompact_handle04_15_dasm(DASM_OPS_32) |
| 580 | 599 | { |
| 581 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD2", 0); |
| 600 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD2", 0,0); |
| 582 | 601 | } |
| 583 | 602 | |
| 584 | 603 | int arcompact_handle04_16_dasm(DASM_OPS_32) |
| 585 | 604 | { |
| 586 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD3", 0); |
| 605 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD3", 0,0); |
| 587 | 606 | } |
| 588 | 607 | |
| 589 | 608 | int arcompact_handle04_17_dasm(DASM_OPS_32) |
| 590 | 609 | { |
| 591 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB1", 0); |
| 610 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB1", 0,0); |
| 592 | 611 | } |
| 593 | 612 | |
| 594 | 613 | int arcompact_handle04_18_dasm(DASM_OPS_32) |
| 595 | 614 | { |
| 596 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB2", 0); |
| 615 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB2", 0,0); |
| 597 | 616 | } |
| 598 | 617 | |
| 599 | 618 | int arcompact_handle04_19_dasm(DASM_OPS_32) |
| 600 | 619 | { |
| 601 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB3", 0); |
| 620 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB3", 0,0); |
| 602 | 621 | } |
| 603 | 622 | |
| 604 | 623 | int arcompact_handle04_1a_dasm(DASM_OPS_32) |
| 605 | 624 | { |
| 606 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPY", 0); |
| 625 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPY", 0,0); |
| 607 | 626 | } // * |
| 608 | 627 | |
| 609 | 628 | int arcompact_handle04_1b_dasm(DASM_OPS_32) |
| 610 | 629 | { |
| 611 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPYH", 0); |
| 630 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPYH", 0,0); |
| 612 | 631 | } // * |
| 613 | 632 | |
| 614 | 633 | int arcompact_handle04_1c_dasm(DASM_OPS_32) |
| 615 | 634 | { |
| 616 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPYHU", 0); |
| 635 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPYHU", 0,0); |
| 617 | 636 | } // * |
| 618 | 637 | |
| 619 | 638 | int arcompact_handle04_1d_dasm(DASM_OPS_32) |
| 620 | 639 | { |
| 621 | | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPYU", 0); |
| 640 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPYU", 0,0); |
| 622 | 641 | } // * |
| 623 | 642 | |
| 624 | 643 | |
| 625 | 644 | |
| 626 | 645 | int arcompact_handle04_20_dasm(DASM_OPS_32) |
| 627 | 646 | { |
| 628 | | // todo, other bits (in none long immediate mode at least) |
| 647 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "J", 1,1); |
| 648 | } |
| 629 | 649 | |
| 630 | | int size = 4; |
| 631 | | int C = (op & 0x00000fc0) >> 6; |
| 632 | | UINT8 condition = op & 0x0000001f; |
| 633 | 650 | |
| 634 | | op &= ~0x00000fc0; |
| 635 | | |
| 636 | | if (C == LIMM_REG) |
| 637 | | { |
| 638 | | UINT32 limm; |
| 639 | | GET_LIMM_32; |
| 640 | | size = 8; |
| 641 | | |
| 642 | | print("J(%s) %08x (%08x)", conditions[condition], limm, op); |
| 643 | | } |
| 644 | | else |
| 645 | | { |
| 646 | | print("J(%s) (r%d) (%08x)", conditions[condition], C, op); |
| 647 | | } |
| 648 | 651 | |
| 649 | | return size; |
| 652 | int arcompact_handle04_21_dasm(DASM_OPS_32) |
| 653 | { |
| 654 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "J.D", 1,1); |
| 650 | 655 | } |
| 651 | 656 | |
| 657 | int arcompact_handle04_22_dasm(DASM_OPS_32) |
| 658 | { |
| 659 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "JL", 1,1); |
| 660 | } |
| 652 | 661 | |
| 662 | int arcompact_handle04_23_dasm(DASM_OPS_32) |
| 663 | { |
| 664 | return arcompact_handle04_helper_dasm(output, pc, op, oprom, "JL.D", 1,1); |
| 665 | } |
| 653 | 666 | |
| 654 | | int arcompact_handle04_21_dasm(DASM_OPS_32) { print("Jcc.D (%08x)", op); return 4;} |
| 655 | | int arcompact_handle04_22_dasm(DASM_OPS_32) { print("JLcc (%08x)", op); return 4;} |
| 656 | | int arcompact_handle04_23_dasm(DASM_OPS_32) { print("JLcc.D (%08x)", op); return 4;} |
| 657 | 667 | |
| 658 | 668 | |
| 659 | 669 | |
| 660 | | |
| 661 | 670 | int arcompact_handle04_28_dasm(DASM_OPS_32) { print("LPcc (%08x)", op); return 4;} |
| 662 | 671 | int arcompact_handle04_29_dasm(DASM_OPS_32) { print("FLAG (%08x)", op); return 4;} |
| 663 | 672 | int arcompact_handle04_2a_dasm(DASM_OPS_32) { print("LR (%08x)", op); return 4;} |
| r242362 | r242363 | |
| 690 | 699 | |
| 691 | 700 | |
| 692 | 701 | |
| 702 | // format on these is.. |
| 693 | 703 | |
| 694 | | |
| 704 | // 0010 0bbb aa11 0ZZX DBBB CCCC CCAA AAAA |
| 705 | // note, bits 11 0ZZX are part of the sub-opcode # already - this is a special encoding |
| 695 | 706 | int arcompact_handle04_30_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x30) (%08x)", op); return 4;} |
| 696 | | int arcompact_handle04_31_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x31) (%08x)", op); return 4;} |
| 707 | // ZZ value of 0x0 with X of 1 is illegal |
| 708 | int arcompact_handle04_31_dasm(DASM_OPS_32) { print("LD r-r (illegal 0x31) (%08x)", op); return 4;} |
| 697 | 709 | int arcompact_handle04_32_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x32) (%08x)", op); return 4;} |
| 698 | 710 | int arcompact_handle04_33_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x33) (%08x)", op); return 4;} |
| 699 | 711 | int arcompact_handle04_34_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x34) (%08x)", op); return 4;} |
| 700 | 712 | int arcompact_handle04_35_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x35) (%08x)", op); return 4;} |
| 701 | | int arcompact_handle04_36_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x36) (%08x)", op); return 4;} |
| 702 | | int arcompact_handle04_37_dasm(DASM_OPS_32) { print("LD r-r (basecase 0x37) (%08x)", op); return 4;} |
| 713 | // ZZ value of 0x3 is illegal |
| 714 | int arcompact_handle04_36_dasm(DASM_OPS_32) { print("LD r-r (illegal 0x36) (%08x)", op); return 4;} |
| 715 | int arcompact_handle04_37_dasm(DASM_OPS_32) { print("LD r-r (illegal 0x37) (%08x)", op); return 4;} |
| 703 | 716 | |
| 704 | 717 | |
| 705 | 718 | |