trunk/src/emu/cpu/arcompact/arcompactdasm_ops.c
| r242425 | r242426 | |
| 215 | 215 | creg = ((op & 0x00e0) >>5); \ |
| 216 | 216 | op &= ~0x00e0; \ |
| 217 | 217 | |
| 218 | #define COMMON16_GET_areg \ |
| 219 | areg = ((op & 0x0007) >>0); \ |
| 220 | op &= ~0x0007; \ |
| 221 | |
| 222 | #define COMMON16_GET_u3 \ |
| 223 | u = ((op & 0x0007) >>0); \ |
| 224 | op &= ~0x0007; \ |
| 225 | |
| 218 | 226 | #define COMMON16_GET_u5 \ |
| 219 | 227 | u = ((op & 0x001f) >>0); \ |
| 220 | 228 | op &= ~0x001f; \ |
| r242425 | r242426 | |
| 335 | 343 | |
| 336 | 344 | if ((b != LIMM_REG) && (c != LIMM_REG)) |
| 337 | 345 | { |
| 338 | | print("%s%s %s %s %08x (%08x)", optext, delaybit[n], regnames[b], regnames[c], pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 346 | print("%s%s %s, %s %08x (%08x)", optext, delaybit[n], regnames[b], regnames[c], pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 339 | 347 | } |
| 340 | 348 | else |
| 341 | 349 | { |
| r242425 | r242426 | |
| 349 | 357 | } |
| 350 | 358 | else if ((c == LIMM_REG) && (b != LIMM_REG)) |
| 351 | 359 | { |
| 352 | | print("%s%s %s (%08x) %08x (%08x)", optext, delaybit[n], regnames[b], limm, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 360 | print("%s%s %s, (%08x) %08x (%08x)", optext, delaybit[n], regnames[b], limm, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 353 | 361 | } |
| 354 | 362 | else |
| 355 | 363 | { |
| 356 | 364 | // b and c are LIMM? invalid?? |
| 357 | | print("%s%s (%08x) (%08x) (illegal?) %08x (%08x)", optext, delaybit[n], limm, limm, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 365 | print("%s%s (%08x), (%08x) (illegal?) %08x (%08x)", optext, delaybit[n], limm, limm, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 358 | 366 | |
| 359 | 367 | } |
| 360 | 368 | } |
| r242425 | r242426 | |
| 391 | 399 | |
| 392 | 400 | op &= ~0x07007fe0; |
| 393 | 401 | |
| 394 | | print("%s%s %s %02x %08x (%08x)", optext, delaybit[n], regnames[b], u, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 402 | print("%s%s %s, 0x%02x %08x (%08x)", optext, delaybit[n], regnames[b], u, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 395 | 403 | |
| 396 | 404 | return size; |
| 397 | 405 | } |
| r242425 | r242426 | |
| 442 | 450 | output += sprintf( output, "%s", addressmode[a]); |
| 443 | 451 | output += sprintf( output, "%s", cachebit[D]); |
| 444 | 452 | output += sprintf( output, " "); |
| 445 | | output += sprintf( output, "%s, ", regnames[A]); |
| 453 | output += sprintf( output, "%s <- ", regnames[A]); |
| 446 | 454 | output += sprintf( output, "["); |
| 447 | 455 | if (breg == LIMM_REG) output += sprintf( output, "(%08x), ", limm); |
| 448 | 456 | else output += sprintf( output, "%s, ", regnames[breg]); |
| 449 | | output += sprintf( output, "%d", sdat); |
| 457 | output += sprintf( output, "%03x", sdat); |
| 450 | 458 | output += sprintf( output, "]"); |
| 451 | 459 | |
| 452 | 460 | return size; |
| r242425 | r242426 | |
| 488 | 496 | output += sprintf( output, "%s", cachebit[D]); |
| 489 | 497 | output += sprintf( output, " "); |
| 490 | 498 | |
| 491 | | output += sprintf( output, "%s, ", regnames[C]); |
| 499 | output += sprintf( output, "["); |
| 492 | 500 | if (breg == LIMM_REG) output += sprintf( output, "(%08x), ", limm); |
| 493 | 501 | else output += sprintf( output, "%s, ", regnames[breg]); |
| 494 | | output += sprintf( output, "%d", sdat); |
| 502 | output += sprintf( output, "%03x", sdat); |
| 503 | output += sprintf( output, "] <- "); |
| 495 | 504 | |
| 505 | output += sprintf( output, "%s", regnames[C]); |
| 506 | |
| 496 | 507 | if (R) output += sprintf( output, "(reserved bit set)"); |
| 497 | 508 | |
| 498 | 509 | |
| r242425 | r242426 | |
| 978 | 989 | |
| 979 | 990 | |
| 980 | 991 | |
| 992 | int arcompact_handle0c_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext) |
| 993 | { |
| 994 | int areg, breg, creg; |
| 981 | 995 | |
| 996 | COMMON16_GET_areg; |
| 997 | COMMON16_GET_breg; |
| 998 | COMMON16_GET_creg; |
| 982 | 999 | |
| 1000 | REG_16BIT_RANGE(areg); |
| 1001 | REG_16BIT_RANGE(breg); |
| 1002 | REG_16BIT_RANGE(creg); |
| 983 | 1003 | |
| 1004 | |
| 1005 | print("%s %s <- [%s, %s]", optext, regnames[areg], regnames[breg], regnames[creg]); |
| 1006 | return 2; |
| 1007 | } |
| 1008 | |
| 1009 | |
| 984 | 1010 | int arcompact_handle0c_00_dasm(DASM_OPS_16) |
| 985 | 1011 | { |
| 986 | | int size = 2; |
| 987 | | print("LD_S a <- m[b + c].long (%04x)", op); |
| 988 | | return size; |
| 1012 | return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "LD_S"); |
| 989 | 1013 | } |
| 990 | 1014 | |
| 991 | 1015 | int arcompact_handle0c_01_dasm(DASM_OPS_16) |
| 992 | 1016 | { |
| 993 | | int size = 2; |
| 994 | | print("LDB_S a <- m[b + c].byte (%04x)", op); |
| 995 | | return size; |
| 1017 | return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "LDB_S"); |
| 996 | 1018 | } |
| 997 | 1019 | |
| 998 | 1020 | int arcompact_handle0c_02_dasm(DASM_OPS_16) |
| 999 | 1021 | { |
| 1000 | | int size = 2; |
| 1001 | | print("LDW_S a <- m[b + c].word (%04x)", op); |
| 1002 | | return size; |
| 1022 | return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "LDW_S"); |
| 1003 | 1023 | } |
| 1004 | 1024 | |
| 1005 | 1025 | int arcompact_handle0c_03_dasm(DASM_OPS_16) |
| 1006 | 1026 | { |
| 1007 | | int size = 2; |
| 1008 | | print("ADD_S a <- b + c (%04x)", op); |
| 1009 | | return size; |
| 1027 | return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "ADD_S"); |
| 1010 | 1028 | } |
| 1011 | 1029 | |
| 1012 | 1030 | |
| 1031 | int arcompact_handle0d_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext) |
| 1032 | { |
| 1033 | int u, breg, creg; |
| 1013 | 1034 | |
| 1035 | COMMON16_GET_u3; |
| 1036 | COMMON16_GET_breg; |
| 1037 | COMMON16_GET_creg; |
| 1038 | |
| 1039 | REG_16BIT_RANGE(breg); |
| 1040 | REG_16BIT_RANGE(creg); |
| 1041 | |
| 1042 | print("%s %s <- [%s, 0x%02x]", optext, regnames[creg], regnames[breg], u); |
| 1043 | return 2; |
| 1044 | } |
| 1045 | |
| 1046 | |
| 1014 | 1047 | int arcompact_handle0d_00_dasm(DASM_OPS_16) |
| 1015 | 1048 | { |
| 1016 | | int size = 2; |
| 1017 | | print("ADD_S c <- b + u3 (%04x)", op); |
| 1018 | | return size; |
| 1049 | return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "ADD_S"); |
| 1019 | 1050 | } |
| 1020 | 1051 | |
| 1021 | 1052 | int arcompact_handle0d_01_dasm(DASM_OPS_16) |
| 1022 | 1053 | { |
| 1023 | | int size = 2; |
| 1024 | | print("SUB_S c <- b - u3 (%04x)", op); |
| 1025 | | return size; |
| 1054 | return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "SUB_S"); |
| 1026 | 1055 | } |
| 1027 | 1056 | |
| 1028 | 1057 | int arcompact_handle0d_02_dasm(DASM_OPS_16) |
| 1029 | 1058 | { |
| 1030 | | int size = 2; |
| 1031 | | print("ASL_S c <- b asl u3 (%04x)", op); |
| 1032 | | return size; |
| 1059 | return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "ASL_S"); |
| 1033 | 1060 | } |
| 1034 | 1061 | |
| 1035 | 1062 | int arcompact_handle0d_03_dasm(DASM_OPS_16) |
| 1036 | 1063 | { |
| 1037 | | int size = 2; |
| 1038 | | print("ASL_S c <- b asr u3 (%04x)", op); |
| 1039 | | return size; |
| 1064 | return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "ASR_S"); |
| 1040 | 1065 | } |
| 1041 | 1066 | |
| 1042 | 1067 | |
| r242425 | r242426 | |
| 1407 | 1432 | return 2; |
| 1408 | 1433 | } |
| 1409 | 1434 | |
| 1435 | int arcompact_handle1d_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext) |
| 1436 | { |
| 1437 | int breg; |
| 1438 | COMMON16_GET_breg; |
| 1439 | REG_16BIT_RANGE(breg); |
| 1410 | 1440 | |
| 1411 | | int arcompact_handle1d_00_dasm(DASM_OPS_16) { print("BREQ_S (%04x)", op); return 2;} |
| 1412 | | int arcompact_handle1d_01_dasm(DASM_OPS_16) { print("BRNE_S (%04x)", op); return 2;} |
| 1441 | int s = (op & 0x007f) >> 0; op &= ~0x007f; |
| 1442 | if (s & 0x40) s = -0x40 + (s & 0x3f); |
| 1413 | 1443 | |
| 1444 | print("%s %s %08x", optext, regnames[breg], (pc&0xfffffffc) + s*2); |
| 1445 | return 2; |
| 1446 | } |
| 1414 | 1447 | |
| 1415 | | int arcompact_handle1e_00_dasm(DASM_OPS_16) { print("B_S (%04x)", op); return 2;} |
| 1416 | | int arcompact_handle1e_01_dasm(DASM_OPS_16) { print("BEQ_S (%04x)", op); return 2;} |
| 1417 | | int arcompact_handle1e_02_dasm(DASM_OPS_16) { print("BNE_S (%04x)", op); return 2;} |
| 1418 | 1448 | |
| 1419 | | int arcompact_handle1e_03_00_dasm(DASM_OPS_16) { print("BGT_S (%04x)", op); return 2;} |
| 1420 | | int arcompact_handle1e_03_01_dasm(DASM_OPS_16) { print("BGE_S (%04x)", op); return 2;} |
| 1421 | | int arcompact_handle1e_03_02_dasm(DASM_OPS_16) { print("BLT_S (%04x)", op); return 2;} |
| 1422 | | int arcompact_handle1e_03_03_dasm(DASM_OPS_16) { print("BLE_S (%04x)", op); return 2;} |
| 1423 | | int arcompact_handle1e_03_04_dasm(DASM_OPS_16) { print("BHI_S (%04x)", op); return 2;} |
| 1424 | | int arcompact_handle1e_03_05_dasm(DASM_OPS_16) { print("BHS_S (%04x)", op); return 2;} |
| 1425 | | int arcompact_handle1e_03_06_dasm(DASM_OPS_16) { print("BLO_S (%04x)", op); return 2;} |
| 1426 | | int arcompact_handle1e_03_07_dasm(DASM_OPS_16) { print("BLS_S (%04x)", op); return 2;} |
| 1449 | int arcompact_handle1d_00_dasm(DASM_OPS_16) { return arcompact_handle1d_helper_dasm(output,pc,op,oprom,"BREQ_S"); } |
| 1450 | int arcompact_handle1d_01_dasm(DASM_OPS_16) { return arcompact_handle1d_helper_dasm(output,pc,op,oprom,"BRNE_S"); } |
| 1427 | 1451 | |
| 1452 | |
| 1453 | int arcompact_handle1e_0x_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext) |
| 1454 | { |
| 1455 | int s = (op & 0x01ff) >> 0; op &= ~0x01ff; |
| 1456 | if (s & 0x100) s = -0x100 + (s & 0xff); |
| 1457 | |
| 1458 | print("%s %08x", optext, (pc&0xfffffffc) + s*2); |
| 1459 | return 2; |
| 1460 | } |
| 1461 | |
| 1462 | |
| 1463 | |
| 1464 | int arcompact_handle1e_00_dasm(DASM_OPS_16) { return arcompact_handle1e_0x_helper_dasm(output, pc, op, oprom, "BL_S"); } |
| 1465 | int arcompact_handle1e_01_dasm(DASM_OPS_16) { return arcompact_handle1e_0x_helper_dasm(output, pc, op, oprom, "BEQ_S"); } |
| 1466 | int arcompact_handle1e_02_dasm(DASM_OPS_16) { return arcompact_handle1e_0x_helper_dasm(output, pc, op, oprom, "BNE_S"); } |
| 1467 | |
| 1468 | int arcompact_handle1e_03_0x_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext) |
| 1469 | { |
| 1470 | int s = (op & 0x003f) >> 0; op &= ~0x003f; |
| 1471 | if (s & 0x020) s = -0x20 + (s & 0x1f); |
| 1472 | |
| 1473 | print("%s %08x", optext, (pc&0xfffffffc) + s*2); |
| 1474 | return 2; |
| 1475 | } |
| 1476 | |
| 1477 | int arcompact_handle1e_03_00_dasm(DASM_OPS_16) { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BGT_S"); } |
| 1478 | int arcompact_handle1e_03_01_dasm(DASM_OPS_16) { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BGE_S"); } |
| 1479 | int arcompact_handle1e_03_02_dasm(DASM_OPS_16) { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLT_S"); } |
| 1480 | int arcompact_handle1e_03_03_dasm(DASM_OPS_16) { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLE_S"); } |
| 1481 | int arcompact_handle1e_03_04_dasm(DASM_OPS_16) { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BHI_S"); } |
| 1482 | int arcompact_handle1e_03_05_dasm(DASM_OPS_16) { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BHS_S"); } |
| 1483 | int arcompact_handle1e_03_06_dasm(DASM_OPS_16) { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLO_S"); } |
| 1484 | int arcompact_handle1e_03_07_dasm(DASM_OPS_16) { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLS_S"); } |
| 1485 | |
| 1428 | 1486 | int arcompact_handle1f_dasm(DASM_OPS_16) |
| 1429 | 1487 | { |
| 1430 | | print("BL_S (%04x)", op); |
| 1488 | int s = (op & 0x07ff) >> 0; op &= ~0x07ff; |
| 1489 | if (s & 0x400) s = -0x400 + (s & 0x3ff); |
| 1490 | |
| 1491 | print("BL_S %08x", (pc&0xfffffffc) + (s*4)); |
| 1431 | 1492 | return 2; |
| 1432 | 1493 | } |
| 1433 | 1494 | |