#include <sys/times.h>
#include <sys/time.h>
-enum op_types {
- OP_UNKNOWN,
-};
-
-#ifdef DEBUG
-static void trace_input PARAMS ((char *name, enum op_types type, int size));
-static void trace_output PARAMS ((enum op_types result));
-static int init_text_p = 0;
-static asection *text;
-static bfd_vma text_start;
-static bfd_vma text_end;
-extern bfd *exec_bfd;
-
-#ifndef SIZE_INSTRUCTION
-#define SIZE_INSTRUCTION 6
-#endif
-
-#ifndef SIZE_OPERANDS
-#define SIZE_OPERANDS 16
-#endif
-
-#ifndef SIZE_VALUES
-#define SIZE_VALUES 11
-#endif
-
-#ifndef SIZE_LOCATION
-#define SIZE_LOCATION 40
-#endif
-
-static void
-trace_input (name, type, size)
- char *name;
- enum op_types type;
- int size;
-{
-}
-
-static void
-trace_output (result)
- enum op_types result;
-{
-}
-
-#else
-#define trace_input(NAME, IN1, IN2)
-#define trace_output(RESULT)
-#endif
-
+#define REG0(X) ((X) & 0x3)
+#define REG1(X) (((X) & 0xc) >> 2)
+#define REG0_8(X) (((X) & 0x300) >> 8)
+#define REG1_8(X) (((X) & 0xc00) >> 10)
+#define REG0_16(X) (((X) & 0x30000) >> 8)
+#define REG1_16(X) (((X) & 0xc0000) >> 18)
\f
/* mov imm8, dn */
void OP_8000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x300) >> 8)] = SEXT8 (insn & 0xff);
+ State.regs[REG_D0 + REG0_8 (insn)] = SEXT8 (insn & 0xff);
}
/* mov dm, dn */
void OP_80 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + (insn & 0x3)] = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
+ State.regs[REG_D0 + REG0 (insn)] = State.regs[REG_D0 + REG1 (insn)];
}
/* mov dm, an */
void OP_F1E0 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + (insn & 0x3)] = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
+ State.regs[REG_A0 + REG0 (insn)] = State.regs[REG_D0 + REG1 (insn)];
}
/* mov am, dn */
void OP_F1D0 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + (insn & 0x3)] = State.regs[REG_A0 + ((insn & 0xc) >> 2)];
+ State.regs[REG_D0 + REG0 (insn)] = State.regs[REG_A0 + REG1 (insn)];
}
/* mov imm8, an */
void OP_9000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0x300) >> 8)] = insn & 0xff;
+ State.regs[REG_A0 + REG0_8 (insn)] = insn & 0xff;
}
/* mov am, an */
void OP_90 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + (insn & 0x3)] = State.regs[REG_A0 + ((insn & 0xc) >> 2)];
+ State.regs[REG_A0 + REG0 (insn)] = State.regs[REG_A0 + REG1 (insn)];
}
/* mov sp, an */
void OP_3C (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + (insn & 0x3)] = State.regs[REG_SP];
+ State.regs[REG_A0 + REG0 (insn)] = State.regs[REG_SP];
}
/* mov am, sp */
void OP_F2F0 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_SP] = State.regs[REG_A0 + ((insn & 0xc) >> 2)];
+ State.regs[REG_SP] = State.regs[REG_A0 + REG1 (insn)];
}
/* mov psw, dn */
void OP_F2E4 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + (insn & 0x3)] = PSW;
+ State.regs[REG_D0 + REG0 (insn)] = PSW;
}
/* mov dm, psw */
void OP_F2F3 (insn, extension)
unsigned long insn, extension;
{
- PSW = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
+ PSW = State.regs[REG_D0 + REG1 (insn)];
}
/* mov mdr, dn */
void OP_F2E0 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + (insn & 0x3)] = State.regs[REG_MDR];
+ State.regs[REG_D0 + REG0 (insn)] = State.regs[REG_MDR];
}
/* mov dm, mdr */
void OP_F2F2 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_MDR] = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
+ State.regs[REG_MDR] = State.regs[REG_D0 + REG1 (insn)];
}
/* mov (am), dn */
void OP_70 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc) >> 2)]
- = load_mem (State.regs[REG_A0 + (insn & 0x3)], 4);
+ State.regs[REG_D0 + REG1 (insn)]
+ = load_mem (State.regs[REG_A0 + REG0 (insn)], 4);
}
/* mov (d8,am), dn */
void OP_F80000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc00) >> 10)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x300) >> 8)]
+ State.regs[REG_D0 + REG1_8 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_8 (insn)]
+ SEXT8 (insn & 0xff)), 4);
}
void OP_FA000000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG1_16 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ SEXT16 (insn & 0xffff)), 4);
}
void OP_FC000000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG1_16 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ ((insn & 0xffff) << 16) + extension), 4);
}
void OP_5800 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x300) >> 8)]
+ State.regs[REG_D0 + REG0_8 (insn)]
= load_mem (State.regs[REG_SP] + (insn & 0xff), 4);
}
void OP_FAB40000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
= load_mem (State.regs[REG_SP] + (insn & 0xffff), 4);
}
void OP_FCB40000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
= load_mem (State.regs[REG_SP] + (((insn & 0xffff) << 16) + extension), 4);
}
void OP_F300 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x300) >> 8)]
- = load_mem ((State.regs[REG_A0 + (insn & 0x3)]
- + State.regs[REG_D0 + ((insn & 0xc) >> 2)]), 4);
+ State.regs[REG_D0 + REG0_8 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0 (insn)]
+ + State.regs[REG_D0 + REG1 (insn)]), 4);
}
/* mov (abs16), dn */
void OP_300000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)] = load_mem ((insn & 0xffff), 4);
+ State.regs[REG_D0 + REG0_16 (insn)] = load_mem ((insn & 0xffff), 4);
}
/* mov (abs32), dn */
void OP_FCA40000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
= load_mem ((((insn & 0xffff) << 16) + extension), 4);
}
void OP_F000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0xc) >> 2)]
- = load_mem (State.regs[REG_A0 + (insn & 0x3)], 4);
+ State.regs[REG_A0 + REG1 (insn)]
+ = load_mem (State.regs[REG_A0 + REG0 (insn)], 4);
}
/* mov (d8,am), an */
void OP_F82000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0xc00) >> 10)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x300) >> 8)]
+ State.regs[REG_A0 + REG1_8 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_8 (insn)]
+ SEXT8 (insn & 0xff)), 4);
}
void OP_FA200000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0xc0000) >> 18)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_A0 + REG1_16 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ SEXT16 (insn & 0xffff)), 4);
}
void OP_FC200000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0xc0000) >> 18)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_A0 + REG1_16 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ ((insn & 0xffff) << 16) + extension), 4);
}
void OP_5C00 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0x300) >> 8)]
+ State.regs[REG_A0 + REG0_8 (insn)]
= load_mem (State.regs[REG_SP] + (insn & 0xff), 4);
}
void OP_FAB00000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_A0 + REG0_16 (insn)]
= load_mem (State.regs[REG_SP] + (insn & 0xffff), 4);
}
void OP_FCB00000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_A0 + REG0_16 (insn)]
= load_mem (State.regs[REG_SP] + (((insn & 0xffff) << 16) + extension), 4);
}
void OP_F380 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0x300) >> 8)]
- = load_mem ((State.regs[REG_A0 + (insn & 0x3)]
- + State.regs[REG_D0 + ((insn & 0xc) >> 2)]), 4);
+ State.regs[REG_A0 + REG0_8 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0 (insn)]
+ + State.regs[REG_D0 + REG1 (insn)]), 4);
}
/* mov (abs16), an */
void OP_FAA00000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0x30000) >> 16)] = load_mem ((insn & 0xffff), 4);
+ State.regs[REG_A0 + REG0_16 (insn)] = load_mem ((insn & 0xffff), 4);
}
/* mov (abs32), an */
void OP_FCA00000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_A0 + REG0_16 (insn)]
= load_mem ((((insn & 0xffff) << 16) + extension), 4);
}
unsigned long insn, extension;
{
State.regs[REG_SP]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x300) >> 8)]
+ = load_mem ((State.regs[REG_A0 + REG0_8 (insn)]
+ SEXT8 (insn & 0xff)), 4);
}
void OP_60 (insn, extension)
unsigned long insn, extension;
{
- store_mem (State.regs[REG_A0 + (insn & 0x3)], 4,
- State.regs[REG_D0 + ((insn & 0xc) >> 2)]);
+ store_mem (State.regs[REG_A0 + REG0 (insn)], 4,
+ State.regs[REG_D0 + REG1 (insn)]);
}
/* mov dm, (d8,an) */
void OP_F81000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x300) >> 8)]
+ store_mem ((State.regs[REG_A0 + REG0_8 (insn)]
+ SEXT8 (insn & 0xff)), 4,
- State.regs[REG_D0 + ((insn & 0xc00) >> 10)]);
+ State.regs[REG_D0 + REG1_8 (insn)]);
}
/* mov dm (d16,an) */
void OP_FA100000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ store_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ SEXT16 (insn & 0xffff)), 4,
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_D0 + REG1_16 (insn)]);
}
/* mov dm (d32,an) */
void OP_FC100000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ store_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ ((insn & 0xffff) << 16) + extension), 4,
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_D0 + REG1_16 (insn)]);
}
/* mov dm, (d8,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (insn & 0xff), 4,
- State.regs[REG_D0 + ((insn & 0xc00) >> 10)]);
+ State.regs[REG_D0 + REG1_8 (insn)]);
}
/* mov dm, (d16,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (insn & 0xffff), 4,
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_D0 + REG1_16 (insn)]);
}
/* mov dm, (d32,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (((insn & 0xffff) << 16) + extension), 4,
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_D0 + REG1_16 (insn)]);
}
/* mov dm, (di,an) */
void OP_F340 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + (insn & 0x3)]
- + State.regs[REG_D0 + ((insn & 0xc) >> 2)]), 4,
- State.regs[REG_D0 + ((insn & 0x300) >> 8)]);
+ store_mem ((State.regs[REG_A0 + REG0 (insn)]
+ + State.regs[REG_D0 + REG1 (insn)]), 4,
+ State.regs[REG_D0 + REG0_8 (insn)]);
}
/* mov dm, (abs16) */
void OP_10000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((insn & 0xffff), 4, State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ store_mem ((insn & 0xffff), 4, State.regs[REG_D0 + REG1_16 (insn)]);
}
/* mov dm, (abs32) */
void OP_FC810000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((((insn & 0xffff) << 16) + extension), 4, State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ store_mem ((((insn & 0xffff) << 16) + extension), 4, State.regs[REG_D0 + REG1_16 (insn)]);
}
/* mov am, (an) */
void OP_F010 (insn, extension)
unsigned long insn, extension;
{
- store_mem (State.regs[REG_A0 + (insn & 0x3)], 4,
- State.regs[REG_A0 + ((insn & 0xc) >> 2)]);
+ store_mem (State.regs[REG_A0 + REG0 (insn)], 4,
+ State.regs[REG_A0 + REG1 (insn)]);
}
/* mov am, (d8,an) */
void OP_F83000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x300) >> 8)]
+ store_mem ((State.regs[REG_A0 + REG0_8 (insn)]
+ SEXT8 (insn & 0xff)), 4,
- State.regs[REG_A0 + ((insn & 0xc00) >> 10)]);
+ State.regs[REG_A0 + REG1_8 (insn)]);
}
/* mov am, (d16,an) */
void OP_FA300000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ store_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ SEXT16 (insn & 0xffff)), 4,
- State.regs[REG_A0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_A0 + REG1_16 (insn)]);
}
/* mov am, (d32,an) */
void OP_FC300000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ store_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ ((insn & 0xffff) << 16) + extension), 4,
- State.regs[REG_A0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_A0 + REG1_16 (insn)]);
}
/* mov am, (d8,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (insn & 0xff), 4,
- State.regs[REG_A0 + ((insn & 0xc00) >> 10)]);
+ State.regs[REG_A0 + REG1_8 (insn)]);
}
/* mov am, (d16,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (insn & 0xffff), 4,
- State.regs[REG_A0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_A0 + REG1_16 (insn)]);
}
/* mov am, (d32,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (((insn & 0xffff) << 16) + extension), 4,
- State.regs[REG_A0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_A0 + REG1_16 (insn)]);
}
/* mov am, (di,an) */
void OP_F3C0 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + (insn & 0x3)]
- + State.regs[REG_D0 + ((insn & 0xc) >> 2)]), 4,
- State.regs[REG_A0 + ((insn & 0x300) >> 8)]);
+ store_mem ((State.regs[REG_A0 + REG0 (insn)]
+ + State.regs[REG_D0 + REG1 (insn)]), 4,
+ State.regs[REG_A0 + REG0_8 (insn)]);
}
/* mov am, (abs16) */
void OP_FA800000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((insn & 0xffff), 4, State.regs[REG_A0 + ((insn & 0xc0000) >> 18)]);
+ store_mem ((insn & 0xffff), 4, State.regs[REG_A0 + REG1_16 (insn)]);
}
/* mov am, (abs32) */
void OP_FC800000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((((insn & 0xffff) << 16) + extension), 4, State.regs[REG_A0 + ((insn & 0xc0000) >> 18)]);
+ store_mem ((((insn & 0xffff) << 16) + extension), 4, State.regs[REG_A0 + REG1_16 (insn)]);
}
/* mov sp, (d8,an) */
void OP_F8F400 (insn, extension)
unsigned long insn, extension;
{
- store_mem (State.regs[REG_A0 + ((insn & 0x300) >> 8)] + SEXT8 (insn & 0xff),
+ store_mem (State.regs[REG_A0 + REG0_8 (insn)] + SEXT8 (insn & 0xff),
4, State.regs[REG_SP]);
}
unsigned long value;
value = SEXT16 (insn & 0xffff);
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)] = value;
+ State.regs[REG_D0 + REG0_16 (insn)] = value;
}
/* mov imm32,dn */
unsigned long value;
value = ((insn & 0xffff) << 16) + extension;
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)] = value;
+ State.regs[REG_D0 + REG0_16 (insn)] = value;
}
/* mov imm16, an */
unsigned long value;
value = insn & 0xffff;
- State.regs[REG_A0 + ((insn & 0x30000) >> 16)] = value;
+ State.regs[REG_A0 + REG0_16 (insn)] = value;
}
/* mov imm32, an */
unsigned long value;
value = ((insn & 0xffff) << 16) + extension;
- State.regs[REG_A0 + ((insn & 0x30000) >> 16)] = value;
+ State.regs[REG_A0 + REG0_16 (insn)] = value;
}
/* movbu (am), dn */
void OP_F040 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc) >> 2)]
- = load_mem (State.regs[REG_A0 + (insn & 0x3)], 1);
+ State.regs[REG_D0 + REG1 (insn)]
+ = load_mem (State.regs[REG_A0 + REG0 (insn)], 1);
}
/* movbu (d8,am), dn */
void OP_F84000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc00) >> 10)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x300) >> 8)]
+ State.regs[REG_D0 + REG1_8 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_8 (insn)]
+ SEXT8 (insn & 0xff)), 1);
}
void OP_FA400000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG1_16 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ SEXT16 (insn & 0xffff)), 1);
}
void OP_FC400000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG1_16 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ ((insn & 0xffff) << 16) + extension), 1);
}
void OP_F8B800 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x300) >> 8)]
+ State.regs[REG_D0 + REG0_8 (insn)]
= load_mem ((State.regs[REG_SP] + (insn & 0xff)), 1);
}
void OP_FAB80000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
= load_mem ((State.regs[REG_SP] + (insn & 0xffff)), 1);
}
void OP_FCB80000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
= load_mem (State.regs[REG_SP] + (((insn & 0xffff) << 16) + extension), 1);
}
void OP_F400 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x300) >> 8)]
- = load_mem ((State.regs[REG_A0 + (insn & 0x3)]
- + State.regs[REG_D0 + ((insn & 0xc) >> 2)]), 1);
+ State.regs[REG_D0 + REG0_8 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0 (insn)]
+ + State.regs[REG_D0 + REG1 (insn)]), 1);
}
/* movbu (abs16), dn */
void OP_340000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)] = load_mem ((insn & 0xffff), 1);
+ State.regs[REG_D0 + REG0_16 (insn)] = load_mem ((insn & 0xffff), 1);
}
/* movbu (abs32), dn */
void OP_FCA80000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
= load_mem ((((insn & 0xffff) << 16) + extension), 1);
}
void OP_F050 (insn, extension)
unsigned long insn, extension;
{
- store_mem (State.regs[REG_A0 + (insn & 0x3)], 1,
- State.regs[REG_D0 + ((insn & 0xc) >> 2)]);
+ store_mem (State.regs[REG_A0 + REG0 (insn)], 1,
+ State.regs[REG_D0 + REG1 (insn)]);
}
/* movbu dm, (d8,an) */
void OP_F85000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x300) >> 8)]
+ store_mem ((State.regs[REG_A0 + REG0_8 (insn)]
+ SEXT8 (insn & 0xff)), 1,
- State.regs[REG_D0 + ((insn & 0xc00) >> 10)]);
+ State.regs[REG_D0 + REG1_8 (insn)]);
}
/* movbu dm, (d16,an) */
void OP_FA500000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ store_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ SEXT16 (insn & 0xffff)), 1,
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_D0 + REG1_16 (insn)]);
}
/* movbu dm, (d32,an) */
void OP_FC500000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ store_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ ((insn & 0xffff) << 16) + extension), 1,
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_D0 + REG1_16 (insn)]);
}
/* movbu dm, (d8,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (insn & 0xff), 1,
- State.regs[REG_D0 + ((insn & 0xc00) >> 10)]);
+ State.regs[REG_D0 + REG1_8 (insn)]);
}
/* movbu dm, (d16,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (insn & 0xffff), 2,
- State.regs[REG_D0 + ((insn & 0xc00) >> 10)]);
+ State.regs[REG_D0 + REG1_8 (insn)]);
}
/* movbu dm (d32,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (((insn & 0xffff) << 16) + extension), 2,
- State.regs[REG_D0 + ((insn & 0xc00) >> 10)]);
+ State.regs[REG_D0 + REG1_8 (insn)]);
}
/* movbu dm, (di,an) */
void OP_F440 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + (insn & 0x3)]
- + State.regs[REG_D0 + ((insn & 0xc) >> 2)]), 1,
- State.regs[REG_D0 + ((insn & 0x300) >> 8)]);
+ store_mem ((State.regs[REG_A0 + REG0 (insn)]
+ + State.regs[REG_D0 + REG1 (insn)]), 1,
+ State.regs[REG_D0 + REG0_8 (insn)]);
}
/* movbu dm, (abs16) */
void OP_20000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((insn & 0xffff), 1, State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ store_mem ((insn & 0xffff), 1, State.regs[REG_D0 + REG1_16 (insn)]);
}
/* movbu dm, (abs32) */
void OP_FC820000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((((insn & 0xffff) << 16) + extension), 1, State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ store_mem ((((insn & 0xffff) << 16) + extension), 1, State.regs[REG_D0 + REG1_16 (insn)]);
}
/* movhu (am), dn */
void OP_F060 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc) >> 2)]
- = load_mem (State.regs[REG_A0 + (insn & 0x3)], 2);
+ State.regs[REG_D0 + REG1 (insn)]
+ = load_mem (State.regs[REG_A0 + REG0 (insn)], 2);
}
/* movhu (d8,am), dn */
void OP_F86000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc00) >> 10)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x300) >> 8)]
+ State.regs[REG_D0 + REG1_8 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_8 (insn)]
+ SEXT8 (insn & 0xff)), 2);
}
void OP_FA600000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG1_16 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ SEXT16 (insn & 0xffff)), 2);
}
void OP_FC600000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]
- = load_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG1_16 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ ((insn & 0xffff) << 16) + extension), 2);
}
void OP_F8BC00 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x300) >> 8)]
+ State.regs[REG_D0 + REG0_8 (insn)]
= load_mem ((State.regs[REG_SP] + (insn & 0xff)), 2);
}
void OP_FABC0000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
= load_mem ((State.regs[REG_SP] + (insn & 0xffff)), 2);
}
void OP_FCBC0000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
= load_mem (State.regs[REG_SP] + (((insn & 0xffff) << 16) + extension), 2);
}
void OP_F480 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x300) >> 8)]
- = load_mem ((State.regs[REG_A0 + (insn & 0x3)]
- + State.regs[REG_D0 + ((insn & 0xc) >> 2)]), 2);
+ State.regs[REG_D0 + REG0_8 (insn)]
+ = load_mem ((State.regs[REG_A0 + REG0 (insn)]
+ + State.regs[REG_D0 + REG1 (insn)]), 2);
}
/* movhu (abs16), dn */
void OP_380000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)] = load_mem ((insn & 0xffff), 2);
+ State.regs[REG_D0 + REG0_16 (insn)] = load_mem ((insn & 0xffff), 2);
}
/* movhu (abs32), dn */
void OP_FCAC0000 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
= load_mem ((((insn & 0xffff) << 16) + extension), 2);
}
void OP_F070 (insn, extension)
unsigned long insn, extension;
{
- store_mem (State.regs[REG_A0 + (insn & 0x3)], 2,
- State.regs[REG_D0 + ((insn & 0xc) >> 2)]);
+ store_mem (State.regs[REG_A0 + REG0 (insn)], 2,
+ State.regs[REG_D0 + REG1 (insn)]);
}
/* movhu dm, (d8,an) */
void OP_F87000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x300) >> 8)]
+ store_mem ((State.regs[REG_A0 + REG0_8 (insn)]
+ SEXT8 (insn & 0xff)), 2,
- State.regs[REG_D0 + ((insn & 0xc00) >> 10)]);
+ State.regs[REG_D0 + REG1_8 (insn)]);
}
/* movhu dm, (d16,an) */
void OP_FA700000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ store_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ SEXT16 (insn & 0xffff)), 2,
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_D0 + REG1_16 (insn)]);
}
/* movhu dm, (d32,an) */
void OP_FC700000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ store_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ ((insn & 0xffff) << 16) + extension), 2,
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_D0 + REG1_16 (insn)]);
}
/* movhu dm,(d8,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (insn & 0xff), 2,
- State.regs[REG_D0 + ((insn & 0xc00) >> 10)]);
+ State.regs[REG_D0 + REG1_8 (insn)]);
}
/* movhu dm,(d16,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (insn & 0xffff), 2,
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_D0 + REG1_16 (insn)]);
}
/* movhu dm,(d32,sp) */
unsigned long insn, extension;
{
store_mem (State.regs[REG_SP] + (((insn & 0xffff) << 16) + extension), 2,
- State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ State.regs[REG_D0 + REG1_16 (insn)]);
}
/* movhu dm, (di,an) */
void OP_F4C0 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((State.regs[REG_A0 + (insn & 0x3)]
- + State.regs[REG_D0 + ((insn & 0xc) >> 2)]), 2,
- State.regs[REG_D0 + ((insn & 0x300) >> 8)]);
+ store_mem ((State.regs[REG_A0 + REG0 (insn)]
+ + State.regs[REG_D0 + REG1 (insn)]), 2,
+ State.regs[REG_D0 + REG0_8 (insn)]);
}
/* movhu dm, (abs16) */
void OP_30000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((insn & 0xffff), 2, State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ store_mem ((insn & 0xffff), 2, State.regs[REG_D0 + REG1_16 (insn)]);
}
/* movhu dm, (abs32) */
void OP_FC830000 (insn, extension)
unsigned long insn, extension;
{
- store_mem ((((insn & 0xffff) << 16) + extension), 2, State.regs[REG_D0 + ((insn & 0xc0000) >> 18)]);
+ store_mem ((((insn & 0xffff) << 16) + extension), 2, State.regs[REG_D0 + REG1_16 (insn)]);
}
/* ext dn */
void OP_F2D0 (insn, extension)
unsigned long insn, extension;
{
- if (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000)
+ if (State.regs[REG_D0 + REG0 (insn)] & 0x80000000)
State.regs[REG_MDR] = -1;
else
State.regs[REG_MDR] = 0;
void OP_10 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + (insn & 0x3)] = SEXT8 (State.regs[REG_D0 + (insn & 0x3)]);
+ State.regs[REG_D0 + REG0 (insn)] = SEXT8 (State.regs[REG_D0 + REG0 (insn)]);
}
/* extbu dn */
void OP_14 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + (insn & 0x3)] &= 0xff;
+ State.regs[REG_D0 + REG0 (insn)] &= 0xff;
}
/* exth dn */
void OP_18 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + (insn & 0x3)]
- = SEXT16 (State.regs[REG_D0 + (insn & 0x3)]);
+ State.regs[REG_D0 + REG0 (insn)]
+ = SEXT16 (State.regs[REG_D0 + REG0 (insn)]);
}
/* exthu dn */
void OP_1C (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + (insn & 0x3)] &= 0xffff;
+ State.regs[REG_D0 + REG0 (insn)] &= 0xffff;
}
/* movm (sp), reg_list */
void OP_0 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_D0 + ((insn & 0xc) >> 2)] = 0;
+ State.regs[REG_D0 + REG1 (insn)] = 0;
PSW |= PSW_Z;
PSW &= ~(PSW_V | PSW_C | PSW_N);
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_D0 + (insn & 0x3)];
+ reg1 = State.regs[REG_D0 + REG1 (insn)];
+ reg2 = State.regs[REG_D0 + REG0 (insn)];
value = reg1 + reg2;
- State.regs[REG_D0 + (insn & 0x3)] = value;
+ State.regs[REG_D0 + REG0 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_A0 + (insn & 0x3)];
+ reg1 = State.regs[REG_D0 + REG1 (insn)];
+ reg2 = State.regs[REG_A0 + REG0 (insn)];
value = reg1 + reg2;
- State.regs[REG_A0 + (insn & 0x3)] = value;
+ State.regs[REG_A0 + REG0 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_A0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_D0 + (insn & 0x3)];
+ reg1 = State.regs[REG_A0 + REG1 (insn)];
+ reg2 = State.regs[REG_D0 + REG0 (insn)];
value = reg1 + reg2;
- State.regs[REG_D0 + (insn & 0x3)] = value;
+ State.regs[REG_D0 + REG0 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_A0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_A0 + (insn & 0x3)];
+ reg1 = State.regs[REG_A0 + REG1 (insn)];
+ reg2 = State.regs[REG_A0 + REG0 (insn)];
value = reg1 + reg2;
- State.regs[REG_A0 + (insn & 0x3)] = value;
+ State.regs[REG_A0 + REG0 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_D0 + ((insn & 0x300) >> 8)];
+ reg1 = State.regs[REG_D0 + REG0_8 (insn)];
imm = SEXT8 (insn & 0xff);
value = reg1 + imm;
- State.regs[REG_D0 + ((insn & 0x300) >> 8)] = value;
+ State.regs[REG_D0 + REG0_8 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_D0 + ((insn & 0x30000) >> 16)];
+ reg1 = State.regs[REG_D0 + REG0_16 (insn)];
imm = SEXT16 (insn & 0xffff);
value = reg1 + imm;
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)] = value;
+ State.regs[REG_D0 + REG0_16 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_D0 + ((insn & 0x30000) >> 16)];
+ reg1 = State.regs[REG_D0 + REG0_16 (insn)];
imm = ((insn & 0xffff) << 16) + extension;
value = reg1 + imm;
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)] = value;
+ State.regs[REG_D0 + REG0_16 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_A0 + ((insn & 0x300) >> 8)];
+ reg1 = State.regs[REG_A0 + REG0_8 (insn)];
imm = SEXT8 (insn & 0xff);
value = reg1 + imm;
- State.regs[REG_A0 + ((insn & 0x300) >> 8)] = value;
+ State.regs[REG_A0 + REG0_8 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_A0 + ((insn & 0x30000) >> 16)];
+ reg1 = State.regs[REG_A0 + REG0_16 (insn)];
imm = SEXT16 (insn & 0xffff);
value = reg1 + imm;
- State.regs[REG_A0 + ((insn & 0x30000) >> 16)] = value;
+ State.regs[REG_A0 + REG0_16 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_A0 + ((insn & 0x30000) >> 16)];
+ reg1 = State.regs[REG_A0 + REG0_16 (insn)];
imm = ((insn & 0xffff) << 16) + extension;
value = reg1 + imm;
- State.regs[REG_A0 + ((insn & 0x30000) >> 16)] = value;
+ State.regs[REG_A0 + REG0_16 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_D0 + (insn & 0x3)];
+ reg1 = State.regs[REG_D0 + REG1 (insn)];
+ reg2 = State.regs[REG_D0 + REG0 (insn)];
value = reg1 + reg2 + ((PSW & PSW_C) != 0);
- State.regs[REG_D0 + (insn & 0x3)] = value;
+ State.regs[REG_D0 + REG0 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_D0 + (insn & 0x3)];
+ reg1 = State.regs[REG_D0 + REG1 (insn)];
+ reg2 = State.regs[REG_D0 + REG0 (insn)];
value = reg2 - reg1;
z = (value == 0);
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
| (c ? PSW_C : 0) | (v ? PSW_V : 0));
- State.regs[REG_D0 + (insn & 0x3)] = value;
+ State.regs[REG_D0 + REG0 (insn)] = value;
}
/* sub dm, an */
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_A0 + (insn & 0x3)];
+ reg1 = State.regs[REG_D0 + REG1 (insn)];
+ reg2 = State.regs[REG_A0 + REG0 (insn)];
value = reg2 - reg1;
z = (value == 0);
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
| (c ? PSW_C : 0) | (v ? PSW_V : 0));
- State.regs[REG_A0 + (insn & 0x3)] = value;
+ State.regs[REG_A0 + REG0 (insn)] = value;
}
/* sub am, dn */
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_A0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_D0 + (insn & 0x3)];
+ reg1 = State.regs[REG_A0 + REG1 (insn)];
+ reg2 = State.regs[REG_D0 + REG0 (insn)];
value = reg2 - reg1;
z = (value == 0);
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
| (c ? PSW_C : 0) | (v ? PSW_V : 0));
- State.regs[REG_D0 + (insn & 0x3)] = value;
+ State.regs[REG_D0 + REG0 (insn)] = value;
}
/* sub am, an */
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_A0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_A0 + (insn & 0x3)];
+ reg1 = State.regs[REG_A0 + REG1 (insn)];
+ reg2 = State.regs[REG_A0 + REG0 (insn)];
value = reg2 - reg1;
z = (value == 0);
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
| (c ? PSW_C : 0) | (v ? PSW_V : 0));
- State.regs[REG_A0 + (insn & 0x3)] = value;
+ State.regs[REG_A0 + REG0 (insn)] = value;
}
/* sub imm32, dn */
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_D0 + ((insn & 0x30000) >> 16)];
+ reg1 = State.regs[REG_D0 + REG0_16 (insn)];
imm = ((insn & 0xffff) << 16) + extension;
value = reg1 - imm;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
| (c ? PSW_C : 0) | (v ? PSW_V : 0));
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)] = value;
+ State.regs[REG_D0 + REG0_16 (insn)] = value;
}
/* sub imm32, an */
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_A0 + ((insn & 0x30000) >> 16)];
+ reg1 = State.regs[REG_A0 + REG0_16 (insn)];
imm = ((insn & 0xffff) << 16) + extension;
value = reg1 - imm;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
| (c ? PSW_C : 0) | (v ? PSW_V : 0));
- State.regs[REG_A0 + ((insn & 0x30000) >> 16)] = value;
+ State.regs[REG_A0 + REG0_16 (insn)] = value;
}
/* subc dm, dn */
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_D0 + (insn & 0x3)];
+ reg1 = State.regs[REG_D0 + REG1 (insn)];
+ reg2 = State.regs[REG_D0 + REG0 (insn)];
value = reg2 - reg1 - ((PSW & PSW_C) != 0);
z = (value == 0);
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
| (c ? PSW_C : 0) | (v ? PSW_V : 0));
- State.regs[REG_D0 + (insn & 0x3)] = value;
+ State.regs[REG_D0 + REG0 (insn)] = value;
}
/* mul dm, dn */
unsigned long long temp;
int n, z;
- temp = (State.regs[REG_D0 + (insn & 0x3)]
- * State.regs[REG_D0 + ((insn & 0xc) >> 2)]);
- State.regs[REG_D0 + (insn & 0x3)] = temp & 0xffffffff;
+ temp = (State.regs[REG_D0 + REG0 (insn)]
+ * State.regs[REG_D0 + REG1 (insn)]);
+ State.regs[REG_D0 + REG0 (insn)] = temp & 0xffffffff;
State.regs[REG_MDR] = temp & 0xffffffff00000000LL;
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
unsigned long long temp;
int n, z;
- temp = (State.regs[REG_D0 + (insn & 0x3)]
- * State.regs[REG_D0 + ((insn & 0xc) >> 2)]);
- State.regs[REG_D0 + (insn & 0x3)] = temp & 0xffffffff;
+ temp = (State.regs[REG_D0 + REG0 (insn)]
+ * State.regs[REG_D0 + REG1 (insn)]);
+ State.regs[REG_D0 + REG0 (insn)] = temp & 0xffffffff;
State.regs[REG_MDR] = temp & 0xffffffff00000000LL;
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
temp = State.regs[REG_MDR];
temp <<= 32;
- temp |= State.regs[REG_D0 + (insn & 0x3)];
- State.regs[REG_MDR] = temp % (long)State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- temp /= (long)State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- State.regs[REG_D0 + (insn & 0x3)] = temp & 0xffffffff;
+ temp |= State.regs[REG_D0 + REG0 (insn)];
+ State.regs[REG_MDR] = temp % (long)State.regs[REG_D0 + REG1 (insn)];
+ temp /= (long)State.regs[REG_D0 + REG1 (insn)];
+ State.regs[REG_D0 + REG0 (insn)] = temp & 0xffffffff;
State.regs[REG_MDR] = temp & 0xffffffff00000000LL;
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
temp = State.regs[REG_MDR];
temp <<= 32;
- temp |= State.regs[REG_D0 + (insn & 0x3)];
- State.regs[REG_MDR] = temp % State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- temp /= State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- State.regs[REG_D0 + (insn & 0x3)] = temp & 0xffffffff;
+ temp |= State.regs[REG_D0 + REG0 (insn)];
+ State.regs[REG_MDR] = temp % State.regs[REG_D0 + REG1 (insn)];
+ temp /= State.regs[REG_D0 + REG1 (insn)];
+ State.regs[REG_D0 + REG0 (insn)] = temp & 0xffffffff;
State.regs[REG_MDR] = temp & 0xffffffff00000000LL;
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
int z,n,c,v;
unsigned int value, imm, reg1;
- reg1 = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
+ reg1 = State.regs[REG_D0 + REG1 (insn)];
imm = 1;
value = reg1 + imm;
- State.regs[REG_D0 + ((insn & 0xc) >> 2)] = value;
+ State.regs[REG_D0 + REG1 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000);
void OP_41 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + ((insn & 0xc) >> 2)] += 1;
+ State.regs[REG_A0 + REG1 (insn)] += 1;
}
/* inc4 an */
void OP_50 (insn, extension)
unsigned long insn, extension;
{
- State.regs[REG_A0 + (insn & 0x3)] += 4;
+ State.regs[REG_A0 + REG0 (insn)] += 4;
}
/* cmp imm8, dn */
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_D0 + ((insn & 0x300) >> 8)];
+ reg1 = State.regs[REG_D0 + REG0_8 (insn)];
imm = SEXT8 (insn & 0xff);
value = reg1 - imm;
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_D0 + (insn & 0x3)];
+ reg1 = State.regs[REG_D0 + REG1 (insn)];
+ reg2 = State.regs[REG_D0 + REG0 (insn)];
value = reg2 - reg1;
z = (value == 0);
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_A0 + (insn & 0x3)];
+ reg1 = State.regs[REG_D0 + REG1 (insn)];
+ reg2 = State.regs[REG_A0 + REG0 (insn)];
value = reg2 - reg1;
z = (value == 0);
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_A0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_D0 + (insn & 0x3)];
+ reg1 = State.regs[REG_A0 + REG1 (insn)];
+ reg2 = State.regs[REG_D0 + REG0 (insn)];
value = reg2 - reg1;
z = (value == 0);
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_A0 + ((insn & 0x300) >> 8)];
+ reg1 = State.regs[REG_A0 + REG0_8 (insn)];
imm = insn & 0xff;
value = reg1 - imm;
int z, c, n, v;
unsigned long reg1, reg2, value;
- reg1 = State.regs[REG_A0 + ((insn & 0xc) >> 2)];
- reg2 = State.regs[REG_A0 + (insn & 0x3)];
+ reg1 = State.regs[REG_A0 + REG1 (insn)];
+ reg2 = State.regs[REG_A0 + REG0 (insn)];
value = reg2 - reg1;
z = (value == 0);
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_D0 + ((insn & 0x30000) >> 16)];
+ reg1 = State.regs[REG_D0 + REG0_16 (insn)];
imm = SEXT16 (insn & 0xffff);
value = reg1 - imm;
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_D0 + ((insn & 0x30000) >> 16)];
+ reg1 = State.regs[REG_D0 + REG0_16 (insn)];
imm = ((insn & 0xffff) << 16) + extension;
value = reg1 - imm;
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_A0 + ((insn & 0x30000) >> 16)];
+ reg1 = State.regs[REG_A0 + REG0_16 (insn)];
imm = insn & 0xffff;
value = reg1 - imm;
int z, c, n, v;
unsigned long reg1, imm, value;
- reg1 = State.regs[REG_A0 + ((insn & 0x30000) >> 16)];
+ reg1 = State.regs[REG_A0 + REG0_16 (insn)];
imm = ((insn & 0xffff) << 16) + extension;
value = reg1 - imm;
{
int n, z;
- State.regs[REG_D0 + (insn & 0x3)] &= State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0 (insn)] &= State.regs[REG_D0 + REG1 (insn)];
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + ((insn & 0x300) >> 8)] &= (insn & 0xff);
- z = (State.regs[REG_D0 + ((insn & 0x300) >> 8)] == 0);
- n = (State.regs[REG_D0 + ((insn & 0x300) >> 8)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0_8 (insn)] &= (insn & 0xff);
+ z = (State.regs[REG_D0 + REG0_8 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0_8 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)] &= (insn & 0xffff);
- z = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] == 0);
- n = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0_16 (insn)] &= (insn & 0xffff);
+ z = (State.regs[REG_D0 + REG0_16 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0_16 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
&= ((insn & 0xffff) << 16) + extension;
- z = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] == 0);
- n = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] & 0x80000000) != 0;
+ z = (State.regs[REG_D0 + REG0_16 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0_16 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + (insn & 0x3)] |= State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0 (insn)] |= State.regs[REG_D0 + REG1 (insn)];
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + ((insn & 0x300) >> 8)] |= insn & 0xff;
- z = (State.regs[REG_D0 + ((insn & 0x300) >> 8)] == 0);
- n = (State.regs[REG_D0 + ((insn & 0x300) >> 8)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0_8 (insn)] |= insn & 0xff;
+ z = (State.regs[REG_D0 + REG0_8 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0_8 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)] |= insn & 0xffff;
- z = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] == 0);
- n = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0_16 (insn)] |= insn & 0xffff;
+ z = (State.regs[REG_D0 + REG0_16 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0_16 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
|= ((insn & 0xffff) << 16) + extension;
- z = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] == 0);
- n = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] & 0x80000000) != 0;
+ z = (State.regs[REG_D0 + REG0_16 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0_16 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + (insn & 0x3)] ^= State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0 (insn)] ^= State.regs[REG_D0 + REG1 (insn)];
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)] ^= insn & 0xffff;
- z = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] == 0);
- n = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0_16 (insn)] ^= insn & 0xffff;
+ z = (State.regs[REG_D0 + REG0_16 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0_16 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + ((insn & 0x30000) >> 16)]
+ State.regs[REG_D0 + REG0_16 (insn)]
^= ((insn & 0xffff) << 16) + extension;
- z = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] == 0);
- n = (State.regs[REG_D0 + ((insn & 0x30000) >> 16)] & 0x80000000) != 0;
+ z = (State.regs[REG_D0 + REG0_16 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0_16 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + (insn & 0x3)] = ~State.regs[REG_D0 + (insn & 0x3)];
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0 (insn)] = ~State.regs[REG_D0 + REG0 (insn)];
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
unsigned long temp;
int z, n;
- temp = State.regs[REG_D0 + ((insn & 0x300) >> 8)];
+ temp = State.regs[REG_D0 + REG0_8 (insn)];
temp &= (insn & 0xff);
n = (temp & 0x80000000) != 0;
z = (temp == 0);
unsigned long temp;
int z, n;
- temp = State.regs[REG_D0 + ((insn & 0x30000) >> 16)];
+ temp = State.regs[REG_D0 + REG0_16 (insn)];
temp &= (insn & 0xffff);
n = (temp & 0x80000000) != 0;
z = (temp == 0);
unsigned long temp;
int z, n;
- temp = State.regs[REG_D0 + ((insn & 0x30000) >> 16)];
+ temp = State.regs[REG_D0 + REG0_16 (insn)];
temp &= ((insn & 0xffff) << 16) + extension;
n = (temp & 0x80000000) != 0;
z = (temp == 0);
unsigned long temp;
int n, z;
- temp = load_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ temp = load_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ SEXT8 ((insn & 0xff00) >> 8)), 1);
temp &= (insn & 0xff);
n = (temp & 0x80000000) != 0;
int z;
temp = load_mem (State.regs[REG_A0 + (insn & 3)], 1);
- z = (temp & State.regs[REG_D0 + ((insn & 0xc) >> 2)]) == 0;
- temp |= State.regs[REG_D0 + ((insn & 0xc) >> 2)];
+ z = (temp & State.regs[REG_D0 + REG1 (insn)]) == 0;
+ temp |= State.regs[REG_D0 + REG1 (insn)];
store_mem (State.regs[REG_A0 + (insn & 3)], 1, temp);
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= (z ? PSW_Z : 0);
unsigned long temp;
int z;
- temp = load_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ temp = load_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ SEXT8 ((insn & 0xff00) >> 8)), 1);
z = (temp & (insn & 0xff)) == 0;
temp |= (insn & 0xff);
int z;
temp = load_mem (State.regs[REG_A0 + (insn & 3)], 1);
- z = (temp & State.regs[REG_D0 + ((insn & 0xc) >> 2)]) == 0;
- temp = ~temp & State.regs[REG_D0 + ((insn & 0xc) >> 2)];
+ z = (temp & State.regs[REG_D0 + REG1 (insn)]) == 0;
+ temp = ~temp & State.regs[REG_D0 + REG1 (insn)];
store_mem (State.regs[REG_A0 + (insn & 3)], 1, temp);
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= (z ? PSW_Z : 0);
unsigned long temp;
int z;
- temp = load_mem ((State.regs[REG_A0 + ((insn & 0x30000) >> 16)]
+ temp = load_mem ((State.regs[REG_A0 + REG0_16 (insn)]
+ SEXT8 ((insn & 0xff00) >> 8)), 1);
z = (temp & (insn & 0xff)) == 0;
temp = ~temp & (insn & 0xff);
- store_mem (State.regs[REG_A0 + ((insn & 30000)>> 16)], 1, temp);
+ store_mem (State.regs[REG_A0 + REG0_16 (insn)], 1, temp);
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
PSW |= (z ? PSW_Z : 0);
}
long temp;
int z, n, c;
- temp = State.regs[REG_D0 + (insn & 0x3)];
+ temp = State.regs[REG_D0 + REG0 (insn)];
c = temp & 1;
- temp >>= State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- State.regs[REG_D0 + (insn & 0x3)] = temp;
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ temp >>= State.regs[REG_D0 + REG1 (insn)];
+ State.regs[REG_D0 + REG0 (insn)] = temp;
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
}
long temp;
int z, n, c;
- temp = State.regs[REG_D0 + ((insn & 0x300) >> 8)];
+ temp = State.regs[REG_D0 + REG0_8 (insn)];
c = temp & 1;
temp >>= (insn & 0xff);
- State.regs[REG_D0 + ((insn & 0x300) >> 8)] = temp;
- z = (State.regs[REG_D0 + ((insn & 0x300) >> 8)] == 0);
- n = (State.regs[REG_D0 + ((insn & 0x300) >> 8)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0_8 (insn)] = temp;
+ z = (State.regs[REG_D0 + REG0_8 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0_8 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
}
{
int z, n, c;
- c = State.regs[REG_D0 + (insn & 0x3)] & 1;
- State.regs[REG_D0 + (insn & 0x3)]
- >>= State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ c = State.regs[REG_D0 + REG0 (insn)] & 1;
+ State.regs[REG_D0 + REG0 (insn)]
+ >>= State.regs[REG_D0 + REG1 (insn)];
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
}
{
int z, n, c;
- c = State.regs[REG_D0 + ((insn & 0x300) >> 8)] & 1;
- State.regs[REG_D0 + ((insn & 0x300) >> 8)] >>= (insn & 0xff);
- z = (State.regs[REG_D0 + ((insn & 0x3) >> 8)] == 0);
- n = (State.regs[REG_D0 + ((insn & 0x3) >> 8)] & 0x80000000) != 0;
+ c = State.regs[REG_D0 + REG0_8 (insn)] & 1;
+ State.regs[REG_D0 + REG0_8 (insn)] >>= (insn & 0xff);
+ z = (State.regs[REG_D0 + (REG0 (insn) >> 8)] == 0);
+ n = (State.regs[REG_D0 + (REG0 (insn) >> 8)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
}
{
int n, z;
- State.regs[REG_D0 + (insn & 0x3)]
- <<= State.regs[REG_D0 + ((insn & 0xc) >> 2)];
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0 (insn)]
+ <<= State.regs[REG_D0 + REG1 (insn)];
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + ((insn & 0x300) >> 8)] <<= (insn & 0xff);
- z = (State.regs[REG_D0 + ((insn & 0x300) >> 8)] == 0);
- n = (State.regs[REG_D0 + ((insn & 0x300) >> 8)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0_8 (insn)] <<= (insn & 0xff);
+ z = (State.regs[REG_D0 + REG0_8 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0_8 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
{
int n, z;
- State.regs[REG_D0 + (insn & 0x3)] <<= 2;
- z = (State.regs[REG_D0 + (insn & 0x3)] == 0);
- n = (State.regs[REG_D0 + (insn & 0x3)] & 0x80000000) != 0;
+ State.regs[REG_D0 + REG0 (insn)] <<= 2;
+ z = (State.regs[REG_D0 + REG0 (insn)] == 0);
+ n = (State.regs[REG_D0 + REG0 (insn)] & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N);
PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
}
unsigned long value;
int c,n,z;
- value = State.regs[REG_D0 + (insn & 0x3)];
+ value = State.regs[REG_D0 + REG0 (insn)];
c = (value & 0x1);
value >>= 1;
value |= ((PSW & PSW_C) != 0) ? 0x80000000 : 0;
- State.regs[REG_D0 + (insn & 0x3)] = value;
+ State.regs[REG_D0 + REG0 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
unsigned long value;
int c,n,z;
- value = State.regs[REG_D0 + (insn & 0x3)];
+ value = State.regs[REG_D0 + REG0 (insn)];
c = (value & 0x80000000) ? 1 : 0;
value <<= 1;
value |= ((PSW & PSW_C) != 0);
- State.regs[REG_D0 + (insn & 0x3)] = value;
+ State.regs[REG_D0 + REG0 (insn)] = value;
z = (value == 0);
n = (value & 0x80000000) != 0;
PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
void OP_F0F4 (insn, extension)
unsigned long insn, extension;
{
- State.pc = State.regs[REG_A0 + (insn & 0x3)] - 2;
+ State.pc = State.regs[REG_A0 + REG0 (insn)] - 2;
}
/* jmp label:16 */
State.mem[sp+2] = (next_pc & 0xff0000) >> 16;
State.mem[sp+3] = (next_pc & 0xff000000) >> 24;
State.regs[REG_MDR] = next_pc;
- State.pc = State.regs[REG_A0 + (insn & 0x3)] - 2;
+ State.pc = State.regs[REG_A0 + REG0 (insn)] - 2;
}
/* calls label:16 */