trunk/src/emu/cpu/arcompact/arcompactdasm_ops.c
| r242439 | r242440 | |
| 184 | 184 | /* 36 */ "r54(ext)", |
| 185 | 185 | /* 37 */ "r55(ext)", |
| 186 | 186 | /* 38 */ "r56(ext)", |
| 187 | | /* 39 */ "r57(ext)", // MLO (result registers for optional multply functions) |
| 188 | | /* 3a */ "r58(ext)", // MMID |
| 189 | | /* 3b */ "r59(ext)", // MHI |
| 187 | /* 39 */ "r57(M-LO)", // MLO (result registers for optional multply functions) |
| 188 | /* 3a */ "r58(M-MID)", // MMID |
| 189 | /* 3b */ "r59(M-HI)", // MHI |
| 190 | 190 | /* 3c */ "r60(LP_COUNT)", |
| 191 | 191 | /* 3d */ "r61(reserved)", |
| 192 | 192 | /* 3e */ "r62(LIMM)", // use Long Immediate Data instead of register |
| r242439 | r242440 | |
| 207 | 207 | h |= ((op & 0x00e0) >> 5); \ |
| 208 | 208 | op &= ~0x00e7; \ |
| 209 | 209 | |
| 210 | #define COMMON32_GET_breg \ |
| 211 | int b_temp = (op & 0x07000000) >> 24; op &= ~0x07000000; \ |
| 212 | int B_temp = (op & 0x00007000) >> 12; op &= ~0x00007000; \ |
| 213 | int breg = b_temp | (B_temp << 3); \ |
| 214 | |
| 210 | 215 | #define COMMON16_GET_breg \ |
| 211 | 216 | breg = ((op & 0x0700) >>8); \ |
| 212 | 217 | op &= ~0x0700; \ |
| r242439 | r242440 | |
| 338 | 343 | |
| 339 | 344 | |
| 340 | 345 | int c = (op & 0x00000fc0) >> 6; |
| 341 | | int b = (op & 0x07000000) >> 24; |
| 342 | | b |= ((op & 0x00007000) >> 12) << 3; |
| 346 | COMMON32_GET_breg; |
| 343 | 347 | int n = (op & 0x00000020) >> 5; op &= ~0x00000020; |
| 344 | 348 | |
| 345 | 349 | op &= ~0x07007fe0; |
| 346 | 350 | |
| 347 | | if ((b != LIMM_REG) && (c != LIMM_REG)) |
| 351 | if ((breg != LIMM_REG) && (c != LIMM_REG)) |
| 348 | 352 | { |
| 349 | | print("%s%s %s, %s %08x (%08x)", optext, delaybit[n], regnames[b], regnames[c], PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f); |
| 353 | print("%s%s %s, %s %08x (%08x)", optext, delaybit[n], regnames[breg], regnames[c], PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f); |
| 350 | 354 | } |
| 351 | 355 | else |
| 352 | 356 | { |
| r242439 | r242440 | |
| 354 | 358 | GET_LIMM_32; |
| 355 | 359 | size = 8; |
| 356 | 360 | |
| 357 | | if ((b == LIMM_REG) && (c != LIMM_REG)) |
| 361 | if ((breg == LIMM_REG) && (c != LIMM_REG)) |
| 358 | 362 | { |
| 359 | | print("%s%s (%08x) %s %08x (%08x)", optext, delaybit[n], limm, regnames[b], PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f); |
| 363 | print("%s%s (%08x) %s %08x (%08x)", optext, delaybit[n], limm, regnames[breg], PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f); |
| 360 | 364 | } |
| 361 | | else if ((c == LIMM_REG) && (b != LIMM_REG)) |
| 365 | else if ((c == LIMM_REG) && (breg != LIMM_REG)) |
| 362 | 366 | { |
| 363 | | print("%s%s %s, (%08x) %08x (%08x)", optext, delaybit[n], regnames[b], limm, PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f); |
| 367 | print("%s%s %s, (%08x) %08x (%08x)", optext, delaybit[n], regnames[breg], limm, PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f); |
| 364 | 368 | } |
| 365 | 369 | else |
| 366 | 370 | { |
| r242439 | r242440 | |
| 396 | 400 | GET_01_01_01_BRANCH_ADDR |
| 397 | 401 | |
| 398 | 402 | int u = (op & 0x00000fc0) >> 6; |
| 399 | | int b = (op & 0x07000000) >> 24; |
| 400 | | b |= ((op & 0x00007000) >> 12) << 3; |
| 403 | COMMON32_GET_breg; |
| 401 | 404 | int n = (op & 0x00000020) >> 5; op &= ~0x00000020; |
| 402 | 405 | |
| 403 | 406 | op &= ~0x07007fe0; |
| 404 | 407 | |
| 405 | | print("%s%s %s, 0x%02x %08x (%08x)", optext, delaybit[n], regnames[b], u, PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f); |
| 408 | print("%s%s %s, 0x%02x %08x (%08x)", optext, delaybit[n], regnames[breg], u, PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f); |
| 406 | 409 | |
| 407 | 410 | return size; |
| 408 | 411 | } |
| r242439 | r242440 | |
| 432 | 435 | int Z = (op & 0x00000180) >> 7; //op &= ~0x00000180; |
| 433 | 436 | int a = (op & 0x00000600) >> 9; //op &= ~0x00000600; |
| 434 | 437 | int D = (op & 0x00000800) >> 11;// op &= ~0x00000800; |
| 435 | | int B = (op & 0x00007000) >> 12;// op &= ~0x00007000; |
| 436 | 438 | int S = (op & 0x00008000) >> 15;// op &= ~0x00008000; |
| 437 | 439 | int s = (op & 0x00ff0000) >> 16;// op &= ~0x00ff0000; |
| 438 | | int b = (op & 0x07000000) >> 24;// op &= ~0x07000000; |
| 440 | COMMON32_GET_breg; |
| 439 | 441 | |
| 440 | | int breg = b | (B << 3); |
| 441 | 442 | int sdat = s | (S << 8); // todo - signed |
| 442 | 443 | |
| 443 | 444 | UINT32 limm = 0; |
| r242439 | r242440 | |
| 471 | 472 | // fedc ba98 7654 3210 fedc ba98 7654 3210 |
| 472 | 473 | // fields |
| 473 | 474 | // 0001 1bbb ssss ssss SBBB CCCC CCDa aZZR |
| 474 | | int B = (op & 0x00007000) >> 12;// op &= ~0x00007000; |
| 475 | 475 | int S = (op & 0x00008000) >> 15;// op &= ~0x00008000; |
| 476 | 476 | int s = (op & 0x00ff0000) >> 16;// op &= ~0x00ff0000; |
| 477 | | int b = (op & 0x07000000) >> 24;// op &= ~0x07000000; |
| 478 | 477 | |
| 479 | | int breg = b | (B << 3); |
| 478 | COMMON32_GET_breg; |
| 480 | 479 | int sdat = s | (S << 8); // todo - signed |
| 481 | 480 | |
| 482 | 481 | int R = (op & 0x00000001) >> 0; op &= ~0x00000001; |
| r242439 | r242440 | |
| 519 | 518 | // PP |
| 520 | 519 | // 0010 0bbb 00ii iiii FBBB CCCC CCAA AAAA |
| 521 | 520 | int size = 4; |
| 521 | UINT32 limm = 0; |
| 522 | int got_limm = 0; |
| 522 | 523 | |
| 523 | 524 | int p = (op & 0x00c00000) >> 22; op &= ~0x00c00000; |
| 524 | | int b = (op & 0x07000000) >> 24; op &= ~0x07000000; |
| 525 | | int B = (op & 0x00007000) >> 12; op &= ~0x00007000; |
| 526 | | int breg = b | (B << 3); |
| 527 | | int F = (op & 0x00008000) >> 15;op &= ~0x00008000; |
| 525 | COMMON32_GET_breg; |
| 526 | int F = (op & 0x00008000) >> 15; op &= ~0x00008000; |
| 528 | 527 | |
| 529 | 528 | output += sprintf( output, "%s", optext); |
| 530 | 529 | output += sprintf( output, "%s", flagbit[F]); |
| r242439 | r242440 | |
| 533 | 532 | |
| 534 | 533 | if (!b_reserved) |
| 535 | 534 | { |
| 536 | | output += sprintf(output, " %s, ", regnames[breg]); |
| 535 | if (breg == LIMM_REG) |
| 536 | { |
| 537 | GET_LIMM_32; |
| 538 | size = 8; |
| 539 | got_limm = 1; |
| 540 | output += sprintf( output, "(%08x) ", limm ); |
| 541 | |
| 542 | } |
| 543 | else |
| 544 | { |
| 545 | output += sprintf(output, " %s, ", regnames[breg]); |
| 546 | } |
| 537 | 547 | } |
| 538 | 548 | else |
| 539 | 549 | { |
| r242439 | r242440 | |
| 550 | 560 | |
| 551 | 561 | if (C == LIMM_REG) |
| 552 | 562 | { |
| 553 | | UINT32 limm; |
| 554 | | GET_LIMM_32; |
| 555 | | size = 8; |
| 563 | if (!got_limm) |
| 564 | { |
| 565 | GET_LIMM_32; |
| 566 | size = 8; |
| 567 | } |
| 568 | |
| 556 | 569 | output += sprintf( output, "(%08x) ", limm ); |
| 557 | 570 | if (!ignore_dst) output += sprintf( output, "DST(%s)", regnames[A]); |
| 558 | 571 | else |
| r242439 | r242440 | |
| 807 | 820 | int size = 4; |
| 808 | 821 | |
| 809 | 822 | int p = (op & 0x00c00000) >> 22; op &= ~0x00c00000; |
| 810 | | int b = (op & 0x07000000) >> 24; op &= ~0x07000000; |
| 811 | | int B = (op & 0x00007000) >> 12; op &= ~0x00007000; |
| 812 | | int breg = b | (B << 3); |
| 813 | | int F = (op & 0x00008000) >> 15;op &= ~0x00008000; |
| 823 | COMMON32_GET_breg; |
| 824 | int F = (op & 0x00008000) >> 15; op &= ~0x00008000; |
| 814 | 825 | |
| 815 | 826 | output += sprintf( output, "%s", optext); |
| 816 | 827 | output += sprintf( output, "%s", flagbit[F]); |
| r242439 | r242440 | |
| 888 | 899 | int arcompact_handle04_3x_helper_dasm(DASM_OPS_32, int dsize, int extend) |
| 889 | 900 | { |
| 890 | 901 | int size = 4; |
| 902 | UINT32 limm; |
| 903 | int got_limm = 0; |
| 904 | |
| 891 | 905 | output += sprintf(output, "LD"); |
| 892 | 906 | output += sprintf(output, "%s", datasize[dsize]); |
| 893 | 907 | output += sprintf(output, "%s", dataextend[extend]); |
| 894 | 908 | |
| 895 | 909 | int mode = (op & 0x00c00000) >> 22; op &= ~0x00c00000; |
| 896 | | int b = (op & 0x07000000) >> 24; op &= ~0x07000000; |
| 897 | | int B = (op & 0x00007000) >> 12; op &= ~0x00007000; |
| 898 | | int breg = b | (B << 3); |
| 899 | | int D = (op & 0x00008000) >> 15;op &= ~0x00008000; |
| 910 | COMMON32_GET_breg; |
| 911 | int D = (op & 0x00008000) >> 15; op &= ~0x00008000; |
| 900 | 912 | int C = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; |
| 901 | 913 | int A = (op & 0x0000003f) >> 0; op &= ~0x0000003f; |
| 902 | 914 | |
| 903 | 915 | output += sprintf(output, "%s", addressmode[mode]); |
| 904 | 916 | output += sprintf(output, "%s", cachebit[D]); |
| 905 | 917 | |
| 906 | | output += sprintf( output, "DST(%s)", regnames[A]); |
| 907 | | output += sprintf( output, "SRC1(%s)", regnames[breg]); |
| 908 | | output += sprintf( output, "SRC2(%s)", regnames[C]); |
| 918 | output += sprintf( output, " %s. ", regnames[A]); |
| 909 | 919 | |
| 910 | | |
| 920 | if (breg == LIMM_REG) |
| 921 | { |
| 922 | GET_LIMM_32; |
| 923 | size = 8; |
| 924 | got_limm = 1; |
| 925 | output += sprintf( output, "[%08x, ", limm ); |
| 911 | 926 | |
| 927 | } |
| 928 | else |
| 929 | { |
| 930 | output += sprintf(output, "[%s, ", regnames[breg]); |
| 931 | } |
| 912 | 932 | |
| 933 | if (C == LIMM_REG) |
| 934 | { |
| 935 | if (!got_limm) |
| 936 | { |
| 937 | GET_LIMM_32; |
| 938 | size = 8; |
| 939 | } |
| 940 | output += sprintf( output, "(%08x)]", limm ); |
| 941 | |
| 942 | } |
| 943 | else |
| 944 | { |
| 945 | output += sprintf( output, "%s]", regnames[C]); |
| 946 | } |
| 947 | |
| 948 | |
| 913 | 949 | return size; |
| 914 | 950 | |
| 915 | 951 | |
| r242439 | r242440 | |
| 963 | 999 | int size = 4; |
| 964 | 1000 | |
| 965 | 1001 | int p = (op & 0x00c00000) >> 22; op &= ~0x00c00000; |
| 966 | | int b = (op & 0x07000000) >> 24; op &= ~0x07000000; |
| 967 | | int B = (op & 0x00007000) >> 12; op &= ~0x00007000; |
| 968 | | int breg = b | (B << 3); |
| 1002 | COMMON32_GET_breg; |
| 969 | 1003 | int F = (op & 0x00008000) >> 15;op &= ~0x00008000; |
| 970 | 1004 | |
| 971 | 1005 | output += sprintf( output, "%s", optext); |