//===== LD (n), nn void sngLD8_16() { _u8 dst = FETCH8; _u16 src = fetch16(); storeW(dst, src); cycles = 6; }
uint16_t indirect_y_pages() { uint16_t temp = fetch16(next()); uint16_t res = temp + registers->y; if((temp & res) >> 8) { cycles++; } return res; }
static int intern_op (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, unw_dyn_op_t *op, void *arg) { int ret; if ((ret = fetch8 (as, a, addr, &op->tag, arg)) < 0 || (ret = fetch8 (as, a, addr, &op->qp, arg)) < 0 || (ret = fetch16 (as, a, addr, &op->reg, arg)) < 0 || (ret = fetch32 (as, a, addr, &op->when, arg)) < 0 || (ret = fetchw (as, a, addr, &op->val, arg)) < 0) return ret; return 0; }
static UINT32 decode_opcode(UINT32 pc, const M68HC11_OPCODE *op_table) { UINT8 imm8, mask; INT8 rel8; UINT16 imm16; UINT8 op2; UINT32 flags = 0; if (!strcmp(op_table->mnemonic, "jsr") || !strcmp(op_table->mnemonic, "bsr")) flags = DASMFLAG_STEP_OVER; else if (!strcmp(op_table->mnemonic, "rts") || !strcmp(op_table->mnemonic, "rti")) flags = DASMFLAG_STEP_OUT; switch(op_table->address_mode) { case EA_IMM8: imm8 = fetch(); print("%s 0x%02X", op_table->mnemonic, imm8); break; case EA_IMM16: imm16 = fetch16(); print("%s 0x%04X", op_table->mnemonic, imm16); break; case EA_DIRECT: imm8 = fetch(); print("%s (0x%04X)", op_table->mnemonic, imm8); break; case EA_EXT: imm16 = fetch16(); print("%s (0x%04X)", op_table->mnemonic, imm16); break; case EA_IND_X: imm8 = fetch(); print("%s (X+0x%02X)", op_table->mnemonic, imm8); break; case EA_REL: rel8 = fetch(); print("%s [0x%04X]", op_table->mnemonic, pc+2+rel8); break; case EA_DIRECT_IMM8: imm8 = fetch(); mask = fetch(); print("%s (0x%04X), 0x%02X", op_table->mnemonic, imm8, mask); break; case EA_IND_X_IMM8: imm8 = fetch(); mask = fetch(); print("%s (X+0x%02X), 0x%02X", op_table->mnemonic, imm8, mask); break; case EA_DIRECT_IMM8_REL: imm8 = fetch(); mask = fetch(); rel8 = fetch(); print("%s (0x%04X), 0x%02X, [0x%04X]", op_table->mnemonic, imm8, mask, pc+4+rel8); break; case EA_IND_X_IMM8_REL: imm8 = fetch(); mask = fetch(); rel8 = fetch(); print("%s (X+0x%02X), 0x%02X, [0x%04X]", op_table->mnemonic, imm8, mask, pc+4+rel8); break; case EA_IND_Y: imm8 = fetch(); print("%s (Y+0x%02X)", op_table->mnemonic, imm8); break; case EA_IND_Y_IMM8: imm8 = fetch(); mask = fetch(); print("%s (Y+0x%02X), 0x%02X", op_table->mnemonic, imm8, mask); break; case EA_IND_Y_IMM8_REL: imm8 = fetch(); mask = fetch(); rel8 = fetch(); print("%s (Y+0x%02X), 0x%02X, [0x%04X]", op_table->mnemonic, imm8, mask, pc+2+rel8); break; case PAGE2: op2 = fetch(); return decode_opcode(pc, &opcode_table_page2[op2]); case PAGE3: op2 = fetch(); return decode_opcode(pc, &opcode_table_page3[op2]); case PAGE4: op2 = fetch(); return decode_opcode(pc, &opcode_table_page4[op2]); default: print("%s", op_table->mnemonic); } return flags; }
uint16_t indirect_y() { return fetch16(next()) + registers->y; }
uint16_t indirect_x() { return fetch16(next() + registers->x); }
uint16_t indirect() { return fetch16(next16()); }
static void decode_opcode(UINT32 pc, M68HC11_OPCODE *op_table) { UINT8 imm8, mask; INT8 rel8; UINT16 imm16; UINT8 op2; switch(op_table->address_mode) { case EA_IMM8: imm8 = fetch(); print("%s 0x%02X", op_table->mnemonic, imm8); break; case EA_IMM16: imm16 = fetch16(); print("%s 0x%04X", op_table->mnemonic, imm16); break; case EA_DIRECT: imm8 = fetch(); print("%s (0x%04X)", op_table->mnemonic, imm8); break; case EA_EXT: imm16 = fetch16(); print("%s (0x%04X)", op_table->mnemonic, imm16); break; case EA_IND_X: imm8 = fetch(); print("%s (X+0x%02X)", op_table->mnemonic, imm8); break; case EA_REL: rel8 = fetch(); print("%s [0x%04X]", op_table->mnemonic, pc+2+rel8); break; case EA_DIRECT_IMM8: imm8 = fetch(); mask = fetch(); print("%s (0x%04X), 0x%02X", op_table->mnemonic, imm8, mask); break; case EA_IND_X_IMM8: imm8 = fetch(); mask = fetch(); print("%s (X+0x%02X), 0x%02X", op_table->mnemonic, imm8, mask); break; case EA_DIRECT_IMM8_REL: imm8 = fetch(); mask = fetch(); rel8 = fetch(); print("%s (0x%04X), 0x%02X, [0x%04X]", op_table->mnemonic, imm8, mask, pc+2+rel8); break; case EA_IND_X_IMM8_REL: imm8 = fetch(); mask = fetch(); rel8 = fetch(); print("%s (X+0x%02X), 0x%02X, [0x%04X]", op_table->mnemonic, imm8, mask, pc+2+rel8); break; case EA_IND_Y: imm8 = fetch(); print("%s (Y+0x%02X)", op_table->mnemonic, imm8); break; case EA_IND_Y_IMM8: imm8 = fetch(); mask = fetch(); print("%s (Y+0x%02X), 0x%02X", op_table->mnemonic, imm8, mask); break; case EA_IND_Y_IMM8_REL: imm8 = fetch(); mask = fetch(); rel8 = fetch(); print("%s (Y+0x%02X), 0x%02X, [0x%04X]", op_table->mnemonic, imm8, mask, pc+2+rel8); break; case PAGE2: op2 = fetch(); decode_opcode(pc, &opcode_table_page2[op2]); break; case PAGE3: op2 = fetch(); decode_opcode(pc, &opcode_table_page3[op2]); break; case PAGE4: op2 = fetch(); decode_opcode(pc, &opcode_table_page4[op2]); break; default: print("%s", op_table->mnemonic); } }
//===== PUSH nn void sngPUSH16() { push16(fetch16()); cycles = 5; }