(*info->fprintf_func)(info->stream, "%s", decodePTR->opcodePTR->name);
/* First we compare the shorthand format of the constraints. If we
- still are unable to pinpoint the operands
- we analyze the opcodes constraint string. */
- switch (decodePTR->opcodePTR->sh_format)
- {
- case XG_R_C:
- (*info->fprintf_func)(info->stream, " R%x, CCR",
- (raw_code >> 8) & 0x7);
- break;
- case XG_C_R:
- (*info->fprintf_func)(info->stream, " CCR, R%x",
- (raw_code >> 8) & 0x7);
- break;
- case XG_R_P:
- (*info->fprintf_func)(info->stream, " R%x, PC",
- (raw_code >> 8) & 0x7);
- break;
- case XG_INH:
- break;
- case XG_R_R_R:
- if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_TRI))
- {
- (*info->fprintf_func)(info->stream, " R%x, R%x, R%x",
- (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
- (raw_code >> 2) & 0x7);
- }
- else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IDR))
- {
- if (raw_code & 0x01)
- {
- (*info->fprintf_func)(info->stream, " R%x, (R%x, R%x+)",
- (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
- (raw_code >> 2) & 0x7);
- }
- else if (raw_code & 0x02)
- {
- (*info->fprintf_func)(info->stream, " R%x, (R%x, -R%x)",
- (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
- (raw_code >> 2) & 0x7);
- }
- else
- {
- (*info->fprintf_func)(info->stream, " R%x, (R%x, R%x)",
- (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
- (raw_code >> 2) & 0x7);
- }
- }
- else
- {
- (*info->fprintf_func)(info->stream, " unhandled mode %s",
- decodePTR->opcodePTR->constraints);
- }
- break;
- case XG_R_R:
- if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_DYA_MON))
- {
- operandOne = ripBits (&operMaskReg, 3, decodePTR->opcodePTR,
- raw_code);
- operandTwo = ripBits (&operMaskReg, 3, decodePTR->opcodePTR,
- raw_code);
- (*info->fprintf_func)(info->stream, " R%x, R%x", operandOne,
- operandTwo);
- }
- else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_DYA))
- {
- operandOne = ripBits (&operMaskReg, 3, opcodePTR, raw_code);
- operandTwo = ripBits (&operMaskReg, 3, opcodePTR, raw_code);
- (*info->fprintf_func)(info->stream, " R%x, R%x", operandOne,
- operandTwo);
- }
- else
- {
- (*info->fprintf_func)(info->stream, " unhandled mode %s",
- opcodePTR->constraints);
- }
- break;
- case XG_R_R_I:
- (*info->fprintf_func)(info->stream, " R%x, (R%x, #0x%x)",
- (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7, raw_code & 0x1f);
- break;
- case XG_R:
- operandOne = ripBits (&operMaskReg, 3, decodePTR->opcodePTR,
- raw_code);
- (*info->fprintf_func)(info->stream, " R%x", operandOne);
- break;
- case XG_I | XG_PCREL:
- if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_REL9))
+ still are unable to pinpoint the operands
+ we analyze the opcodes constraint string. */
+ if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_MON_R_C))
+ {
+ (*info->fprintf_func)(info->stream, " R%x, CCR",
+ (raw_code >> 8) & 0x7);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_MON_C_R))
+ {
+ (*info->fprintf_func)(info->stream, " CCR, R%x",
+ (raw_code >> 8) & 0x7);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_MON_R_P))
+ {
+ (*info->fprintf_func)(info->stream, " R%x, PC",
+ (raw_code >> 8) & 0x7);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_TRI))
+ {
+ (*info->fprintf_func)(info->stream, " R%x, R%x, R%x",
+ (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
+ (raw_code >> 2) & 0x7);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IDR))
+ {
+ if (raw_code & 0x01)
+ {
+ (*info->fprintf_func)(info->stream, " R%x, (R%x, R%x+)",
+ (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
+ (raw_code >> 2) & 0x7);
+ }
+ else if (raw_code & 0x02)
+ {
+ (*info->fprintf_func)(info->stream, " R%x, (R%x, -R%x)",
+ (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
+ (raw_code >> 2) & 0x7);
+ }
+ else
+ {
+ (*info->fprintf_func)(info->stream, " R%x, (R%x, R%x)",
+ (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
+ (raw_code >> 2) & 0x7);
+ }
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_DYA))
+ {
+ operandOne = ripBits (&operMaskReg, 3, opcodePTR, raw_code);
+ operandTwo = ripBits (&operMaskReg, 3, opcodePTR, raw_code);
+ ( *info->fprintf_func)(info->stream, " R%x, R%x", operandOne,
+ operandTwo);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IDO5))
+ {
+ (*info->fprintf_func)(info->stream, " R%x, (R%x, #0x%x)",
+ (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7, raw_code & 0x1f);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_MON))
+ {
+ operandOne = ripBits (&operMaskReg, 3, decodePTR->opcodePTR,
+ raw_code);
+ (*info->fprintf_func)(info->stream, " R%x", operandOne);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_REL9))
{
/* If address is negative handle it accordingly. */
if (raw_code & XGATE_NINE_SIGNBIT)
relAddr = raw_code & 0xff;
relAddr = (relAddr << 1) + 2;
}
- (*info->fprintf_func)(info->stream, " *%d", relAddr);
- (*info->fprintf_func)(info->stream, " Abs* 0x");
- (*info->print_address_func)(memaddr + relAddr, info);
- }
+ (*info->fprintf_func)(info->stream, " *%d", relAddr);
+ (*info->fprintf_func)(info->stream, " Abs* 0x");
+ (*info->print_address_func)(memaddr + relAddr, info);
+ }
else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_REL10))
{
/* If address is negative handle it accordingly. */
(*info->fprintf_func)(info->stream, " Abs* 0x");
(*info->print_address_func)(memaddr + relAddr, info);
}
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM4))
+ {
+ (*info->fprintf_func)(info->stream, " R%x, #0x%02x",
+ (raw_code >> 8) & 0x7, (raw_code >> 4) & 0xF);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM8))
+ {
+ if (macro_search (decodePTR->opcodePTR->name, previousOpName) &&
+ previousOpName[0])
+ {
+ absAddress = (0xFF & raw_code) << 8;
+ absAddress |= perviousBin & 0xFF;
+ (*info->fprintf_func)(info->stream, " R%x, #0x%02x Abs* 0x",
+ (raw_code >> 8) & 0x7, raw_code & 0xff);
+ (*info->print_address_func)(absAddress, info);
+ previousOpName[0] = 0;
+ }
+ else
+ {
+ strcpy (previousOpName, decodePTR->opcodePTR->name);
+ (*info->fprintf_func)(info->stream, " R%x, #0x%02x",
+ (raw_code >> 8) & 0x7, raw_code & 0xff);
+ }
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM3))
+ {
+ (*info->fprintf_func)(info->stream, " #0x%x",
+ (raw_code >> 8) & 0x7);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_INH))
+ {
+ //
+ }
else
{
- (*info->fprintf_func)(info->stream,
- " Can't disassemble for mode) %s",
- decodePTR->opcodePTR->constraints);
+ (*info->fprintf_func)(info->stream, " unhandled mode %s",
+ opcodePTR->constraints);
}
- break;
- case XG_R_I:
- if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM4))
- {
- (*info->fprintf_func)(info->stream, " R%x, #0x%02x",
- (raw_code >> 8) & 0x7, (raw_code >> 4) & 0xF);
- }
- else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM8))
- {
- if (macro_search (decodePTR->opcodePTR->name, previousOpName) &&
- previousOpName[0])
- {
- absAddress = (0xFF & raw_code) << 8;
- absAddress |= perviousBin & 0xFF;
- (*info->fprintf_func)(info->stream, " R%x, #0x%02x Abs* 0x",
- (raw_code >> 8) & 0x7, raw_code & 0xff);
- (*info->print_address_func)(absAddress, info);
- previousOpName[0] = 0;
- }
- else
- {
- strcpy (previousOpName, decodePTR->opcodePTR->name);
- (*info->fprintf_func)(info->stream, " R%x, #0x%02x",
- (raw_code >> 8) & 0x7, raw_code & 0xff);
- }
- }
- else
- {
- (*info->fprintf_func)(info->stream,
- " Can't disassemble for mode %s",
- decodePTR->opcodePTR->constraints);
- }
- break;
- case XG_I:
- (*info->fprintf_func)(info->stream, " #0x%x",
- (raw_code >> 8) & 0x7);
- break;
- default:
- (*info->fprintf_func)(info->stream, "address mode not found\t %x",
- opcodePTR->bin_opcode);
- break;
- }
perviousBin = raw_code;
}
else