summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/m6809
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2016-09-09 06:07:49 -0400
committer Nathan Woods <npwoods@mess.org>2016-10-23 21:27:45 -0400
commit293bfef845a34767f6294b87794162f01c07f070 (patch)
tree530bb68cda987238ce9e9036412cf4c9c7a8e2a3 /src/devices/cpu/m6809
parent81294aa08f31401cc62e5ce18ac9e752f83db825 (diff)
Merging Konami disassembler with M6809/HD6309 disassemblers
Diffstat (limited to 'src/devices/cpu/m6809')
-rw-r--r--src/devices/cpu/m6809/6x09dasm.cpp1710
-rw-r--r--src/devices/cpu/m6809/knmidasm.cpp1872
2 files changed, 1133 insertions, 2449 deletions
diff --git a/src/devices/cpu/m6809/6x09dasm.cpp b/src/devices/cpu/m6809/6x09dasm.cpp
index ed5e478146c..89e0f92432c 100644
--- a/src/devices/cpu/m6809/6x09dasm.cpp
+++ b/src/devices/cpu/m6809/6x09dasm.cpp
@@ -2,7 +2,7 @@
// copyright-holders:Nathan Woods,Sean Riddle,Tim Lindner
/*****************************************************************************
- 6x09dasm.cpp - a 6809/6309 opcode disassembler
+ 6x09dasm.cpp - a 6809/6309/Konami opcode disassembler
Based on:
6809dasm.c - a 6809 opcode disassembler
@@ -28,11 +28,12 @@
#include "emu.h"
#include "debugger.h"
-#include "hd6309.h"
enum m6x09_addressing_mode
{
INH, // Inherent
+ PSHS, PSHU, // Push
+ PULS, PULU, // Pull
DIR, // Direct
DIR_IM, // Direct in memory (6309 only)
IND, // Indexed
@@ -55,19 +56,312 @@ enum m6x09_instruction_level
};
// Opcode structure
-struct opcodeinfo
+class opcodeinfo
{
- uint8_t opcode; // 8-bit opcode value
- uint8_t length; // Opcode length in bytes
- char name[6]; // Opcode name
- m6x09_addressing_mode mode : 4; // Addressing mode
- m6x09_instruction_level level : 1; // General, or 6309 only?
- unsigned flags; // Disassembly flags
+public:
+ constexpr opcodeinfo(uint16_t opcode, uint8_t length, const char *name, m6x09_addressing_mode mode, m6x09_instruction_level level, unsigned flags = 0)
+ : m_opcode(opcode), m_length(length), m_mode(mode), m_level(level), m_flags(flags), m_name(name)
+ {
+ }
+
+ uint16_t opcode() const { return m_opcode; }
+ uint8_t length() const { return m_length; }
+ m6x09_addressing_mode mode() const { return m_mode; }
+ m6x09_instruction_level level() const { return m_level; }
+ unsigned flags() const { return m_flags; }
+ const char *name() const { return m_name; }
+
+private:
+ uint16_t m_opcode; // 8-bit opcode value
+ uint8_t m_length; // Opcode length in bytes
+ m6x09_addressing_mode m_mode : 6; // Addressing mode
+ m6x09_instruction_level m_level : 2; // General, or 6309 only?
+ unsigned m_flags; // Disassembly flags
+ const char * m_name; // Opcode name
};
+static const char *const m6x09_regs[5] = { "X", "Y", "U", "S", "PC" };
+
+static const char *const m6x09_btwregs[5] = { "CC", "A", "B", "inv" };
+
+static const char *const hd6309_tfmregs[16] = {
+ "D", "X", "Y", "U", "S", "inv", "inv", "inv",
+ "inv", "inv", "inv", "inv", "inv", "inv", "inv", "inv"
+};
+
+static const char *const tfm_s[] = { "%s+,%s+", "%s-,%s-", "%s+,%s", "%s,%s+" };
+
+//**************************************************************************
+// BASE CLASS
+//**************************************************************************
+
+// ======================> m6x09_disassembler_base
+
+// base class for M6809/HD6309/Konami disassemblers
+namespace
+{
+ class m6x09_disassembler_base
+ {
+ public:
+ m6x09_disassembler_base(const opcodeinfo *opcodes, size_t opcode_count, m6x09_instruction_level level)
+ : m_opcodes(opcodes, opcode_count), m_level(level)
+ {
+ }
+
+ offs_t disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram);
+ offs_t disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram);
+
+ protected:
+ virtual void indirect(std::ostream &stream, uint8_t pb, const uint8_t *opram, int &p) = 0;
+ virtual void register_register(std::ostream &stream, uint8_t pb) = 0;
+
+ private:
+ util::contiguous_sequence_wrapper<const opcodeinfo> m_opcodes;
+ m6x09_instruction_level m_level;
+
+ const opcodeinfo *fetch_opcode(const uint8_t *oprom, int &p);
+ };
+}
+
+//-------------------------------------------------
+// fetch_opcode
+//-------------------------------------------------
-// Page 0 opcodes (single byte)
-static const opcodeinfo m6x09_pg0opcodes[] =
+const opcodeinfo *m6x09_disassembler_base::fetch_opcode(const uint8_t *oprom, int &p)
{
+ uint16_t page = 0;
+ const opcodeinfo *op = nullptr;
+ while(!op)
+ {
+ // retrieve the opcode
+ uint16_t opcode = page | oprom[p++];
+
+ // perform the lookup
+ auto iter = std::find_if(
+ m_opcodes.begin(),
+ m_opcodes.end(),
+ [opcode](const opcodeinfo &info) { return info.opcode() == opcode; });
+
+ // did we find something?
+ if (iter == m_opcodes.end())
+ return nullptr;
+
+ // was this a $10 or $11 page?
+ switch (iter->mode())
+ {
+ case PG1:
+ page = 0x1000;
+ break;
+
+ case PG2:
+ page = 0x1100;
+ break;
+
+ default:
+ op = &*iter;
+ break;
+ }
+ };
+ return op;
+}
+
+
+//-------------------------------------------------
+// disassemble - core of the disassembler
+//-------------------------------------------------
+
+offs_t m6x09_disassembler_base::disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram)
+{
+ std::ostringstream stream;
+ offs_t result = disassemble(stream, pc, oprom, opram);
+ std::string stream_str = stream.str();
+ strcpy(buffer, stream_str.c_str());
+ return result;
+}
+
+
+//-------------------------------------------------
+// disassemble - core of the disassembler
+//-------------------------------------------------
+
+offs_t m6x09_disassembler_base::disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram)
+{
+ uint8_t pb;
+ unsigned int ea;
+ int offset;
+ int p = 0;
+
+ // look up the opcode
+ const opcodeinfo *op = fetch_opcode(oprom, p);
+ if (!op)
+ {
+ stream << "Illegal Opcode";
+ return p | DASMFLAG_SUPPORTED;
+ }
+
+ // how many operands do we have?
+ int numoperands = (p == 1)
+ ? op->length() - 1
+ : op->length() - 2;
+
+ const uint8_t *operandarray = &opram[p];
+ p += numoperands;
+ pc += p;
+
+ // output the base instruction name
+ util::stream_format(stream, "%-6s", op->name());
+
+ switch (op->mode())
+ {
+ case INH:
+ // No operands
+ break;
+
+ case PSHS:
+ case PSHU:
+ pb = operandarray[0];
+ if (pb & 0x80)
+ util::stream_format(stream, "PC");
+ if (pb & 0x40)
+ util::stream_format(stream, "%s%s", (pb&0x80)?",":"", (op->mode() == PSHS)?"U":"S");
+ if (pb & 0x20)
+ util::stream_format(stream, "%sY", (pb&0xc0)?",":"");
+ if (pb & 0x10)
+ util::stream_format(stream, "%sX", (pb&0xe0)?",":"");
+ if (pb & 0x08)
+ util::stream_format(stream, "%sDP", (pb&0xf0)?",":"");
+ if (pb & 0x04)
+ util::stream_format(stream, "%sB", (pb&0xf8)?",":"");
+ if (pb & 0x02)
+ util::stream_format(stream, "%sA", (pb&0xfc)?",":"");
+ if (pb & 0x01)
+ util::stream_format(stream, "%sCC", (pb&0xfe)?",":"");
+ break;
+
+ case PULS:
+ case PULU:
+ pb = operandarray[0];
+ if (pb & 0x01)
+ util::stream_format(stream, "CC");
+ if (pb & 0x02)
+ util::stream_format(stream, "%sA", (pb&0x01)?",":"");
+ if (pb & 0x04)
+ util::stream_format(stream, "%sB", (pb&0x03)?",":"");
+ if (pb & 0x08)
+ util::stream_format(stream, "%sDP", (pb&0x07)?",":"");
+ if (pb & 0x10)
+ util::stream_format(stream, "%sX", (pb&0x0f)?",":"");
+ if (pb & 0x20)
+ util::stream_format(stream, "%sY", (pb&0x1f)?",":"");
+ if (pb & 0x40)
+ util::stream_format(stream, "%s%s", (pb&0x3f)?",":"", (op->mode() == PULS)?"U":"S");
+ if (pb & 0x80)
+ util::stream_format(stream, "%sPC", (pb&0x7f)?",":"");
+ break;
+
+ case DIR:
+ ea = operandarray[0];
+ util::stream_format(stream, "$%02X", ea);
+ break;
+
+ case DIR_IM:
+ assert(m_level >= HD6309_EXCLUSIVE);
+ util::stream_format(stream, "#$%02X;", operandarray[0]);
+ util::stream_format(stream, "$%02X", operandarray[1]);
+ break;
+
+ case REL:
+ offset = (int8_t)operandarray[0];
+ util::stream_format(stream, "$%04X", (pc + offset) & 0xffff);
+ break;
+
+ case LREL:
+ offset = (int16_t)((operandarray[0] << 8) + operandarray[1]);
+ util::stream_format(stream, "$%04X", (pc + offset) & 0xffff);
+ break;
+
+ case EXT:
+ if (numoperands == 3)
+ {
+ assert(m_level >= HD6309_EXCLUSIVE);
+ pb = operandarray[0];
+ ea = (operandarray[1] << 8) + operandarray[2];
+ util::stream_format(stream, "#$%02X,$%04X", pb, ea);
+ }
+ else if (numoperands == 2)
+ {
+ ea = (operandarray[0] << 8) + operandarray[1];
+ util::stream_format(stream, "$%04X", ea);
+ }
+ break;
+
+ case IND:
+ if (numoperands == 2)
+ {
+ assert(m_level >= HD6309_EXCLUSIVE);
+ util::stream_format(stream, "#$%02X;", operandarray[0]);
+ pb = operandarray[1];
+ }
+ else
+ {
+ pb = operandarray[0];
+ }
+
+ indirect(stream, pb, opram, p);
+ break;
+
+ case IMM:
+ if (numoperands == 4)
+ {
+ ea = (operandarray[0] << 24) + (operandarray[1] << 16) + (operandarray[2] << 8) + operandarray[3];
+ util::stream_format(stream, "#$%08X", ea);
+ }
+ else
+ if (numoperands == 2)
+ {
+ ea = (operandarray[0] << 8) + operandarray[1];
+ util::stream_format(stream, "#$%04X", ea);
+ }
+ else
+ if (numoperands == 1)
+ {
+ ea = operandarray[0];
+ util::stream_format(stream, "#$%02X", ea);
+ }
+ break;
+
+ case IMM_RR:
+ pb = operandarray[0];
+ register_register(stream, pb);
+ break;
+
+ case IMM_BW:
+ pb = operandarray[0];
+ util::stream_format(stream, "%s,", m6x09_btwregs[((pb & 0xc0) >> 6)]);
+ util::stream_format(stream, "%d,", (pb & 0x38) >> 3);
+ util::stream_format(stream, "%d,", (pb & 0x07));
+ util::stream_format(stream, "$%02X", operandarray[1]);
+ break;
+
+ case IMM_TFM:
+ pb = operandarray[0];
+ util::stream_format(stream, tfm_s[op->opcode() & 0x07], hd6309_tfmregs[(pb >> 4) & 0xf], hd6309_tfmregs[pb & 0xf]);
+ break;
+
+ default:
+ throw false;
+ }
+
+ return p | op->flags() | DASMFLAG_SUPPORTED;
+}
+
+
+//**************************************************************************
+// M6809/HD6309 disassembler
+//**************************************************************************
+
+static const opcodeinfo m6x09_opcodes[] =
+{
+ // Page 0 opcodes (single byte)
{ 0x00, 2, "NEG", DIR, M6x09_GENERAL },
{ 0x01, 3, "OIM", DIR_IM, HD6309_EXCLUSIVE },
{ 0x02, 3, "AIM", DIR_IM, HD6309_EXCLUSIVE },
@@ -120,10 +414,10 @@ static const opcodeinfo m6x09_pg0opcodes[] =
{ 0x31, 2, "LEAY", IND, M6x09_GENERAL },
{ 0x32, 2, "LEAS", IND, M6x09_GENERAL },
{ 0x33, 2, "LEAU", IND, M6x09_GENERAL },
- { 0x34, 2, "PSHS", INH, M6x09_GENERAL },
- { 0x35, 2, "PULS", INH, M6x09_GENERAL },
- { 0x36, 2, "PSHU", INH, M6x09_GENERAL },
- { 0x37, 2, "PULU", INH, M6x09_GENERAL },
+ { 0x34, 2, "PSHS", PSHS, M6x09_GENERAL },
+ { 0x35, 2, "PULS", PULS, M6x09_GENERAL },
+ { 0x36, 2, "PSHU", PSHU, M6x09_GENERAL },
+ { 0x37, 2, "PULU", PULU, M6x09_GENERAL },
{ 0x39, 1, "RTS", INH , M6x09_GENERAL },
{ 0x3A, 1, "ABX", INH, M6x09_GENERAL },
{ 0x3B, 1, "RTI", INH, M6x09_GENERAL },
@@ -319,681 +613,943 @@ static const opcodeinfo m6x09_pg0opcodes[] =
{ 0xFC, 3, "LDD", EXT, M6x09_GENERAL },
{ 0xFD, 3, "STD", EXT, M6x09_GENERAL },
{ 0xFE, 3, "LDU", EXT, M6x09_GENERAL },
- { 0xFF, 3, "STU", EXT, M6x09_GENERAL }
-};
+ { 0xFF, 3, "STU", EXT, M6x09_GENERAL },
+
+ // Page 1 opcodes (0x10 0x..)
+ { 0x1021, 4, "LBRN", LREL, M6x09_GENERAL },
+ { 0x1022, 4, "LBHI", LREL, M6x09_GENERAL },
+ { 0x1023, 4, "LBLS", LREL, M6x09_GENERAL },
+ { 0x1024, 4, "LBCC", LREL, M6x09_GENERAL },
+ { 0x1025, 4, "LBCS", LREL, M6x09_GENERAL },
+ { 0x1026, 4, "LBNE", LREL, M6x09_GENERAL },
+ { 0x1027, 4, "LBEQ", LREL, M6x09_GENERAL },
+ { 0x1028, 4, "LBVC", LREL, M6x09_GENERAL },
+ { 0x1029, 4, "LBVS", LREL, M6x09_GENERAL },
+ { 0x102A, 4, "LBPL", LREL, M6x09_GENERAL },
+ { 0x102B, 4, "LBMI", LREL, M6x09_GENERAL },
+ { 0x102C, 4, "LBGE", LREL, M6x09_GENERAL },
+ { 0x102D, 4, "LBLT", LREL, M6x09_GENERAL },
+ { 0x102E, 4, "LBGT", LREL, M6x09_GENERAL },
+ { 0x102F, 4, "LBLE", LREL, M6x09_GENERAL },
+
+ { 0x1030, 3, "ADDR", IMM_RR, HD6309_EXCLUSIVE },
+ { 0x1031, 3, "ADCR", IMM_RR, HD6309_EXCLUSIVE },
+ { 0x1032, 3, "SUBR", IMM_RR, HD6309_EXCLUSIVE },
+ { 0x1033, 3, "SBCR", IMM_RR, HD6309_EXCLUSIVE },
+ { 0x1034, 3, "ANDR", IMM_RR, HD6309_EXCLUSIVE },
+ { 0x1035, 3, "ORR", IMM_RR, HD6309_EXCLUSIVE },
+ { 0x1036, 3, "EORR", IMM_RR, HD6309_EXCLUSIVE },
+ { 0x1037, 3, "CMPR", IMM_RR, HD6309_EXCLUSIVE },
+
+ { 0x1038, 2, "PSHSW", INH, HD6309_EXCLUSIVE },
+ { 0x1039, 2, "PULSW", INH, HD6309_EXCLUSIVE },
+ { 0x103A, 2, "PSHUW", INH, HD6309_EXCLUSIVE },
+ { 0x103B, 2, "PULUW", INH, HD6309_EXCLUSIVE },
+
+ { 0x103F, 2, "SWI2", INH, HD6309_EXCLUSIVE },
+
+ { 0x1040, 2, "NEGD", INH, HD6309_EXCLUSIVE },
+ { 0x1043, 2, "COMD", INH, HD6309_EXCLUSIVE },
+ { 0x1044, 2, "LSRD", INH, HD6309_EXCLUSIVE },
+ { 0x1046, 2, "RORD", INH, HD6309_EXCLUSIVE },
+ { 0x1047, 2, "ASRD", INH, HD6309_EXCLUSIVE },
+ { 0x1048, 2, "ASLD", INH, HD6309_EXCLUSIVE },
+ { 0x1049, 2, "ROLD", INH, HD6309_EXCLUSIVE },
+
+ { 0x104A, 2, "DECD", INH, HD6309_EXCLUSIVE },
+ { 0x104C, 2, "INCD", INH, HD6309_EXCLUSIVE },
+ { 0x104D, 2, "TSTD", INH, HD6309_EXCLUSIVE },
+ { 0x104f, 2, "CLRD", INH, HD6309_EXCLUSIVE },
+
+ { 0x1053, 2, "COMW", INH, HD6309_EXCLUSIVE },
+ { 0x1054, 2, "LSRW", INH, HD6309_EXCLUSIVE },
+ { 0x1056, 2, "RORW", INH, HD6309_EXCLUSIVE },
+ { 0x1059, 2, "ROLW", INH, HD6309_EXCLUSIVE },
+ { 0x105A, 2, "DECW", INH, HD6309_EXCLUSIVE },
+ { 0x105C, 2, "INCW", INH, HD6309_EXCLUSIVE },
+ { 0x105D, 2, "TSTW", INH, HD6309_EXCLUSIVE },
+ { 0x105F, 2, "CLRW", INH, HD6309_EXCLUSIVE },
+ { 0x1080, 4, "SUBW", IMM, HD6309_EXCLUSIVE },
+ { 0x1081, 4, "CMPW", IMM, HD6309_EXCLUSIVE },
+ { 0x1082, 4, "SBCD", IMM, HD6309_EXCLUSIVE },
+
+ { 0x1083, 4, "CMPD", IMM, M6x09_GENERAL },
+
+ { 0x1084, 4, "ANDD", IMM, HD6309_EXCLUSIVE },
+ { 0x1085, 4, "BITD", IMM, HD6309_EXCLUSIVE },
+ { 0x1086, 4, "LDW", IMM, HD6309_EXCLUSIVE },
+ { 0x1088, 4, "EORD", IMM, HD6309_EXCLUSIVE },
+ { 0x1089, 4, "ADCD", IMM, HD6309_EXCLUSIVE },
+ { 0x108A, 4, "ORD", IMM, HD6309_EXCLUSIVE },
+ { 0x108B, 4, "ADDW", IMM, HD6309_EXCLUSIVE },
+
+ { 0x108C, 4, "CMPY", IMM, M6x09_GENERAL },
+ { 0x108E, 4, "LDY", IMM, M6x09_GENERAL },
+
+ { 0x1090, 3, "SUBW", DIR, HD6309_EXCLUSIVE },
+ { 0x1091, 3, "CMPW", DIR, HD6309_EXCLUSIVE },
+ { 0x1092, 3, "SBCD", DIR, HD6309_EXCLUSIVE },
+
+ { 0x1093, 3, "CMPD", DIR, M6x09_GENERAL },
+
+ { 0x1094, 3, "ANDD", DIR, HD6309_EXCLUSIVE },
+ { 0x1095, 3, "BITD", DIR, HD6309_EXCLUSIVE },
+ { 0x1096, 3, "LDW", DIR, HD6309_EXCLUSIVE },
+ { 0x1097, 3, "STW", DIR, HD6309_EXCLUSIVE },
+ { 0x1098, 3, "EORD", DIR, HD6309_EXCLUSIVE },
+ { 0x1099, 3, "ADCD", DIR, HD6309_EXCLUSIVE },
+ { 0x109A, 3, "ORD", DIR, HD6309_EXCLUSIVE },
+ { 0x109B, 3, "ADDW", DIR, HD6309_EXCLUSIVE },
+
+ { 0x109C, 3, "CMPY", DIR, M6x09_GENERAL },
+ { 0x109E, 3, "LDY", DIR, M6x09_GENERAL },
+ { 0x109F, 3, "STY", DIR, M6x09_GENERAL },
+
+ { 0x10A0, 3, "SUBW", IND, HD6309_EXCLUSIVE },
+ { 0x10A1, 3, "CMPW", IND, HD6309_EXCLUSIVE },
+ { 0x10A2, 3, "SBCD", IND, HD6309_EXCLUSIVE },
+
+ { 0x10A3, 3, "CMPD", IND, M6x09_GENERAL },
+
+ { 0x10A4, 3, "ANDD", IND, HD6309_EXCLUSIVE },
+ { 0x10A5, 3, "BITD", IND, HD6309_EXCLUSIVE },
+
+ { 0x10A6, 3, "LDW", IND, HD6309_EXCLUSIVE },
+ { 0x10A7, 3, "STW", IND, HD6309_EXCLUSIVE },
+ { 0x10A8, 3, "EORD", IND, HD6309_EXCLUSIVE },
+ { 0x10A9, 3, "ADCD", IND, HD6309_EXCLUSIVE },
+ { 0x10AA, 3, "ORD", IND, HD6309_EXCLUSIVE },
+ { 0x10AB, 3, "ADDW", IND, HD6309_EXCLUSIVE },
+
+ { 0x10AC, 3, "CMPY", IND, M6x09_GENERAL },
+ { 0x10AE, 3, "LDY", IND, M6x09_GENERAL },
+ { 0x10AF, 3, "STY", IND, M6x09_GENERAL },
+
+ { 0x10B0, 4, "SUBW", EXT, HD6309_EXCLUSIVE },
+ { 0x10B1, 4, "CMPW", EXT, HD6309_EXCLUSIVE },
+ { 0x10B2, 4, "SBCD", EXT, HD6309_EXCLUSIVE },
+
+ { 0x10B3, 4, "CMPD", EXT, M6x09_GENERAL },
+
+ { 0x10B4, 4, "ANDD", EXT, HD6309_EXCLUSIVE },
+ { 0x10B5, 4, "BITD", EXT, HD6309_EXCLUSIVE },
+ { 0x10B6, 4, "LDW", EXT, HD6309_EXCLUSIVE },
+ { 0x10B7, 4, "STW", EXT, HD6309_EXCLUSIVE },
+ { 0x10B8, 4, "EORD", EXT, HD6309_EXCLUSIVE },
+ { 0x10B9, 4, "ADCD", EXT, HD6309_EXCLUSIVE },
+ { 0x10BA, 4, "ORD", EXT, HD6309_EXCLUSIVE },
+ { 0x10BB, 4, "ADDW", EXT, HD6309_EXCLUSIVE },
+
+ { 0x10BC, 4, "CMPY", EXT, M6x09_GENERAL },
+ { 0x10BE, 4, "LDY", EXT, M6x09_GENERAL },
+ { 0x10BF, 4, "STY", EXT, M6x09_GENERAL },
+ { 0x10CE, 4, "LDS", IMM, M6x09_GENERAL },
+
+ { 0x10DC, 3, "LDQ", DIR, HD6309_EXCLUSIVE },
+ { 0x10DD, 3, "STQ", DIR, HD6309_EXCLUSIVE },
+
+ { 0x10DE, 3, "LDS", DIR, M6x09_GENERAL },
+ { 0x10DF, 3, "STS", DIR, M6x09_GENERAL },
+
+ { 0x10EC, 3, "LDQ", IND, HD6309_EXCLUSIVE },
+ { 0x10ED, 3, "STQ", IND, HD6309_EXCLUSIVE },
+
+ { 0x10EE, 3, "LDS", IND, M6x09_GENERAL },
+ { 0x10EF, 3, "STS", IND, M6x09_GENERAL },
+
+ { 0x10FC, 4, "LDQ", EXT, HD6309_EXCLUSIVE },
+ { 0x10FD, 4, "STQ", EXT, HD6309_EXCLUSIVE },
+
+ { 0x10FE, 4, "LDS", EXT, M6x09_GENERAL },
+ { 0x10FF, 4, "STS", EXT, M6x09_GENERAL },
+
+ // Page 2 opcodes (0x11 0x..)
+ { 0x1130, 4, "BAND", IMM_BW, HD6309_EXCLUSIVE },
+ { 0x1131, 4, "BIAND", IMM_BW, HD6309_EXCLUSIVE },
+ { 0x1132, 4, "BOR", IMM_BW, HD6309_EXCLUSIVE },
+ { 0x1133, 4, "BIOR", IMM_BW, HD6309_EXCLUSIVE },
+ { 0x1134, 4, "BEOR", IMM_BW, HD6309_EXCLUSIVE },
+ { 0x1135, 4, "BIEOR", IMM_BW, HD6309_EXCLUSIVE },
-// Page 1 opcodes (0x10 0x..)
-static const opcodeinfo m6x09_pg1opcodes[] =
-{
- { 0x21, 4, "LBRN", LREL, M6x09_GENERAL },
- { 0x22, 4, "LBHI", LREL, M6x09_GENERAL },
- { 0x23, 4, "LBLS", LREL, M6x09_GENERAL },
- { 0x24, 4, "LBCC", LREL, M6x09_GENERAL },
- { 0x25, 4, "LBCS", LREL, M6x09_GENERAL },
- { 0x26, 4, "LBNE", LREL, M6x09_GENERAL },
- { 0x27, 4, "LBEQ", LREL, M6x09_GENERAL },
- { 0x28, 4, "LBVC", LREL, M6x09_GENERAL },
- { 0x29, 4, "LBVS", LREL, M6x09_GENERAL },
- { 0x2A, 4, "LBPL", LREL, M6x09_GENERAL },
- { 0x2B, 4, "LBMI", LREL, M6x09_GENERAL },
- { 0x2C, 4, "LBGE", LREL, M6x09_GENERAL },
- { 0x2D, 4, "LBLT", LREL, M6x09_GENERAL },
- { 0x2E, 4, "LBGT", LREL, M6x09_GENERAL },
- { 0x2F, 4, "LBLE", LREL, M6x09_GENERAL },
-
- { 0x30, 3, "ADDR", IMM_RR, HD6309_EXCLUSIVE },
- { 0x31, 3, "ADCR", IMM_RR, HD6309_EXCLUSIVE },
- { 0x32, 3, "SUBR", IMM_RR, HD6309_EXCLUSIVE },
- { 0x33, 3, "SBCR", IMM_RR, HD6309_EXCLUSIVE },
- { 0x34, 3, "ANDR", IMM_RR, HD6309_EXCLUSIVE },
- { 0x35, 3, "ORR", IMM_RR, HD6309_EXCLUSIVE },
- { 0x36, 3, "EORR", IMM_RR, HD6309_EXCLUSIVE },
- { 0x37, 3, "CMPR", IMM_RR, HD6309_EXCLUSIVE },
-
- { 0x38, 2, "PSHSW", INH, HD6309_EXCLUSIVE },
- { 0x39, 2, "PULSW", INH, HD6309_EXCLUSIVE },
- { 0x3A, 2, "PSHUW", INH, HD6309_EXCLUSIVE },
- { 0x3B, 2, "PULUW", INH, HD6309_EXCLUSIVE },
-
- { 0x3F, 2, "SWI2", INH, HD6309_EXCLUSIVE },
-
- { 0x40, 2, "NEGD", INH, HD6309_EXCLUSIVE },
- { 0x43, 2, "COMD", INH, HD6309_EXCLUSIVE },
- { 0x44, 2, "LSRD", INH, HD6309_EXCLUSIVE },
- { 0x46, 2, "RORD", INH, HD6309_EXCLUSIVE },
- { 0x47, 2, "ASRD", INH, HD6309_EXCLUSIVE },
- { 0x48, 2, "ASLD", INH, HD6309_EXCLUSIVE },
- { 0x49, 2, "ROLD", INH, HD6309_EXCLUSIVE },
-
- { 0x4A, 2, "DECD", INH, HD6309_EXCLUSIVE },
- { 0x4C, 2, "INCD", INH, HD6309_EXCLUSIVE },
- { 0x4D, 2, "TSTD", INH, HD6309_EXCLUSIVE },
- { 0x4f, 2, "CLRD", INH, HD6309_EXCLUSIVE },
-
- { 0x53, 2, "COMW", INH, HD6309_EXCLUSIVE },
- { 0x54, 2, "LSRW", INH, HD6309_EXCLUSIVE },
- { 0x56, 2, "RORW", INH, HD6309_EXCLUSIVE },
- { 0x59, 2, "ROLW", INH, HD6309_EXCLUSIVE },
- { 0x5A, 2, "DECW", INH, HD6309_EXCLUSIVE },
- { 0x5C, 2, "INCW", INH, HD6309_EXCLUSIVE },
- { 0x5D, 2, "TSTW", INH, HD6309_EXCLUSIVE },
- { 0x5F, 2, "CLRW", INH, HD6309_EXCLUSIVE },
- { 0x80, 4, "SUBW", IMM, HD6309_EXCLUSIVE },
- { 0x81, 4, "CMPW", IMM, HD6309_EXCLUSIVE },
- { 0x82, 4, "SBCD", IMM, HD6309_EXCLUSIVE },
-
- { 0x83, 4, "CMPD", IMM, M6x09_GENERAL },
-
- { 0x84, 4, "ANDD", IMM, HD6309_EXCLUSIVE },
- { 0x85, 4, "BITD", IMM, HD6309_EXCLUSIVE },
- { 0x86, 4, "LDW", IMM, HD6309_EXCLUSIVE },
- { 0x88, 4, "EORD", IMM, HD6309_EXCLUSIVE },
- { 0x89, 4, "ADCD", IMM, HD6309_EXCLUSIVE },
- { 0x8A, 4, "ORD", IMM, HD6309_EXCLUSIVE },
- { 0x8B, 4, "ADDW", IMM, HD6309_EXCLUSIVE },
-
- { 0x8C, 4, "CMPY", IMM, M6x09_GENERAL },
- { 0x8E, 4, "LDY", IMM, M6x09_GENERAL },
-
- { 0x90, 3, "SUBW", DIR, HD6309_EXCLUSIVE },
- { 0x91, 3, "CMPW", DIR, HD6309_EXCLUSIVE },
- { 0x92, 3, "SBCD", DIR, HD6309_EXCLUSIVE },
-
- { 0x93, 3, "CMPD", DIR, M6x09_GENERAL },
-
- { 0x94, 3, "ANDD", DIR, HD6309_EXCLUSIVE },
- { 0x95, 3, "BITD", DIR, HD6309_EXCLUSIVE },
- { 0x96, 3, "LDW", DIR, HD6309_EXCLUSIVE },
- { 0x97, 3, "STW", DIR, HD6309_EXCLUSIVE },
- { 0x98, 3, "EORD", DIR, HD6309_EXCLUSIVE },
- { 0x99, 3, "ADCD", DIR, HD6309_EXCLUSIVE },
- { 0x9A, 3, "ORD", DIR, HD6309_EXCLUSIVE },
- { 0x9B, 3, "ADDW", DIR, HD6309_EXCLUSIVE },
-
- { 0x9C, 3, "CMPY", DIR, M6x09_GENERAL },
- { 0x9E, 3, "LDY", DIR, M6x09_GENERAL },
- { 0x9F, 3, "STY", DIR, M6x09_GENERAL },
-
- { 0xA0, 3, "SUBW", IND, HD6309_EXCLUSIVE },
- { 0xA1, 3, "CMPW", IND, HD6309_EXCLUSIVE },
- { 0xA2, 3, "SBCD", IND, HD6309_EXCLUSIVE },
-
- { 0xA3, 3, "CMPD", IND, M6x09_GENERAL },
-
- { 0xA4, 3, "ANDD", IND, HD6309_EXCLUSIVE },
- { 0xA5, 3, "BITD", IND, HD6309_EXCLUSIVE },
-
- { 0xA6, 3, "LDW", IND, HD6309_EXCLUSIVE },
- { 0xA7, 3, "STW", IND, HD6309_EXCLUSIVE },
- { 0xA8, 3, "EORD", IND, HD6309_EXCLUSIVE },
- { 0xA9, 3, "ADCD", IND, HD6309_EXCLUSIVE },
- { 0xAA, 3, "ORD", IND, HD6309_EXCLUSIVE },
- { 0xAB, 3, "ADDW", IND, HD6309_EXCLUSIVE },
-
- { 0xAC, 3, "CMPY", IND, M6x09_GENERAL },
- { 0xAE, 3, "LDY", IND, M6x09_GENERAL },
- { 0xAF, 3, "STY", IND, M6x09_GENERAL },
-
- { 0xB0, 4, "SUBW", EXT, HD6309_EXCLUSIVE },
- { 0xB1, 4, "CMPW", EXT, HD6309_EXCLUSIVE },
- { 0xB2, 4, "SBCD", EXT, HD6309_EXCLUSIVE },
-
- { 0xB3, 4, "CMPD", EXT, M6x09_GENERAL },
-
- { 0xB4, 4, "ANDD", EXT, HD6309_EXCLUSIVE },
- { 0xB5, 4, "BITD", EXT, HD6309_EXCLUSIVE },
- { 0xB6, 4, "LDW", EXT, HD6309_EXCLUSIVE },
- { 0xB7, 4, "STW", EXT, HD6309_EXCLUSIVE },
- { 0xB8, 4, "EORD", EXT, HD6309_EXCLUSIVE },
- { 0xB9, 4, "ADCD", EXT, HD6309_EXCLUSIVE },
- { 0xBA, 4, "ORD", EXT, HD6309_EXCLUSIVE },
- { 0xBB, 4, "ADDW", EXT, HD6309_EXCLUSIVE },
-
- { 0xBC, 4, "CMPY", EXT, M6x09_GENERAL },
- { 0xBE, 4, "LDY", EXT, M6x09_GENERAL },
- { 0xBF, 4, "STY", EXT, M6x09_GENERAL },
- { 0xCE, 4, "LDS", IMM, M6x09_GENERAL },
-
- { 0xDC, 3, "LDQ", DIR, HD6309_EXCLUSIVE },
- { 0xDD, 3, "STQ", DIR, HD6309_EXCLUSIVE },
-
- { 0xDE, 3, "LDS", DIR, M6x09_GENERAL },
- { 0xDF, 3, "STS", DIR, M6x09_GENERAL },
-
- { 0xEC, 3, "LDQ", IND, HD6309_EXCLUSIVE },
- { 0xED, 3, "STQ", IND, HD6309_EXCLUSIVE },
-
- { 0xEE, 3, "LDS", IND, M6x09_GENERAL },
- { 0xEF, 3, "STS", IND, M6x09_GENERAL },
-
- { 0xFC, 4, "LDQ", EXT, HD6309_EXCLUSIVE },
- { 0xFD, 4, "STQ", EXT, HD6309_EXCLUSIVE },
-
- { 0xFE, 4, "LDS", EXT, M6x09_GENERAL },
- { 0xFF, 4, "STS", EXT, M6x09_GENERAL }
-};
+ { 0x1136, 4, "LDBT", IMM_BW, HD6309_EXCLUSIVE },
+ { 0x1137, 4, "STBT", IMM_BW, HD6309_EXCLUSIVE },
+
+ { 0x1138, 3, "TFM", IMM_TFM, HD6309_EXCLUSIVE },
+ { 0x1139, 3, "TFM", IMM_TFM, HD6309_EXCLUSIVE },
+ { 0x113A, 3, "TFM", IMM_TFM, HD6309_EXCLUSIVE },
+ { 0x113B, 3, "TFM", IMM_TFM, HD6309_EXCLUSIVE },
+
+ { 0x113C, 3, "BITMD", IMM, HD6309_EXCLUSIVE },
+ { 0x113D, 3, "LDMD", IMM, HD6309_EXCLUSIVE },
-// Page 2 opcodes (0x11 0x..)
-static const opcodeinfo m6x09_pg2opcodes[] =
-{
- { 0x30, 4, "BAND", IMM_BW, HD6309_EXCLUSIVE },
- { 0x31, 4, "BIAND", IMM_BW, HD6309_EXCLUSIVE },
- { 0x32, 4, "BOR", IMM_BW, HD6309_EXCLUSIVE },
- { 0x33, 4, "BIOR", IMM_BW, HD6309_EXCLUSIVE },
- { 0x34, 4, "BEOR", IMM_BW, HD6309_EXCLUSIVE },
- { 0x35, 4, "BIEOR", IMM_BW, HD6309_EXCLUSIVE },
+ { 0x113F, 2, "SWI3", INH, M6x09_GENERAL },
- { 0x36, 4, "LDBT", IMM_BW, HD6309_EXCLUSIVE },
- { 0x37, 4, "STBT", IMM_BW, HD6309_EXCLUSIVE },
+ { 0x1143, 2, "COME", INH, HD6309_EXCLUSIVE },
+ { 0x114A, 2, "DECE", INH, HD6309_EXCLUSIVE },
+ { 0x114C, 2, "INCE", INH, HD6309_EXCLUSIVE },
+ { 0x114D, 2, "TSTE", INH, HD6309_EXCLUSIVE },
+ { 0x114F, 2, "CLRE", INH, HD6309_EXCLUSIVE },
+ { 0x1153, 2, "COMF", INH, HD6309_EXCLUSIVE },
+ { 0x115A, 2, "DECF", INH, HD6309_EXCLUSIVE },
+ { 0x115C, 2, "INCF", INH, HD6309_EXCLUSIVE },
+ { 0x115D, 2, "TSTF", INH, HD6309_EXCLUSIVE },
+ { 0x115F, 2, "CLRF", INH, HD6309_EXCLUSIVE },
+
+ { 0x1180, 3, "SUBE", IMM, HD6309_EXCLUSIVE },
+ { 0x1181, 3, "CMPE", IMM, HD6309_EXCLUSIVE },
- { 0x38, 3, "TFM", IMM_TFM, HD6309_EXCLUSIVE },
- { 0x39, 3, "TFM", IMM_TFM, HD6309_EXCLUSIVE },
- { 0x3A, 3, "TFM", IMM_TFM, HD6309_EXCLUSIVE },
- { 0x3B, 3, "TFM", IMM_TFM, HD6309_EXCLUSIVE },
+ { 0x1183, 4, "CMPU", IMM, M6x09_GENERAL },
- { 0x3C, 3, "BITMD", IMM, HD6309_EXCLUSIVE },
- { 0x3D, 3, "LDMD", IMM, HD6309_EXCLUSIVE },
+ { 0x1186, 3, "LDE", IMM, HD6309_EXCLUSIVE },
+ { 0x118B, 3, "ADDE", IMM, HD6309_EXCLUSIVE },
- { 0x3F, 2, "SWI3", INH, M6x09_GENERAL },
+ { 0x118C, 4, "CMPS", IMM, M6x09_GENERAL },
- { 0x43, 2, "COME", INH, HD6309_EXCLUSIVE },
- { 0x4A, 2, "DECE", INH, HD6309_EXCLUSIVE },
- { 0x4C, 2, "INCE", INH, HD6309_EXCLUSIVE },
- { 0x4D, 2, "TSTE", INH, HD6309_EXCLUSIVE },
- { 0x4F, 2, "CLRE", INH, HD6309_EXCLUSIVE },
- { 0x53, 2, "COMF", INH, HD6309_EXCLUSIVE },
- { 0x5A, 2, "DECF", INH, HD6309_EXCLUSIVE },
- { 0x5C, 2, "INCF", INH, HD6309_EXCLUSIVE },
- { 0x5D, 2, "TSTF", INH, HD6309_EXCLUSIVE },
- { 0x5F, 2, "CLRF", INH, HD6309_EXCLUSIVE },
+ { 0x118D, 3, "DIVD", IMM, HD6309_EXCLUSIVE },
+ { 0x118E, 4, "DIVQ", IMM, HD6309_EXCLUSIVE },
+ { 0x118F, 4, "MULD", IMM, HD6309_EXCLUSIVE },
+ { 0x1190, 3, "SUBE", DIR, HD6309_EXCLUSIVE },
+ { 0x1191, 3, "CMPE", DIR, HD6309_EXCLUSIVE },
- { 0x80, 3, "SUBE", IMM, HD6309_EXCLUSIVE },
- { 0x81, 3, "CMPE", IMM, HD6309_EXCLUSIVE },
+ { 0x1193, 3, "CMPU", DIR, M6x09_GENERAL },
- { 0x83, 4, "CMPU", IMM, M6x09_GENERAL },
+ { 0x1196, 3, "LDE", DIR, HD6309_EXCLUSIVE },
+ { 0x1197, 3, "STE", DIR, HD6309_EXCLUSIVE },
+ { 0x119B, 3, "ADDE", DIR, HD6309_EXCLUSIVE },
- { 0x86, 3, "LDE", IMM, HD6309_EXCLUSIVE },
- { 0x8b, 3, "ADDE", IMM, HD6309_EXCLUSIVE },
+ { 0x119C, 3, "CMPS", DIR, M6x09_GENERAL },
- { 0x8C, 4, "CMPS", IMM, M6x09_GENERAL },
+ { 0x119D, 3, "DIVD", DIR, HD6309_EXCLUSIVE },
+ { 0x119E, 3, "DIVQ", DIR, HD6309_EXCLUSIVE },
+ { 0x119F, 3, "MULD", DIR, HD6309_EXCLUSIVE },
- { 0x8D, 3, "DIVD", IMM, HD6309_EXCLUSIVE },
- { 0x8E, 4, "DIVQ", IMM, HD6309_EXCLUSIVE },
- { 0x8F, 4, "MULD", IMM, HD6309_EXCLUSIVE },
- { 0x90, 3, "SUBE", DIR, HD6309_EXCLUSIVE },
- { 0x91, 3, "CMPE", DIR, HD6309_EXCLUSIVE },
+ { 0x11A0, 3, "SUBE", IND, HD6309_EXCLUSIVE },
+ { 0x11A1, 3, "CMPE", IND, HD6309_EXCLUSIVE },
- { 0x93, 3, "CMPU", DIR, M6x09_GENERAL },
+ { 0x11A3, 3, "CMPU", IND, M6x09_GENERAL },
- { 0x96, 3, "LDE", DIR, HD6309_EXCLUSIVE },
- { 0x97, 3, "STE", DIR, HD6309_EXCLUSIVE },
- { 0x9B, 3, "ADDE", DIR, HD6309_EXCLUSIVE },
+ { 0x11A6, 3, "LDE", IND, HD6309_EXCLUSIVE },
+ { 0x11A7, 3, "STE", IND, HD6309_EXCLUSIVE },
+ { 0x11AB, 3, "ADDE", IND, HD6309_EXCLUSIVE },
- { 0x9C, 3, "CMPS", DIR, M6x09_GENERAL },
+ { 0x11AC, 3, "CMPS", IND, M6x09_GENERAL },
- { 0x9D, 3, "DIVD", DIR, HD6309_EXCLUSIVE },
- { 0x9E, 3, "DIVQ", DIR, HD6309_EXCLUSIVE },
- { 0x9F, 3, "MULD", DIR, HD6309_EXCLUSIVE },
+ { 0x11AD, 3, "DIVD", IND, HD6309_EXCLUSIVE },
+ { 0x11AE, 3, "DIVQ", IND, HD6309_EXCLUSIVE },
+ { 0x11AF, 3, "MULD", IND, HD6309_EXCLUSIVE },
+ { 0x11B0, 4, "SUBE", EXT, HD6309_EXCLUSIVE },
+ { 0x11B1, 4, "CMPE", EXT, HD6309_EXCLUSIVE },
- { 0xA0, 3, "SUBE", IND, HD6309_EXCLUSIVE },
- { 0xA1, 3, "CMPE", IND, HD6309_EXCLUSIVE },
+ { 0x11B3, 4, "CMPU", EXT, M6x09_GENERAL },
- { 0xA3, 3, "CMPU", IND, M6x09_GENERAL },
+ { 0x11B6, 4, "LDE", EXT, HD6309_EXCLUSIVE },
+ { 0x11B7, 4, "STE", EXT, HD6309_EXCLUSIVE },
- { 0xA6, 3, "LDE", IND, HD6309_EXCLUSIVE },
- { 0xA7, 3, "STE", IND, HD6309_EXCLUSIVE },
- { 0xAB, 3, "ADDE", IND, HD6309_EXCLUSIVE },
+ { 0x11BB, 4, "ADDE", EXT, HD6309_EXCLUSIVE },
+ { 0x11BC, 4, "CMPS", EXT, M6x09_GENERAL },
- { 0xAC, 3, "CMPS", IND, M6x09_GENERAL },
+ { 0x11BD, 4, "DIVD", EXT, HD6309_EXCLUSIVE },
+ { 0x11BE, 4, "DIVQ", EXT, HD6309_EXCLUSIVE },
+ { 0x11BF, 4, "MULD", EXT, HD6309_EXCLUSIVE },
- { 0xAD, 3, "DIVD", IND, HD6309_EXCLUSIVE },
- { 0xAE, 3, "DIVQ", IND, HD6309_EXCLUSIVE },
- { 0xAF, 3, "MULD", IND, HD6309_EXCLUSIVE },
- { 0xB0, 4, "SUBE", EXT, HD6309_EXCLUSIVE },
- { 0xB1, 4, "CMPE", EXT, HD6309_EXCLUSIVE },
+ { 0x11C0, 3, "SUBF", IMM, HD6309_EXCLUSIVE },
+ { 0x11C1, 3, "CMPF", IMM, HD6309_EXCLUSIVE },
+ { 0x11C6, 3, "LDF", IMM, HD6309_EXCLUSIVE },
+ { 0x11CB, 3, "ADDF", IMM, HD6309_EXCLUSIVE },
- { 0xB3, 4, "CMPU", EXT, M6x09_GENERAL },
+ { 0x11D0, 3, "SUBF", DIR, HD6309_EXCLUSIVE },
+ { 0x11D1, 3, "CMPF", DIR, HD6309_EXCLUSIVE },
+ { 0x11D6, 3, "LDF", DIR, HD6309_EXCLUSIVE },
+ { 0x11D7, 3, "STF", DIR, HD6309_EXCLUSIVE },
+ { 0x11DB, 3, "ADDF", DIR, HD6309_EXCLUSIVE },
- { 0xB6, 4, "LDE", EXT, HD6309_EXCLUSIVE },
- { 0xB7, 4, "STE", EXT, HD6309_EXCLUSIVE },
+ { 0x11E0, 3, "SUBF", IND, HD6309_EXCLUSIVE },
+ { 0x11E1, 3, "CMPF", IND, HD6309_EXCLUSIVE },
+ { 0x11E6, 3, "LDF", IND, HD6309_EXCLUSIVE },
+ { 0x11E7, 3, "STF", IND, HD6309_EXCLUSIVE },
+ { 0x11EB, 3, "ADDF", IND, HD6309_EXCLUSIVE },
- { 0xBB, 4, "ADDE", EXT, HD6309_EXCLUSIVE },
- { 0xBC, 4, "CMPS", EXT, M6x09_GENERAL },
-
- { 0xBD, 4, "DIVD", EXT, HD6309_EXCLUSIVE },
- { 0xBE, 4, "DIVQ", EXT, HD6309_EXCLUSIVE },
- { 0xBF, 4, "MULD", EXT, HD6309_EXCLUSIVE },
-
- { 0xC0, 3, "SUBF", IMM, HD6309_EXCLUSIVE },
- { 0xC1, 3, "CMPF", IMM, HD6309_EXCLUSIVE },
- { 0xC6, 3, "LDF", IMM, HD6309_EXCLUSIVE },
- { 0xCB, 3, "ADDF", IMM, HD6309_EXCLUSIVE },
-
- { 0xD0, 3, "SUBF", DIR, HD6309_EXCLUSIVE },
- { 0xD1, 3, "CMPF", DIR, HD6309_EXCLUSIVE },
- { 0xD6, 3, "LDF", DIR, HD6309_EXCLUSIVE },
- { 0xD7, 3, "STF", DIR, HD6309_EXCLUSIVE },
- { 0xDB, 3, "ADDF", DIR, HD6309_EXCLUSIVE },
-
- { 0xE0, 3, "SUBF", IND, HD6309_EXCLUSIVE },
- { 0xE1, 3, "CMPF", IND, HD6309_EXCLUSIVE },
- { 0xE6, 3, "LDF", IND, HD6309_EXCLUSIVE },
- { 0xE7, 3, "STF", IND, HD6309_EXCLUSIVE },
- { 0xEB, 3, "ADDF", IND, HD6309_EXCLUSIVE },
-
- { 0xF0, 4, "SUBF", EXT, HD6309_EXCLUSIVE },
- { 0xF1, 4, "CMPF", EXT, HD6309_EXCLUSIVE },
- { 0xF6, 4, "LDF", EXT, HD6309_EXCLUSIVE },
- { 0xF7, 4, "STF", EXT, HD6309_EXCLUSIVE },
- { 0xFB, 4, "ADDF", EXT, HD6309_EXCLUSIVE }
+ { 0x11F0, 4, "SUBF", EXT, HD6309_EXCLUSIVE },
+ { 0x11F1, 4, "CMPF", EXT, HD6309_EXCLUSIVE },
+ { 0x11F6, 4, "LDF", EXT, HD6309_EXCLUSIVE },
+ { 0x11F7, 4, "STF", EXT, HD6309_EXCLUSIVE },
+ { 0x11FB, 4, "ADDF", EXT, HD6309_EXCLUSIVE }
};
-static const opcodeinfo *const m6x09_pgpointers[3] =
-{
- m6x09_pg0opcodes, m6x09_pg1opcodes, m6x09_pg2opcodes
-};
-static const int m6x09_numops[3] =
-{
- ARRAY_LENGTH(m6x09_pg0opcodes),
- ARRAY_LENGTH(m6x09_pg1opcodes),
- ARRAY_LENGTH(m6x09_pg2opcodes)
-};
+// ======================> m6x09_disassembler
-static const char *const m6x09_regs[5] = { "X", "Y", "U", "S", "PC" };
+// M6809/HD6309 disassembler
+namespace
+{
+ class m6x09_disassembler : public m6x09_disassembler_base
+ {
+ public:
+ m6x09_disassembler(m6x09_instruction_level level, const char teregs[16][4])
+ : m6x09_disassembler_base(m6x09_opcodes, ARRAY_LENGTH(m6x09_opcodes), level)
+ , m_teregs(*reinterpret_cast<const std::array<std::array<char, 4>, 16> *>(teregs))
+ {
+ }
-static const char *const m6x09_btwregs[5] = { "CC", "A", "B", "inv" };
+ protected:
+ virtual void indirect(std::ostream &stream, uint8_t pb, const uint8_t *opram, int &p) override;
+ virtual void register_register(std::ostream &stream, uint8_t pb) override;
-static const char *const hd6309_tfmregs[16] = {
- "D", "X", "Y", "U", "S", "inv", "inv", "inv",
- "inv", "inv", "inv", "inv", "inv", "inv", "inv", "inv"
+ private:
+ const std::array<std::array<char, 4>, 16> &m_teregs;
+ };
};
-static const char *const tfm_s[] = { "%s+,%s+", "%s-,%s-", "%s+,%s", "%s,%s+" };
-
//-------------------------------------------------
-// internal_m6x09_disassemble - core of the
-// disassembler
+// indirect addressing mode for M6809/HD6309
//-------------------------------------------------
-static offs_t internal_m6x09_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, m6x09_instruction_level level, const char teregs[16][4])
+void m6x09_disassembler::indirect(std::ostream &stream, uint8_t pb, const uint8_t *opram, int &p)
{
- uint8_t pb, pbm, reg;
+ uint8_t reg = (pb >> 5) & 3;
+ uint8_t pbm = pb & 0x8f;
+ bool indirect = (pb & 0x90) == 0x90;
+ int offset;
unsigned int ea;
- int offset, indirect;
- int i, p = 0, page = 0;
+ // open brackets if indirect
+ if (indirect && pbm != 0x82)
+ util::stream_format(stream, "[");
- // look up the opcode
- uint8_t opcode;
- bool opcode_found;
- do
+ switch (pbm)
{
- opcode = oprom[p++];
- for (i = 0; i < m6x09_numops[page]; i++)
- if (m6x09_pgpointers[page][i].opcode == opcode && m6x09_pgpointers[page][i].level <= level)
+ case 0x80: // ,R+ or operations relative to W
+ if (indirect)
+ {
+ switch (reg)
+ {
+ case 0x00:
+ util::stream_format(stream, ",W");
+ break;
+ case 0x01:
+ offset = (int16_t)((opram[p + 0] << 8) + opram[p + 1]);
+ p += 2;
+ util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
+ util::stream_format(stream, "$%04X,W", (offset < 0) ? -offset : offset);
+ break;
+ case 0x02:
+ util::stream_format(stream, ",W++");
+ break;
+ case 0x03:
+ util::stream_format(stream, ",--W");
break;
+ }
+ }
+ else
+ util::stream_format(stream, ",%s+", m6x09_regs[reg]);
+ break;
- // did we find something?
- if (i < m6x09_numops[page])
- opcode_found = true;
+ case 0x81: // ,R++
+ util::stream_format(stream, ",%s++", m6x09_regs[reg]);
+ break;
+
+ case 0x82: // ,-R
+ if (indirect)
+ stream << "Illegal Postbyte";
else
- {
- stream << "Illegal Opcode";
- return p | DASMFLAG_SUPPORTED;
- }
+ util::stream_format(stream, ",-%s", m6x09_regs[reg]);
+ break;
- // was this a $10 or $11 page?
- if (m6x09_pgpointers[page][i].mode >= PG1)
- {
- page = m6x09_pgpointers[page][i].mode - PG1 + 1;
- opcode_found = false;
- }
- } while (!opcode_found);
+ case 0x83: // ,--R
+ util::stream_format(stream, ",--%s", m6x09_regs[reg]);
+ break;
- // how many operands do we have?
- int numoperands = (page == 0)
- ? m6x09_pgpointers[page][i].length - 1
- : m6x09_pgpointers[page][i].length - 2;
+ case 0x84: // ,R
+ util::stream_format(stream, ",%s", m6x09_regs[reg]);
+ break;
- const uint8_t *operandarray = &opram[p];
- p += numoperands;
- pc += p;
- uint8_t mode = m6x09_pgpointers[page][i].mode;
- unsigned flags = m6x09_pgpointers[page][i].flags;
+ case 0x85: // (+/- B),R
+ util::stream_format(stream, "B,%s", m6x09_regs[reg]);
+ break;
- // output the base instruction name
- util::stream_format(stream, "%-6s", m6x09_pgpointers[page][i].name);
+ case 0x86: // (+/- A),R
+ util::stream_format(stream, "A,%s", m6x09_regs[reg]);
+ break;
- switch (mode)
- {
- case INH:
- switch (opcode)
- {
- case 0x34: // PSHS
- case 0x36: // PSHU
- pb = operandarray[0];
- if (pb & 0x80)
- util::stream_format(stream, "PC");
- if (pb & 0x40)
- util::stream_format(stream, "%s%s", (pb&0x80)?",":"", (opcode==0x34)?"U":"S");
- if (pb & 0x20)
- util::stream_format(stream, "%sY", (pb&0xc0)?",":"");
- if (pb & 0x10)
- util::stream_format(stream, "%sX", (pb&0xe0)?",":"");
- if (pb & 0x08)
- util::stream_format(stream, "%sDP", (pb&0xf0)?",":"");
- if (pb & 0x04)
- util::stream_format(stream, "%sB", (pb&0xf8)?",":"");
- if (pb & 0x02)
- util::stream_format(stream, "%sA", (pb&0xfc)?",":"");
- if (pb & 0x01)
- util::stream_format(stream, "%sCC", (pb&0xfe)?",":"");
- break;
- case 0x35: // PULS
- case 0x37: // PULU
- pb = operandarray[0];
- if (pb & 0x01)
- util::stream_format(stream, "CC");
- if (pb & 0x02)
- util::stream_format(stream, "%sA", (pb&0x01)?",":"");
- if (pb & 0x04)
- util::stream_format(stream, "%sB", (pb&0x03)?",":"");
- if (pb & 0x08)
- util::stream_format(stream, "%sDP", (pb&0x07)?",":"");
- if (pb & 0x10)
- util::stream_format(stream, "%sX", (pb&0x0f)?",":"");
- if (pb & 0x20)
- util::stream_format(stream, "%sY", (pb&0x1f)?",":"");
- if (pb & 0x40)
- util::stream_format(stream, "%s%s", (pb&0x3f)?",":"", (opcode==0x35)?"U":"S");
- if (pb & 0x80)
- util::stream_format(stream, "%sPC", (pb&0x7f)?",":"");
- break;
- default:
- // No operands
- break;
- }
+ case 0x87: // (+/- E),R
+ util::stream_format(stream, "E,%s", m6x09_regs[reg]);
break;
- case DIR:
- ea = operandarray[0];
- util::stream_format(stream, "$%02X", ea);
+ case 0x88: // (+/- 7 bit offset),R
+ offset = (int8_t)opram[p++];
+ util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
+ util::stream_format(stream, "$%02X,", (offset < 0) ? -offset : offset);
+ util::stream_format(stream, "%s", m6x09_regs[reg]);
break;
- case DIR_IM:
- assert(level >= HD6309_EXCLUSIVE);
- util::stream_format(stream, "#$%02X;", operandarray[0]);
- util::stream_format(stream, "$%02X", operandarray[1]);
+ case 0x89: // (+/- 15 bit offset),R
+ offset = (int16_t)((opram[p + 0] << 8) + opram[p + 1]);
+ p += 2;
+ util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
+ util::stream_format(stream, "$%04X,", (offset < 0) ? -offset : offset);
+ util::stream_format(stream, "%s", m6x09_regs[reg]);
+ break;
+
+ case 0x8a: // (+/- F),R
+ util::stream_format(stream, "F,%s", m6x09_regs[reg]);
break;
- case REL:
- offset = (int8_t)operandarray[0];
- util::stream_format(stream, "$%04X", (pc + offset) & 0xffff);
+ case 0x8b: // (+/- D),R
+ util::stream_format(stream, "D,%s", m6x09_regs[reg]);
break;
- case LREL:
- offset = (int16_t)((operandarray[0] << 8) + operandarray[1]);
- util::stream_format(stream, "$%04X", (pc + offset) & 0xffff);
+ case 0x8c: // (+/- 7 bit offset),PC
+ offset = (int8_t)opram[p++];
+ util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
+ util::stream_format(stream, "$%02X,PC", (offset < 0) ? -offset : offset);
break;
- case EXT:
- if (numoperands == 3)
- {
- assert(level >= HD6309_EXCLUSIVE);
- pb = operandarray[0];
- ea = (operandarray[1] << 8) + operandarray[2];
- util::stream_format(stream, "#$%02X,$%04X", pb, ea);
- }
- else if (numoperands == 2)
- {
- ea = (operandarray[0] << 8) + operandarray[1];
- util::stream_format(stream, "$%04X", ea);
- }
+ case 0x8d: // (+/- 15 bit offset),PC
+ offset = (int16_t)((opram[p + 0] << 8) + opram[p + 1]);
+ p += 2;
+ util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
+ util::stream_format(stream, "$%04X,PC", (offset < 0) ? -offset : offset);
break;
- case IND:
- if (numoperands == 2)
+ case 0x8e: // (+/- W),R
+ util::stream_format(stream, "W,%s", m6x09_regs[reg]);
+ break;
+
+ case 0x8f: // address or operations relative to W
+ if (indirect)
{
- assert(level >= HD6309_EXCLUSIVE);
- util::stream_format(stream, "#$%02X;", operandarray[0]);
- pb = operandarray[1];
+ ea = (uint16_t)((opram[p + 0] << 8) + opram[p + 1]);
+ p += 2;
+ util::stream_format(stream, "$%04X", ea);
+ break;
}
else
{
- pb = operandarray[0];
+ switch (reg)
+ {
+ case 0x00:
+ util::stream_format(stream, ",W");
+ break;
+ case 0x01:
+ offset = (int16_t)((opram[p + 0] << 8) + opram[p + 1]);
+ p += 2;
+ util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
+ util::stream_format(stream, "$%04X,W", (offset < 0) ? -offset : offset);
+ break;
+ case 0x02:
+ util::stream_format(stream, ",W++");
+ break;
+ case 0x03:
+ util::stream_format(stream, ",--W");
+ break;
+ }
}
+ break;
+
+ default: // (+/- 4 bit offset),R
+ offset = pb & 0x1f;
+ if (offset > 15)
+ offset = offset - 32;
+ util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
+ util::stream_format(stream, "$%X,", (offset < 0) ? -offset : offset);
+ util::stream_format(stream, "%s", m6x09_regs[reg]);
+ break;
+ }
- reg = (pb >> 5) & 3;
- pbm = pb & 0x8f;
- indirect = ((pb & 0x90) == 0x90 ) ? true : false;
+ // close brackets if indirect
+ if (indirect && pbm != 0x82)
+ util::stream_format(stream, "]");
+}
- // open brackets if indirect
- if (indirect && pbm != 0x82)
- util::stream_format(stream, "[");
- switch (pbm)
- {
- case 0x80: // ,R+ or operations relative to W
- if (indirect)
- {
- switch (reg)
- {
- case 0x00:
- util::stream_format(stream, ",W");
- break;
- case 0x01:
- offset = (int16_t)((opram[p+0] << 8) + opram[p+1]);
- p += 2;
- util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
- util::stream_format(stream, "$%04X,W", (offset < 0) ? -offset : offset);
- break;
- case 0x02:
- util::stream_format(stream, ",W++");
- break;
- case 0x03:
- util::stream_format(stream, ",--W");
- break;
- }
- }
- else
- util::stream_format(stream, ",%s+", m6x09_regs[reg]);
- break;
+//-------------------------------------------------
+// M6809/HD6309 register/register parameter
+//-------------------------------------------------
- case 0x81: // ,R++
- util::stream_format(stream, ",%s++", m6x09_regs[reg]);
- break;
+void m6x09_disassembler::register_register(std::ostream &stream, uint8_t pb)
+{
+ util::stream_format(stream, "%s,%s",
+ m_teregs[(pb >> 4) & 0xf].data(),
+ m_teregs[(pb >> 0) & 0xf].data());
+}
- case 0x82: // ,-R
- if (indirect)
- stream << "Illegal Postbyte";
- else
- util::stream_format(stream, ",-%s", m6x09_regs[reg]);
- break;
- case 0x83: // ,--R
- util::stream_format(stream, ",--%s", m6x09_regs[reg]);
- break;
+//-------------------------------------------------
+// M6809 disassembler entry point
+//-------------------------------------------------
- case 0x84: // ,R
- util::stream_format(stream, ",%s", m6x09_regs[reg]);
- break;
+CPU_DISASSEMBLE(m6809)
+{
+ static const char m6809_teregs[16][4] =
+ {
+ "D", "X", "Y", "U", "S", "PC", "inv", "inv",
+ "A", "B", "CC", "DP", "inv", "inv", "inv", "inv"
+ };
+ m6x09_disassembler disasm(M6x09_GENERAL, m6809_teregs);
+ return disasm.disassemble(buffer, pc, oprom, opram);
+}
- case 0x85: // (+/- B),R
- util::stream_format(stream, "B,%s", m6x09_regs[reg]);
- break;
- case 0x86: // (+/- A),R
- util::stream_format(stream, "A,%s", m6x09_regs[reg]);
- break;
+//-------------------------------------------------
+// HD6309 disassembler entry point
+//-------------------------------------------------
- case 0x87: // (+/- E),R
- util::stream_format(stream, "E,%s", m6x09_regs[reg]);
- break;
+CPU_DISASSEMBLE(hd6309)
+{
+ static const char hd6309_teregs[16][4] =
+ {
+ "D", "X", "Y", "U", "S", "PC", "W", "V",
+ "A", "B", "CC", "DP", "0", "0", "E", "F"
+ };
+ m6x09_disassembler disasm(HD6309_EXCLUSIVE, hd6309_teregs);
+ return disasm.disassemble(buffer, pc, oprom, opram);
+}
- case 0x88: // (+/- 7 bit offset),R
- offset = (int8_t)opram[p++];
- util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
- util::stream_format(stream, "$%02X,", (offset < 0) ? -offset : offset);
- util::stream_format(stream, "%s", m6x09_regs[reg]);
- break;
- case 0x89: // (+/- 15 bit offset),R
- offset = (int16_t)((opram[p+0] << 8) + opram[p+1]);
- p += 2;
- util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
- util::stream_format(stream, "$%04X,", (offset < 0) ? -offset : offset);
- util::stream_format(stream, "%s", m6x09_regs[reg]);
- break;
+//**************************************************************************
+// Konami disassembler
+//**************************************************************************
- case 0x8a: // (+/- F),R
- util::stream_format(stream, "F,%s", m6x09_regs[reg]);
- break;
+static const opcodeinfo konami_opcodes[] =
+{
+ { 0x08, 2, "LEAX", IND, M6x09_GENERAL },
+ { 0x09, 2, "LEAY", IND, M6x09_GENERAL },
+ { 0x0A, 2, "LEAU", IND, M6x09_GENERAL },
+ { 0x0B, 2, "LEAS", IND, M6x09_GENERAL },
+ { 0x0C, 2, "PUSHS", PSHS, M6x09_GENERAL },
+ { 0x0D, 2, "PUSHU", PSHU, M6x09_GENERAL },
+ { 0x0E, 2, "PULLS", PULS, M6x09_GENERAL },
+ { 0x0F, 2, "PULLU", PULU, M6x09_GENERAL },
+
+ { 0x10, 2, "LDA", IMM, M6x09_GENERAL },
+ { 0x11, 2, "LDB", IMM, M6x09_GENERAL },
+ { 0x12, 2, "LDA", IND, M6x09_GENERAL },
+ { 0x13, 2, "LDB", IND, M6x09_GENERAL },
+ { 0x14, 2, "ADDA", IMM, M6x09_GENERAL },
+ { 0x15, 2, "ADDB", IMM, M6x09_GENERAL },
+ { 0x16, 2, "ADDA", IND, M6x09_GENERAL },
+ { 0x17, 2, "ADDB", IND, M6x09_GENERAL },
+ { 0x18, 2, "ADCA", IMM, M6x09_GENERAL },
+ { 0x19, 2, "ADCB", IMM, M6x09_GENERAL },
+ { 0x1A, 2, "ADCA", IND, M6x09_GENERAL },
+ { 0x1B, 2, "ADCB", IND, M6x09_GENERAL },
+ { 0x1C, 2, "SUBA", IMM, M6x09_GENERAL },
+ { 0x1D, 2, "SUBB", IMM, M6x09_GENERAL },
+ { 0x1E, 2, "SUBA", IND, M6x09_GENERAL },
+ { 0x1F, 2, "SUBB", IND, M6x09_GENERAL },
+
+ { 0x20, 2, "SBCA", IMM, M6x09_GENERAL },
+ { 0x21, 2, "SBCB", IMM, M6x09_GENERAL },
+ { 0x22, 2, "SBCA", IND, M6x09_GENERAL },
+ { 0x23, 2, "SBCB", IND, M6x09_GENERAL },
+ { 0x24, 2, "ANDA", IMM, M6x09_GENERAL },
+ { 0x25, 2, "ANDB", IMM, M6x09_GENERAL },
+ { 0x26, 2, "ANDA", IND, M6x09_GENERAL },
+ { 0x27, 2, "ANDB", IND, M6x09_GENERAL },
+ { 0x28, 2, "BITA", IMM, M6x09_GENERAL },
+ { 0x29, 2, "BITB", IMM, M6x09_GENERAL },
+ { 0x2A, 2, "BITA", IND, M6x09_GENERAL },
+ { 0x2B, 2, "BITB", IND, M6x09_GENERAL },
+ { 0x2C, 2, "EORA", IMM, M6x09_GENERAL },
+ { 0x2D, 2, "EORB", IMM, M6x09_GENERAL },
+ { 0x2E, 2, "EORA", IND, M6x09_GENERAL },
+ { 0x2F, 2, "EORB", IND, M6x09_GENERAL },
+
+ { 0x30, 2, "ORA", IMM, M6x09_GENERAL },
+ { 0x31, 2, "ORB", IMM, M6x09_GENERAL },
+ { 0x32, 2, "ORA", IND, M6x09_GENERAL },
+ { 0x33, 2, "ORB", IND, M6x09_GENERAL },
+ { 0x34, 2, "CMPA", IMM, M6x09_GENERAL },
+ { 0x35, 2, "CMPB", IMM, M6x09_GENERAL },
+ { 0x36, 2, "CMPA", IND, M6x09_GENERAL },
+ { 0x37, 2, "CMPB", IND, M6x09_GENERAL },
+ { 0x38, 2, "SETLINES", IMM, M6x09_GENERAL },
+ { 0x39, 2, "SETLINES", IND, M6x09_GENERAL },
+ { 0x3A, 2, "STA", IND, M6x09_GENERAL },
+ { 0x3B, 2, "STB", IND, M6x09_GENERAL },
+ { 0x3C, 2, "ANDCC", IMM, M6x09_GENERAL },
+ { 0x3D, 2, "ORCC", IMM, M6x09_GENERAL },
+ { 0x3E, 2, "EXG", IMM_RR, M6x09_GENERAL },
+ { 0x3F, 2, "TFR", IMM_RR, M6x09_GENERAL },
+
+ { 0x40, 3, "LDD", IMM, M6x09_GENERAL },
+ { 0x41, 2, "LDD", IND, M6x09_GENERAL },
+ { 0x42, 3, "LDX", IMM, M6x09_GENERAL },
+ { 0x43, 2, "LDX", IND, M6x09_GENERAL },
+ { 0x44, 3, "LDY", IMM, M6x09_GENERAL },
+ { 0x45, 2, "LDY", IND, M6x09_GENERAL },
+ { 0x46, 3, "LDU", IMM, M6x09_GENERAL },
+ { 0x47, 2, "LDU", IND, M6x09_GENERAL },
+ { 0x48, 3, "LDS", IMM, M6x09_GENERAL },
+ { 0x49, 2, "LDS", IND, M6x09_GENERAL },
+ { 0x4A, 3, "CMPD", IMM, M6x09_GENERAL },
+ { 0x4B, 2, "CMPD", IND, M6x09_GENERAL },
+ { 0x4C, 3, "CMPX", IMM, M6x09_GENERAL },
+ { 0x4D, 2, "CMPX", IND, M6x09_GENERAL },
+ { 0x4E, 3, "CMPY", IMM, M6x09_GENERAL },
+ { 0x4F, 2, "CMPY", IND, M6x09_GENERAL },
+
+ { 0x50, 3, "CMPU", IMM, M6x09_GENERAL },
+ { 0x51, 2, "CMPU", IND, M6x09_GENERAL },
+ { 0x52, 3, "CMPS", IMM, M6x09_GENERAL },
+ { 0x53, 2, "CMPS", IND, M6x09_GENERAL },
+ { 0x54, 3, "ADDD", IMM, M6x09_GENERAL },
+ { 0x55, 2, "ADDD", IND, M6x09_GENERAL },
+ { 0x56, 3, "SUBD", IMM, M6x09_GENERAL },
+ { 0x57, 2, "SUBD", IND, M6x09_GENERAL },
+ { 0x58, 2, "STD", IND, M6x09_GENERAL },
+ { 0x59, 2, "STX", IND, M6x09_GENERAL },
+ { 0x5A, 2, "STY", IND, M6x09_GENERAL },
+ { 0x5B, 2, "STU", IND, M6x09_GENERAL },
+ { 0x5C, 2, "STS", IND, M6x09_GENERAL },
+
+ { 0x60, 2, "BRA", REL, M6x09_GENERAL },
+ { 0x61, 2, "BHI", REL, M6x09_GENERAL },
+ { 0x62, 2, "BCC", REL, M6x09_GENERAL },
+ { 0x63, 2, "BNE", REL, M6x09_GENERAL },
+ { 0x64, 2, "BVC", REL, M6x09_GENERAL },
+ { 0x65, 2, "BPL", REL, M6x09_GENERAL },
+ { 0x66, 2, "BGE", REL, M6x09_GENERAL },
+ { 0x67, 2, "BGT", REL, M6x09_GENERAL },
+ { 0x68, 3, "LBRA", LREL, M6x09_GENERAL },
+ { 0x69, 3, "LBHI", LREL, M6x09_GENERAL },
+ { 0x6A, 3, "LBCC", LREL, M6x09_GENERAL },
+ { 0x6B, 3, "LBNE", LREL, M6x09_GENERAL },
+ { 0x6C, 3, "LBVC", LREL, M6x09_GENERAL },
+ { 0x6D, 3, "LBPL", LREL, M6x09_GENERAL },
+ { 0x6E, 3, "LBGE", LREL, M6x09_GENERAL },
+ { 0x6F, 3, "LBGT", LREL, M6x09_GENERAL },
+
+ { 0x70, 2, "BRN", REL, M6x09_GENERAL },
+ { 0x71, 2, "BLS", REL, M6x09_GENERAL },
+ { 0x72, 2, "BCS", REL, M6x09_GENERAL },
+ { 0x73, 2, "BEQ", REL, M6x09_GENERAL },
+ { 0x74, 2, "BVS", REL, M6x09_GENERAL },
+ { 0x75, 2, "BMI", REL, M6x09_GENERAL },
+ { 0x76, 2, "BLT", REL, M6x09_GENERAL },
+ { 0x77, 2, "BLE", REL, M6x09_GENERAL },
+ { 0x78, 3, "LBRN", LREL, M6x09_GENERAL },
+ { 0x79, 3, "LBLS", LREL, M6x09_GENERAL },
+ { 0x7A, 3, "LBCS", LREL, M6x09_GENERAL },
+ { 0x7B, 3, "LBEQ", LREL, M6x09_GENERAL },
+ { 0x7C, 3, "LBVS", LREL, M6x09_GENERAL },
+ { 0x7D, 3, "LBMI", LREL, M6x09_GENERAL },
+ { 0x7E, 3, "LBLT", LREL, M6x09_GENERAL },
+ { 0x7F, 3, "LBLE", LREL, M6x09_GENERAL },
+
+ { 0x80, 1, "CLRA", INH, M6x09_GENERAL },
+ { 0x81, 1, "CLRB", INH, M6x09_GENERAL },
+ { 0x82, 2, "CLR", IND, M6x09_GENERAL },
+ { 0x83, 1, "COMA", INH, M6x09_GENERAL },
+ { 0x84, 1, "COMB", INH, M6x09_GENERAL },
+ { 0x85, 2, "COM", IND, M6x09_GENERAL },
+ { 0x86, 1, "NEGA", INH, M6x09_GENERAL },
+ { 0x87, 1, "NEGB", INH, M6x09_GENERAL },
+ { 0x88, 2, "NEG", IND, M6x09_GENERAL },
+ { 0x89, 1, "INCA", INH, M6x09_GENERAL },
+ { 0x8A, 1, "INCB", INH, M6x09_GENERAL },
+ { 0x8B, 2, "INC", IND, M6x09_GENERAL },
+ { 0x8C, 1, "DECA", INH, M6x09_GENERAL },
+ { 0x8D, 1, "DECB", INH, M6x09_GENERAL },
+ { 0x8E, 2, "DEC", IND, M6x09_GENERAL },
+ { 0x8F, 1, "RTS", INH , M6x09_GENERAL },
+
+ { 0x90, 1, "TSTA", INH, M6x09_GENERAL },
+ { 0x91, 1, "TSTB", INH, M6x09_GENERAL },
+ { 0x92, 2, "TST", IND, M6x09_GENERAL },
+ { 0x93, 1, "LSRA", INH, M6x09_GENERAL },
+ { 0x94, 1, "LSRB", INH, M6x09_GENERAL },
+ { 0x95, 2, "LSR", IND, M6x09_GENERAL },
+ { 0x96, 1, "RORA", INH, M6x09_GENERAL },
+ { 0x97, 1, "RORB", INH, M6x09_GENERAL },
+ { 0x98, 2, "ROR", IND, M6x09_GENERAL },
+ { 0x99, 1, "ASRA", INH, M6x09_GENERAL },
+ { 0x9A, 1, "ASRB", INH, M6x09_GENERAL },
+ { 0x9B, 2, "ASR", IND, M6x09_GENERAL },
+ { 0x9C, 1, "ASLA", INH, M6x09_GENERAL },
+ { 0x9D, 1, "ASLB", INH, M6x09_GENERAL },
+ { 0x9E, 2, "ASL", IND, M6x09_GENERAL },
+ { 0x9F, 1, "RTI", INH , M6x09_GENERAL },
+
+ { 0xA0, 1, "ROLA", INH, M6x09_GENERAL },
+ { 0xA1, 1, "ROLB", INH, M6x09_GENERAL },
+ { 0xA2, 2, "ROL", IND, M6x09_GENERAL },
+ { 0xA3, 2, "LSRW", IND, M6x09_GENERAL },
+ { 0xA4, 2, "RORW", IND, M6x09_GENERAL },
+ { 0xA5, 2, "ASRW", IND, M6x09_GENERAL },
+ { 0xA6, 2, "ASLW", IND, M6x09_GENERAL },
+ { 0xA7, 2, "ROLW", IND, M6x09_GENERAL },
+ { 0xA8, 2, "JMP", IND, M6x09_GENERAL },
+ { 0xA9, 2, "JSR", IND, M6x09_GENERAL, DASMFLAG_STEP_OVER },
+ { 0xAA, 2, "BSR", REL, M6x09_GENERAL, DASMFLAG_STEP_OVER },
+ { 0xAB, 3, "LBSR", LREL, M6x09_GENERAL, DASMFLAG_STEP_OVER },
+ { 0xAC, 2, "DECB,JNZ", REL, M6x09_GENERAL },
+ { 0xAD, 2, "DECX,JNZ", REL, M6x09_GENERAL },
+ { 0xAE, 1, "NOP", INH, M6x09_GENERAL },
+
+ { 0xB0, 1, "ABX", INH, M6x09_GENERAL },
+ { 0xB1, 1, "DAA", INH, M6x09_GENERAL },
+ { 0xB2, 1, "SEX", INH, M6x09_GENERAL },
+ { 0xB3, 1, "MUL", INH, M6x09_GENERAL },
+ { 0xB4, 1, "LMUL", INH, M6x09_GENERAL },
+ { 0xB5, 1, "DIV X,B", INH, M6x09_GENERAL },
+ { 0xB6, 1, "BMOVE Y,X,U", INH , M6x09_GENERAL },
+ { 0xB7, 1, "MOVE Y,X,U", INH , M6x09_GENERAL },
+ { 0xB8, 2, "LSRD", IMM, M6x09_GENERAL },
+ { 0xB9, 2, "LSRD", IND, M6x09_GENERAL },
+ { 0xBA, 2, "RORD", IMM, M6x09_GENERAL },
+ { 0xBB, 2, "RORD", IND, M6x09_GENERAL },
+ { 0xBC, 2, "ASRD", IMM, M6x09_GENERAL },
+ { 0xBD, 2, "ASRD", IND, M6x09_GENERAL },
+ { 0xBE, 2, "ASLD", IMM, M6x09_GENERAL },
+ { 0xBF, 2, "ASLD", IND, M6x09_GENERAL },
+
+ { 0xC0, 2, "ROLD", IMM, M6x09_GENERAL },
+ { 0xC1, 2, "ROLD", IND, M6x09_GENERAL },
+ { 0xC2, 1, "CLRD", INH, M6x09_GENERAL },
+ { 0xC3, 2, "CLRW", IND, M6x09_GENERAL },
+ { 0xC4, 1, "NEGD", INH, M6x09_GENERAL },
+ { 0xC5, 2, "NEGW", IND, M6x09_GENERAL },
+ { 0xC6, 1, "INCD", INH, M6x09_GENERAL },
+ { 0xC7, 2, "INCW", IND, M6x09_GENERAL },
+ { 0xC8, 1, "DECD", INH, M6x09_GENERAL },
+ { 0xC9, 2, "DECW", IND, M6x09_GENERAL },
+ { 0xCA, 1, "TSTD", INH, M6x09_GENERAL },
+ { 0xCB, 2, "TSTW", IND, M6x09_GENERAL },
+ { 0xCC, 1, "ABSA", INH, M6x09_GENERAL },
+ { 0xCD, 1, "ABSB", INH, M6x09_GENERAL },
+ { 0xCE, 1, "ABSD", INH, M6x09_GENERAL },
+ { 0xCF, 1, "BSET A,X,U", INH, M6x09_GENERAL },
+
+ { 0xD0, 1, "BSET D,X,U", INH, M6x09_GENERAL }
+};
- case 0x8b: // (+/- D),R
- util::stream_format(stream, "D,%s", m6x09_regs[reg]);
- break;
- case 0x8c: // (+/- 7 bit offset),PC
- offset = (int8_t)opram[p++];
- util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
- util::stream_format(stream, "$%02X,PC", (offset < 0) ? -offset : offset);
- break;
+// ======================> konami_disassembler
- case 0x8d: // (+/- 15 bit offset),PC
- offset = (int16_t)((opram[p+0] << 8) + opram[p+1]);
- p += 2;
- util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
- util::stream_format(stream, "$%04X,PC", (offset < 0) ? -offset : offset);
- break;
+namespace
+{
+ // Konami disassembler
+ class konami_disassembler : public m6x09_disassembler_base
+ {
+ public:
+ konami_disassembler()
+ : m6x09_disassembler_base(konami_opcodes, ARRAY_LENGTH(konami_opcodes), M6x09_GENERAL) { }
- case 0x8e: // (+/- W),R
- util::stream_format(stream, "W,%s", m6x09_regs[reg]);
- break;
+ protected:
+ virtual void indirect(std::ostream &stream, uint8_t pb, const uint8_t *opram, int &p) override;
+ virtual void register_register(std::ostream &stream, uint8_t pb) override;
+ };
+};
+
+
+//-------------------------------------------------
+// indirect addressing mode for Konami
+//-------------------------------------------------
+
+void konami_disassembler::indirect(std::ostream &stream, uint8_t mode, const uint8_t *opram, int &p)
+{
+ static const char index_reg[8][3] =
+ {
+ "?", /* 0 - extended mode */
+ "?", /* 1 */
+ "x", /* 2 */
+ "y", /* 3 */
+ "?", /* 4 - direct page */
+ "u", /* 5 */
+ "s", /* 6 */
+ "pc" /* 7 - pc */
+ };
- case 0x8f: // address or operations relative to W
- if (indirect)
+ int idx = (mode >> 4) & 7;
+ int type = mode & 0x0f;
+ int val;
+
+ // special modes
+ if (mode & 0x80)
+ {
+ if (type & 8)
+ {
+ // indirect
+ switch (type & 7)
{
- ea = (uint16_t)((opram[p+0] << 8) + opram[p+1]);
- p += 2;
- util::stream_format(stream, "$%04X", ea);
+ case 0x00: /* register a */
+ util::stream_format(stream, "[a,%s]", index_reg[idx]);
break;
- }
- else
- {
- switch (reg)
- {
- case 0x00:
- util::stream_format(stream, ",W");
- break;
- case 0x01:
- offset = (int16_t)((opram[p+0] << 8) + opram[p+1]);
- p += 2;
- util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
- util::stream_format(stream, "$%04X,W", (offset < 0) ? -offset : offset);
- break;
- case 0x02:
- util::stream_format(stream, ",W++");
- break;
- case 0x03:
- util::stream_format(stream, ",--W");
- break;
- }
- }
- break;
- default: // (+/- 4 bit offset),R
- offset = pb & 0x1f;
- if (offset > 15)
- offset = offset - 32;
- util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
- util::stream_format(stream, "$%X,", (offset < 0) ? -offset : offset);
- util::stream_format(stream, "%s", m6x09_regs[reg]);
- break;
+ case 0x01: /* register b */
+ util::stream_format(stream, "[b,%s]", index_reg[idx]);
+ break;
+
+ case 0x04: /* direct - mode */
+ util::stream_format(stream, "[$%02x]", opram[p++]);
+ break;
+
+ case 0x07: /* register d */
+ util::stream_format(stream, "[d,%s]", index_reg[idx]);
+ break;
+
+ default:
+ util::stream_format(stream, "[?,%s]", index_reg[idx]);
+ break;
+ }
}
+ else {
+ switch (type & 7) {
+ case 0x00: /* register a */
+ util::stream_format(stream, "a,%s", index_reg[idx]);
+ break;
- // close brackets if indirect
- if (indirect && pbm != 0x82)
- util::stream_format(stream, "]");
- break;
+ case 0x01: /* register b */
+ util::stream_format(stream, "b,%s", index_reg[idx]);
+ break;
- case IMM:
- if (numoperands == 4)
- {
- ea = (operandarray[0] << 24) + (operandarray[1] << 16) + (operandarray[2] << 8) + operandarray[3];
- util::stream_format(stream, "#$%08X", ea);
+ case 0x04: /* direct - mode */
+ util::stream_format(stream, "$%02x", opram[p++]);
+ break;
+
+ case 0x07: /* register d */
+ util::stream_format(stream, "d,%s", index_reg[idx]);
+ break;
+
+ default:
+ util::stream_format(stream, "????,%s", index_reg[idx]);
+ break;
+ }
}
- else
- if (numoperands == 2)
+ }
+ else
+ {
+ if (type & 8)
{
- ea = (operandarray[0] << 8) + operandarray[1];
- util::stream_format(stream, "#$%04X", ea);
+ // indirect
+ switch (type & 7)
+ {
+ case 0: // auto increment
+ util::stream_format(stream, "[,%s+]", index_reg[idx]);
+ break;
+
+ case 1: // auto increment double
+ util::stream_format(stream, "[,%s++]", index_reg[idx]);
+ break;
+
+ case 2: // auto decrement
+ util::stream_format(stream, "[,-%s]", index_reg[idx]);
+ break;
+
+ case 3: // auto decrement double
+ util::stream_format(stream, "[,--%s]", index_reg[idx]);
+ break;
+
+ case 4: // post byte offset
+ val = opram[p++];
+
+ if (val & 0x80)
+ util::stream_format(stream, "[#$-%02x,%s]", 0x100 - val, index_reg[idx]);
+ else
+ util::stream_format(stream, "[#$%02x,%s]", val, index_reg[idx]);
+ break;
+
+ case 5: // post word offset
+ val = opram[p++] << 8;
+ val |= opram[p++];
+
+ if (val & 0x8000)
+ util::stream_format(stream, "[#$-%04x,%s]", 0x10000 - val, index_reg[idx]);
+ else
+ util::stream_format(stream, "[#$%04x,%s]", val, index_reg[idx]);
+ break;
+
+ case 6: // simple
+ util::stream_format(stream, "[,%s]", index_reg[idx]);
+ break;
+
+ case 7: // extended
+ val = opram[p++] << 8;
+ val |= opram[p++];
+
+ util::stream_format(stream, "[$%04x]", val);
+ break;
+ }
}
else
- if (numoperands == 1)
{
- ea = operandarray[0];
- util::stream_format(stream, "#$%02X", ea);
- }
- break;
+ switch (type & 7)
+ {
+ case 0: // auto increment
+ util::stream_format(stream, ",%s+", index_reg[idx]);
+ break;
- case IMM_RR:
- pb = operandarray[0];
- util::stream_format(stream, "%s,%s", teregs[(pb >> 4) & 0xf], teregs[pb & 0xf]);
- break;
+ case 1: // auto increment double
+ util::stream_format(stream, ",%s++", index_reg[idx]);
+ break;
- case IMM_BW:
- pb = operandarray[0];
- util::stream_format(stream, "%s,", m6x09_btwregs[((pb & 0xc0) >> 6)]);
- util::stream_format(stream, "%d,", (pb & 0x38) >> 3);
- util::stream_format(stream, "%d,", (pb & 0x07));
- util::stream_format(stream, "$%02X", operandarray[1]);
- break;
+ case 2: // auto decrement
+ util::stream_format(stream, ",-%s", index_reg[idx]);
+ break;
- case IMM_TFM:
- pb = operandarray[0];
- util::stream_format(stream, tfm_s[opcode & 0x07], hd6309_tfmregs[(pb >> 4) & 0xf], hd6309_tfmregs[pb & 0xf]);
- break;
- }
+ case 3: // auto decrement double
+ util::stream_format(stream, ",--%s", index_reg[idx]);
+ break;
+
+ case 4: // post byte offset
+ val = opram[p++];
+
+ if (val & 0x80)
+ util::stream_format(stream, "#$-%02x,%s", 0x100 - val, index_reg[idx]);
+ else
+ util::stream_format(stream, "#$%02x,%s", val, index_reg[idx]);
+ break;
- return p | flags | DASMFLAG_SUPPORTED;
+ case 5: // post word offset
+ val = opram[p++] << 8;
+ val |= opram[p++];
+
+ if (val & 0x8000)
+ util::stream_format(stream, "#$-%04x,%s", 0x10000 - val, index_reg[idx]);
+ else
+ util::stream_format(stream, "#$%04x,%s", val, index_reg[idx]);
+ break;
+
+ case 6: // simple
+ util::stream_format(stream, ",%s", index_reg[idx]);
+ break;
+
+ case 7: // extended
+ val = opram[p++] << 8;
+ val |= opram[p++];
+
+ util::stream_format(stream, "$%04x", val);
+ break;
+ }
+ }
+ }
}
//-------------------------------------------------
-// M6809 disassembler
+// Konami register/register parameter
//-------------------------------------------------
-CPU_DISASSEMBLE(m6809)
+void konami_disassembler::register_register(std::ostream &stream, uint8_t pb)
{
- static const char m6809_teregs[16][4] =
+ static const char konami_teregs[8] =
{
- "D", "X", "Y", "U", "S", "PC", "inv", "inv",
- "A", "B", "CC", "DP", "inv", "inv", "inv", "inv"
+ 'A', 'B', 'X', 'Y', 'S', 'U', '?', '?'
};
- std::ostringstream stream;
- offs_t result = internal_m6x09_disassemble(stream, pc, oprom, opram, M6x09_GENERAL, m6809_teregs);
- std::string stream_str = stream.str();
- strcpy(buffer, stream_str.c_str());
- return result;
+ util::stream_format(stream, "%c,%c",
+ konami_teregs[(pb >> 0) & 0x7],
+ konami_teregs[(pb >> 4) & 0x7]);
}
//-------------------------------------------------
-// HD6309 disassembler
+// Konami disassembler entry point
//-------------------------------------------------
-CPU_DISASSEMBLE(hd6309)
+CPU_DISASSEMBLE(konami)
{
- static const char hd6309_teregs[16][4] =
- {
- "D", "X", "Y", "U", "S", "PC", "W", "V",
- "A", "B", "CC", "DP", "0", "0", "E", "F"
- };
- std::ostringstream stream;
- offs_t result = internal_m6x09_disassemble(stream, pc, oprom, opram, HD6309_EXCLUSIVE, hd6309_teregs);
- std::string stream_str = stream.str();
- strcpy(buffer, stream_str.c_str());
- return result;
+ konami_disassembler disasm;
+ return disasm.disassemble(buffer, pc, oprom, opram);
}
diff --git a/src/devices/cpu/m6809/knmidasm.cpp b/src/devices/cpu/m6809/knmidasm.cpp
deleted file mode 100644
index f4de8a22048..00000000000
--- a/src/devices/cpu/m6809/knmidasm.cpp
+++ /dev/null
@@ -1,1872 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nathan Woods
-#include "emu.h"
-#include "debugger.h"
-#include "konami.h"
-
-/*
-
-0x08 leax indexed
-0x09 leay indexed (not confirmed)
-0x0a leau indexed
-0x0b leas indexed (not confirmed)
-
-0x0c pushs xx
-0x0d pushu xx (not confirmed)
-0x0e pulls xx
-0x0f pulls xx (not confirmed)
-
-0x10 lda xx
-0x11 ldb xx
-0x12 lda indexed
-0x13 ldb indexed
-
-0x14 adda xx
-0x15 addb xx (not confirmed)
-0x16 adda indexed (not confirmed)
-0x17 addb indexed
-
-0x18 adca xx
-0x19 adcb xx (not confirmed)
-0x1a adca indexed (not confirmed)
-0x1b adcb indexed (not confirmed)
-
-0x1c suba xx
-0x1d subb xx
-0x1e suba indexed
-0x1f subb indexed
-
-0x20 sbca xx
-0x21 sbcb xx
-0x22 sbca indexed
-0x23 sbcb indexed
-
-0x24 anda xx
-0x25 andb xx
-0x26 anda indexed
-0x27 andb indexed
-
-0x28 bita xx
-0x29 bitb xx
-0x2a bita indexed
-0x2b bitb indexed
-
-0x2c eora xx
-0x2d eorb xx
-0x2e eora indexed
-0x2f eorb indexed
-
-0x30 ora xx
-0x31 orb xx
-0x32 ora indexed
-0x33 orb indexed
-
-0x34 cmpa xx
-0x35 cmpb xx
-0x36 cmpa indexed
-0x37 cmpb indexed
-
-CUSTOM OPCODE: Set Address lines 16-23
---------------------------------------
-0x38 setlines xx
-0x39 setlines indexed
-
-The eight bits taken as parameter set address lines 16 to 23.
-
-
-0x3a sta indexed
-0x3b stb indexed
-0x3c andcc
-0x3d orcc
-
-0x3e exg xx
-0x3f tfr xx
-
-0x40 ldd xx xx
-0x41 ldd indexed
-0x42 ldx xx xx
-0x43 ldx indexed
-0x44 ldy xx xx
-0x45 ldy indexed (not confirmed)
-0x46 ldu xx xx
-0x47 ldu indexed
-0x48 lds xx xx
-0x49 lds indexed (not confirmed)
-
-0x4a cmpd xx xx
-0x4b cmpd indexed
-0x4c cmpx xx xx
-0x4d cmpx indexed
-0x4e cmpy xx xx (not confirmed)
-0x4f cmpy indexed (not confirmed)
-0x50 cmpu xx xx (not confirmed)
-0x51 cmpu indexed (not confirmed)
-0x52 cmps xx xx (not confirmed)
-0x53 cmps indexed (not confirmed)
-
-0x54 addd xx xx
-0x55 addd indexed (not confirmed)
-0x56 subd xx xx
-0x57 subd indexed (not confirmed)
-
-0x58 std indexed
-0x59 stx indexed
-0x5a sty indexed
-0x5b stu indexed
-0x5c sts indexed (not confirmed)
-
-
-BRANCH OPCODE TABLE :
----------------------
-
-Opcode M6809 Konami
-BRA 20 60
-BRN 21 70
-BHI 22 61
-BLS 23 71
-BCC 24 62
-BCS 25 72
-BNE 26 63
-BEQ 27 73
-BVC 28 64
-BVS 29 74
-BPL 2a 65
-BMI 2b 75
-BGE 2c 66
-BLT 2d 76
-BGT 2e 67
-BLE 2f 77
-
-Long versions of the branchs are the number + 8.
-
-0x80 clra
-0x81 clrb
-0x82 clr indexed
-
-0x83 coma
-0x84 comb
-0x85 com indexed
-
-0x86 nega (not confirmed)
-0x87 negb (not confirmed)
-0x88 neg indexed (not confirmed)
-
-0x89 inca
-0x8a incb (not confirmed)
-0x8b inc indexed
-
-0x8c deca
-0x8d decb
-0x8e dec indexed
-
-0x8f rts
-
-0x90 tsta (not confirmed)
-0x91 tstb (not confirmed)
-0x92 tst indexed (not confirmed)
-
-0x93 lsra
-0x94 lsrb
-0x95 lsr indexed
-
-0x96 rora
-0x97 rorb
-0x98 ror indexed
-
-0x99 asra
-0x9a asrb
-0x9b asr indexed
-
-0x9c asla
-0x9d aslb
-0x9e asl indexed
-
-0x9f rti
-
-0xa0 rola
-0xa1 rolb
-0xa2 rol indexed
-
-0xa3 lsrw indexed ( not confirmed )
-0xa4 rorw indexed ( not confirmed )
-0xa5 asrw indexed ( not confirmed )
-0xa6 aslw indexed ( not confirmed )
-0xa7 rolw indexed ( not confirmed )
-
-0xa8 jmp indexed
-0xa9 jsr indexed
-0xaa bsr xx
-0xab lbsr xx xx
-0xac decb,jnz xx
-0xad decx,jnz xx
-0xae nop
-
-0xb0 abx
-0xb1 daa
-0xb2 sex
-
-0xb3 mul
-
-0xb4 lmul x:y = x * y
-
-0xb5 divx x = ( x / b ), b = ( x % b )
-
-CUSTOM OPCODE: BlockMove (y,x,u):
----------------------------------
-0xb6 bmove y,x,u
-
-y = pointer to source address
-x = pointer to destination address
-u = bytes to move
-
-One byte is copied at a time and x and y get incremented for each access.
-
-CUSTOM OPCODE: Move (y,x,u):
----------------------------------
-0xb7 move y,x,u
-
-y = pointer to source address
-x = pointer to destination address
-u = counter
-
-Copy ONE byte, increment x and y, decrement u.
-
-0xb8 lsrd xx
-0xb9 lsrd indexed
-0xba rord xx ( not confirmed )
-0xbb rord indexed ( not confirmed )
-0xbc asrd xx ( not confirmed )
-0xbd asrd indexed ( not confirmed )
-0xbe asld xx
-0xbf asld indexed ( not confirmed )
-0xc0 rold xx ( not confirmed )
-0xc1 rold indexed ( not confirmed )
-
-0xc2 clrd
-0xc3 clrw indexed ( clears an entire word ) ( not confirmed )
-
-0xc4 negd (not confirmed )
-0xc5 negw indexed
-
-0xc6 incd (not confirmed )
-0xc7 incw indexed
-
-0xc8 decd (not confirmed )
-0xc9 decw indexed
-
-0xca tstd
-0xcb tstw indexed
-
-0xcc absa
-0xcd absb
-0xce absd
-
-CUSTOM OPCODE: BlockSet (a,x,u):
----------------------------------
-0xcf bset a,x,u
-
-a = source data
-x = pointer to destination address
-u = bytes to move
-
-One byte is copied at a time and x get incremented for each access.
-
-CUSTOM OPCODE: BlockSet (d,x,u): (not confirmed)
---------------------------------
-0xd0 bset d,x,u
-
-d = source data
-x = pointer to destination address
-u = bytes to move/2
-
-Two bytes are copied at a time and x get incremented twice for each access.
-
-*/
-
-static unsigned byte_count;
-static unsigned local_pc;
-static unsigned flags;
-
-static const unsigned char *opram_ptr;
-
-static unsigned char get_next_byte( void ) {
- return opram_ptr[byte_count++];
-}
-
-/* Table for indexed operations */
-static const char index_reg[8][3] = {
- "?", /* 0 - extended mode */
- "?", /* 1 */
- "x", /* 2 */
- "y", /* 3 */
- "?", /* 4 - direct page */
- "u", /* 5 */
- "s", /* 6 */
- "pc" /* 7 - pc */
-};
-
-/* Table for tfr/exg operations */
-static const char tfrexg_reg[8][3] = {
- "a", /* 0 */
- "b", /* 1 */
- "x", /* 2 */
- "y", /* 3 */
- "s", /* 4 */
- "u", /* 5 */
- "?", /* 6 */
- "?", /* 7 */
-};
-
-/* Table for stack S operations */
-static const char stack_reg_s[8][3] = {
- "cc",
- "a",
- "b",
- "dp",
- "x",
- "y",
- "u",
- "pc"
-};
-
-/* Table for stack U operations */
-static const char stack_reg_u[8][3] = {
- "cc",
- "a",
- "b",
- "dp",
- "x",
- "y",
- "s",
- "pc"
-};
-
-static void calc_indexed( unsigned char mode, char *buf ) {
- char buf2[30];
- int idx, type;
-
- idx = ( mode >> 4 ) & 7;
- type = mode & 0x0f;
-
- /* special modes */
- if ( mode & 0x80 ) {
- if ( type & 8 ) { /* indirect */
- switch ( type & 7 ) {
- case 0x00: /* register a */
- sprintf( buf2, "[a,%s]", index_reg[idx] );
- break;
-
- case 0x01: /* register b */
- sprintf( buf2, "[b,%s]", index_reg[idx] );
- break;
-
- case 0x04: /* direct - mode */
- sprintf( buf2, "[$%02x]", get_next_byte() );
- break;
-
- case 0x07: /* register d */
- sprintf( buf2, "[d,%s]", index_reg[idx] );
- break;
-
- default:
- sprintf( buf2, "[?,%s]", index_reg[idx] );
- break;
- }
- } else {
- switch ( type & 7 ) {
- case 0x00: /* register a */
- sprintf( buf2, "a,%s", index_reg[idx] );
- break;
-
- case 0x01: /* register b */
- sprintf( buf2, "b,%s", index_reg[idx] );
- break;
-
- case 0x04: /* direct - mode */
- sprintf( buf2, "$%02x", get_next_byte() );
- break;
-
- case 0x07: /* register d */
- sprintf( buf2, "d,%s", index_reg[idx] );
- break;
-
- default:
- sprintf( buf2, "????,%s", index_reg[idx] );
- break;
- }
- }
- } else {
- if ( type & 8 ) { /* indirect */
- switch ( type & 7 ) {
- case 0: /* auto increment */
- sprintf( buf2, "[,%s+]", index_reg[idx] );
- break;
-
- case 1: /* auto increment double */
- sprintf( buf2, "[,%s++]", index_reg[idx] );
- break;
-
- case 2: /* auto decrement */
- sprintf( buf2, "[,-%s]", index_reg[idx] );
- break;
-
- case 3: /* auto decrement double */
- sprintf( buf2, "[,--%s]", index_reg[idx] );
- break;
-
- case 4: /* post byte offset */
- {
- int val = get_next_byte();
-
- if ( val & 0x80 )
- sprintf( buf2, "[#$-%02x,%s]", 0x100 - val, index_reg[idx] );
- else
- sprintf( buf2, "[#$%02x,%s]", val, index_reg[idx] );
- }
- break;
-
- case 5: /* post word offset */
- {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- if ( val & 0x8000 )
- sprintf( buf2, "[#$-%04x,%s]", 0x10000 - val, index_reg[idx] );
- else
- sprintf( buf2, "[#$%04x,%s]", val, index_reg[idx] );
- }
- break;
-
- case 6: /* simple */
- sprintf( buf2, "[,%s]", index_reg[idx] );
- break;
-
- case 7: /* extended */
- {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf2, "[$%04x]", val );
- }
- break;
- }
- } else {
- switch ( type & 7 ) {
- case 0: /* auto increment */
- sprintf( buf2, ",%s+", index_reg[idx] );
- break;
-
- case 1: /* auto increment double */
- sprintf( buf2, ",%s++", index_reg[idx] );
- break;
-
- case 2: /* auto decrement */
- sprintf( buf2, ",-%s", index_reg[idx] );
- break;
-
- case 3: /* auto decrement double */
- sprintf( buf2, ",--%s", index_reg[idx] );
- break;
-
- case 4: /* post byte offset */
- {
- int val = get_next_byte();
-
- if ( val & 0x80 )
- sprintf( buf2, "#$-%02x,%s", 0x100 - val , index_reg[idx] );
- else
- sprintf( buf2, "#$%02x,%s", val, index_reg[idx] );
- }
- break;
-
- case 5: /* post word offset */
- {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- if ( val & 0x8000 )
- sprintf( buf2, "#$-%04x,%s", 0x10000 - val, index_reg[idx] );
- else
- sprintf( buf2, "#$%04x,%s", val, index_reg[idx] );
- }
- break;
-
- case 6: /* simple */
- sprintf( buf2, ",%s", index_reg[idx] );
- break;
-
- case 7: /* extended */
- {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf2, "$%04x", val );
- }
- break;
-
- }
- }
- }
-
- strcat( buf, buf2 );
-}
-
-static void do_relative( char *buf ) {
- char buf2[30];
- signed char offs = ( signed char )get_next_byte();
-
- sprintf( buf2, "$%04x (%d)", local_pc + byte_count + offs, (int)offs );
-
- strcat( buf, buf2 );
-}
-
-static void do_relative_word( char *buf ) {
- char buf2[30];
- signed short offs;
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- offs = ( signed short )val;
-
- sprintf( buf2, "$%04x (%d)", local_pc + byte_count + offs, (int)offs );
-
- strcat( buf, buf2 );
-}
-
-static void do_addressing( char *buf ) {
- unsigned char mode = get_next_byte();
-
- calc_indexed( mode, buf );
-}
-
-/*********************************************************************************
-
- Opcodes
-
-*********************************************************************************/
-
-static void illegal( char *buf ) {
- sprintf( buf, "illegal/unknown " );
-
-}
-
-static void leax( char *buf ) {
- sprintf( buf, "leax " );
- do_addressing( buf );
-}
-
-static void leay( char *buf ) {
- sprintf( buf, "leay " );
- do_addressing( buf );
-}
-
-static void leau( char *buf ) {
- sprintf( buf, "leau " );
- do_addressing( buf );
-}
-
-static void leas( char *buf ) {
- sprintf( buf, "leas " );
- do_addressing( buf );
-}
-
-static void lda( char *buf ) {
- sprintf( buf, "lda #$%02x", get_next_byte() );
-}
-
-static void ldb( char *buf ) {
- sprintf( buf, "ldb #$%02x", get_next_byte() );
-}
-
-static void lda2( char *buf ) {
- sprintf( buf, "lda " );
- do_addressing( buf );
-}
-
-static void ldb2( char *buf ) {
- sprintf( buf, "ldb " );
- do_addressing( buf );
-}
-
-static void adda( char *buf ) {
- sprintf( buf, "adda #$%02x", get_next_byte() );
-}
-
-static void addb( char *buf ) {
- sprintf( buf, "addb #$%02x", get_next_byte() );
-}
-
-static void adda2( char *buf ) {
- sprintf( buf, "adda " );
- do_addressing( buf );
-}
-
-static void addb2( char *buf ) {
- sprintf( buf, "addb " );
- do_addressing( buf );
-}
-
-static void suba( char *buf ) {
- sprintf( buf, "suba #$%02x", get_next_byte() );
-}
-
-static void subb( char *buf ) {
- sprintf( buf, "subb #$%02x", get_next_byte() );
-}
-
-static void suba2( char *buf ) {
- sprintf( buf, "suba " );
- do_addressing( buf );
-}
-
-static void subb2( char *buf ) {
- sprintf( buf, "subb " );
- do_addressing( buf );
-}
-
-static void sbca( char *buf ) {
- sprintf( buf, "sbca #$%02x", get_next_byte() );
-}
-
-static void sbcb( char *buf ) {
- sprintf( buf, "sbcb #$%02x", get_next_byte() );
-}
-
-static void sbca2( char *buf ) {
- sprintf( buf, "sbca " );
- do_addressing( buf );
-}
-
-static void sbcb2( char *buf ) {
- sprintf( buf, "sbcb " );
- do_addressing( buf );
-}
-
-static void adca( char *buf ) {
- sprintf( buf, "adca #$%02x", get_next_byte() );
-}
-
-static void adca2( char *buf ) {
- sprintf( buf, "adca " );
- do_addressing( buf );
-}
-
-static void adcb2( char *buf ) {
- sprintf( buf, "adcb " );
- do_addressing( buf );
-}
-
-static void adcb( char *buf ) {
- sprintf( buf, "adcb #$%02x", get_next_byte() );
-}
-
-static void anda( char *buf ) {
- sprintf( buf, "anda #$%02x", get_next_byte() );
-}
-
-static void andb( char *buf ) {
- sprintf( buf, "andb #$%02x", get_next_byte() );
-}
-
-static void anda2( char *buf ) {
- sprintf( buf, "anda " );
- do_addressing( buf );
-}
-
-static void andb2( char *buf ) {
- sprintf( buf, "andb " );
- do_addressing( buf );
-}
-
-static void bita( char *buf ) {
- sprintf( buf, "bita #$%02x", get_next_byte() );
-}
-
-static void bitb( char *buf ) {
- sprintf( buf, "bitb #$%02x", get_next_byte() );
-}
-
-static void bita2( char *buf ) {
- sprintf( buf, "bita " );
- do_addressing( buf );
-}
-
-static void bitb2( char *buf ) {
- sprintf( buf, "bitb " );
- do_addressing( buf );
-}
-
-static void eora( char *buf ) {
- sprintf( buf, "eora #$%02x", get_next_byte() );
-}
-
-static void eorb( char *buf ) {
- sprintf( buf, "eorb #$%02x", get_next_byte() );
-}
-
-static void eora2( char *buf ) {
- sprintf( buf, "eora " );
- do_addressing( buf );
-}
-
-static void eorb2( char *buf ) {
- sprintf( buf, "eorb " );
- do_addressing( buf );
-}
-
-static void ora( char *buf ) {
- sprintf( buf, "ora #$%02x", get_next_byte() );
-}
-
-static void orb( char *buf ) {
- sprintf( buf, "orb #$%02x", get_next_byte() );
-}
-
-static void ora2( char *buf ) {
- sprintf( buf, "ora " );
- do_addressing( buf );
-}
-
-static void orb2( char *buf ) {
- sprintf( buf, "orb " );
- do_addressing( buf );
-}
-
-static void cmpa( char *buf ) {
- sprintf( buf, "cmpa #$%02x", get_next_byte() );
-}
-
-static void cmpb( char *buf ) {
- sprintf( buf, "cmpb #$%02x", get_next_byte() );
-}
-
-static void cmpa2( char *buf ) {
- sprintf( buf, "cmpa " );
- do_addressing( buf );
-}
-
-static void cmpb2( char *buf ) {
- sprintf( buf, "cmpb " );
- do_addressing( buf );
-}
-
-static void setlines( char *buf ) {
- sprintf( buf, "setlines #$%02x", get_next_byte() );
-}
-
-static void setlines2( char *buf ) {
- sprintf( buf, "setlines " );
- do_addressing( buf );
-}
-
-static void sta2( char *buf ) {
- sprintf( buf, "sta " );
- do_addressing( buf );
-}
-
-static void stb2( char *buf ) {
- sprintf( buf, "stb " );
- do_addressing( buf );
-}
-
-static void ldd( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "ldd #$%04x", val );
-}
-
-static void ldd2( char *buf ) {
- sprintf( buf, "ldd " );
- do_addressing( buf );
-}
-
-static void ldx( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "ldx #$%04x", val );
-}
-
-static void ldx2( char *buf ) {
- sprintf( buf, "ldx " );
- do_addressing( buf );
-}
-
-static void ldy( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "ldy #$%04x", val );
-}
-
-static void ldy2( char *buf ) {
- sprintf( buf, "ldy " );
- do_addressing( buf );
-}
-
-static void ldu( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "ldu #$%04x", val );
-}
-
-static void ldu2( char *buf ) {
- sprintf( buf, "ldu " );
- do_addressing( buf );
-}
-
-static void lds( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "lds #$%04x", val );
-}
-
-static void lds2( char *buf ) {
- sprintf( buf, "lds " );
- do_addressing( buf );
-}
-
-static void cmpd( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "cmpd #$%04x", val );
-}
-
-static void cmpd2( char *buf ) {
- sprintf( buf, "cmpd " );
- do_addressing( buf );
-}
-
-static void cmpx( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "cmpx #$%04x", val );
-}
-
-static void cmpx2( char *buf ) {
- sprintf( buf, "cmpx " );
- do_addressing( buf );
-}
-
-static void cmpy( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "cmpy #$%04x", val );
-}
-
-static void cmpy2( char *buf ) {
- sprintf( buf, "cmpy " );
- do_addressing( buf );
-}
-
-static void cmpu( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "cmpu #$%04x", val );
-}
-
-static void cmpu2( char *buf ) {
- sprintf( buf, "cmpu " );
- do_addressing( buf );
-}
-
-static void cmps( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "cmps #$%04x", val );
-}
-
-static void cmps2( char *buf ) {
- sprintf( buf, "cmps " );
- do_addressing( buf );
-}
-
-static void addd2( char *buf ) {
- sprintf( buf, "addd " );
- do_addressing( buf );
-}
-
-static void subd2( char *buf ) {
- sprintf( buf, "subd " );
- do_addressing( buf );
-}
-
-static void std2( char *buf ) {
- sprintf( buf, "std " );
- do_addressing( buf );
-}
-
-static void stx2( char *buf ) {
- sprintf( buf, "stx " );
- do_addressing( buf );
-}
-
-static void sty2( char *buf ) {
- sprintf( buf, "sty " );
- do_addressing( buf );
-}
-
-static void stu2( char *buf ) {
- sprintf( buf, "stu " );
- do_addressing( buf );
-}
-
-static void sts2( char *buf ) {
- sprintf( buf, "sts " );
- do_addressing( buf );
-}
-
-static void bra( char *buf ) {
- sprintf( buf, "bra " );
- do_relative( buf );
-}
-
-static void lbra( char *buf ) {
- sprintf( buf, "lbra " );
- do_relative_word( buf );
-}
-
-static void brn( char *buf ) {
- sprintf( buf, "brn " );
- do_relative( buf );
-}
-
-static void lbrn( char *buf ) {
- sprintf( buf, "lbrn " );
- do_relative_word( buf );
-}
-
-static void bhi( char *buf ) {
- sprintf( buf, "bhi " );
- do_relative( buf );
-}
-
-static void lbhi( char *buf ) {
- sprintf( buf, "lbhi " );
- do_relative_word( buf );
-}
-
-static void bls( char *buf ) {
- sprintf( buf, "bls " );
- do_relative( buf );
-}
-
-static void lbls( char *buf ) {
- sprintf( buf, "lbls " );
- do_relative_word( buf );
-}
-
-static void bcc( char *buf ) {
- sprintf( buf, "bcc " );
- do_relative( buf );
-}
-
-static void lbcc( char *buf ) {
- sprintf( buf, "lbcc " );
- do_relative_word( buf );
-}
-
-static void bcs( char *buf ) {
- sprintf( buf, "bcs " );
- do_relative( buf );
-}
-
-static void lbcs( char *buf ) {
- sprintf( buf, "lbcs " );
- do_relative_word( buf );
-}
-
-static void bne( char *buf ) {
- sprintf( buf, "bne " );
- do_relative( buf );
-}
-
-static void lbne( char *buf ) {
- sprintf( buf, "lbne " );
- do_relative_word( buf );
-}
-
-static void beq( char *buf ) {
- sprintf( buf, "beq " );
- do_relative( buf );
-}
-
-static void lbeq( char *buf ) {
- sprintf( buf, "lbeq " );
- do_relative_word( buf );
-}
-
-static void bvc( char *buf ) {
- sprintf( buf, "bvc " );
- do_relative( buf );
-}
-
-static void lbvc( char *buf ) {
- sprintf( buf, "lbvc " );
- do_relative_word( buf );
-}
-
-static void bvs( char *buf ) {
- sprintf( buf, "bvs " );
- do_relative( buf );
-}
-
-static void lbvs( char *buf ) {
- sprintf( buf, "lbvs " );
- do_relative_word( buf );
-}
-
-static void bpl( char *buf ) {
- sprintf( buf, "bpl " );
- do_relative( buf );
-}
-
-static void lbpl( char *buf ) {
- sprintf( buf, "lbpl " );
- do_relative_word( buf );
-}
-
-static void bmi( char *buf ) {
- sprintf( buf, "bmi " );
- do_relative( buf );
-}
-
-static void lbmi( char *buf ) {
- sprintf( buf, "lbmi " );
- do_relative_word( buf );
-}
-
-static void bge( char *buf ) {
- sprintf( buf, "bge " );
- do_relative( buf );
-}
-
-static void lbge( char *buf ) {
- sprintf( buf, "lbge " );
- do_relative_word( buf );
-}
-
-static void blt( char *buf ) {
- sprintf( buf, "blt " );
- do_relative( buf );
-}
-
-static void lblt( char *buf ) {
- sprintf( buf, "lblt " );
- do_relative_word( buf );
-}
-
-static void bgt( char *buf ) {
- sprintf( buf, "bgt " );
- do_relative( buf );
-}
-
-static void lbgt( char *buf ) {
- sprintf( buf, "lbgt " );
- do_relative_word( buf );
-}
-
-static void ble( char *buf ) {
- sprintf( buf, "ble " );
- do_relative( buf );
-}
-
-static void lble( char *buf ) {
- sprintf( buf, "lble " );
- do_relative_word( buf );
-}
-
-static void clra( char *buf ) {
- sprintf( buf, "clra" );
-}
-
-static void clrb( char *buf ) {
- sprintf( buf, "clrb" );
-}
-
-static void clrd( char *buf ) {
- sprintf( buf, "clrd" );
-}
-
-static void clrw( char *buf ) {
- sprintf( buf, "clrw " );
- do_addressing( buf );
-}
-
-static void negd( char *buf ) {
- sprintf( buf, "negd" );
-}
-
-static void negw( char *buf ) {
- sprintf( buf, "negw" );
- do_addressing( buf );
-}
-
-static void incd( char *buf ) {
- sprintf( buf, "incd" );
-}
-
-static void incw( char *buf ) {
- sprintf( buf, "incw " );
- do_addressing( buf );
-}
-
-static void decd( char *buf ) {
- sprintf( buf, "decd" );
-}
-
-static void decw( char *buf ) {
- sprintf( buf, "decw " );
- do_addressing( buf );
-}
-
-static void tstd( char *buf ) {
- sprintf( buf, "tstd " );
-}
-
-static void tstw( char *buf ) {
- sprintf( buf, "tstw " );
- do_addressing( buf );
-}
-
-static void clr2( char *buf ) {
- sprintf( buf, "clr " );
- do_addressing( buf );
-}
-
-static void coma( char *buf ) {
- sprintf( buf, "coma" );
-}
-
-static void comb( char *buf ) {
- sprintf( buf, "comb" );
-}
-
-static void com2( char *buf ) {
- sprintf( buf, "com " );
- do_addressing( buf );
-}
-
-static void nega( char *buf ) {
- sprintf( buf, "nega" );
-}
-
-static void negb( char *buf ) {
- sprintf( buf, "negb" );
-}
-
-static void neg2( char *buf ) {
- sprintf( buf, "neg " );
- do_addressing( buf );
-}
-
-static void inca( char *buf ) {
- sprintf( buf, "inca" );
-}
-
-static void incb( char *buf ) {
- sprintf( buf, "incb" );
-}
-
-static void inc2( char *buf ) {
- sprintf( buf, "inc " );
- do_addressing( buf );
-}
-
-static void deca( char *buf ) {
- sprintf( buf, "deca" );
-}
-
-static void decb( char *buf ) {
- sprintf( buf, "decb" );
-}
-
-static void dec2( char *buf ) {
- sprintf( buf, "dec " );
- do_addressing( buf );
-}
-
-static void rts( char *buf ) {
- sprintf( buf, "rts" );
- flags = DASMFLAG_STEP_OUT;
-}
-
-static void asla( char *buf ) {
- sprintf( buf, "asla" );
-}
-
-static void aslb( char *buf ) {
- sprintf( buf, "aslb" );
-}
-
-static void asl2( char *buf ) {
- sprintf( buf, "asl " );
- do_addressing( buf );
-}
-
-static void rora( char *buf ) {
- sprintf( buf, "rora" );
-}
-
-static void rorb( char *buf ) {
- sprintf( buf, "rorb" );
-}
-
-static void ror2( char *buf ) {
- sprintf( buf, "ror " );
- do_addressing( buf );
-}
-
-static void rti( char *buf ) {
- sprintf( buf, "rti" );
- flags = DASMFLAG_STEP_OUT;
-}
-
-static void jsr2( char *buf ) {
- sprintf( buf, "jsr " );
- do_addressing( buf );
- flags = DASMFLAG_STEP_OVER;
-}
-
-static void jmp2( char *buf ) {
- sprintf( buf, "jmp " );
- do_addressing( buf );
-}
-
-static void bsr( char *buf ) {
- sprintf( buf, "bsr " );
- do_relative( buf );
- flags = DASMFLAG_STEP_OVER;
-}
-
-static void lbsr( char *buf ) {
- sprintf( buf, "lbsr " );
- do_relative_word( buf );
- flags = DASMFLAG_STEP_OVER;
-}
-
-static void decbjnz( char *buf ) {
- sprintf( buf, "decb,jnz " );
- do_relative( buf );
- flags = DASMFLAG_STEP_OVER;
-}
-
-static void decxjnz( char *buf ) {
- sprintf( buf, "decx,jnz " );
- do_relative( buf );
- flags = DASMFLAG_STEP_OVER;
-}
-
-static void addd( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "addd #$%04x", val );
-}
-
-static void subd( char *buf ) {
- int val = get_next_byte() << 8;
-
- val |= get_next_byte();
-
- sprintf( buf, "subd #$%04x", val );
-}
-
-static void tsta( char *buf ) {
- sprintf( buf, "tsta" );
-}
-
-static void tstb( char *buf ) {
- sprintf( buf, "tstb" );
-}
-
-static void tst2( char *buf ) {
- sprintf( buf, "tst " );
- do_addressing( buf );
-}
-
-static void lsra( char *buf ) {
- sprintf( buf, "lsra" );
-}
-
-static void lsrb( char *buf ) {
- sprintf( buf, "lsrb" );
-}
-
-static void lsr2( char *buf ) {
- sprintf( buf, "lsr " );
- do_addressing( buf );
-}
-
-static void asra( char *buf ) {
- sprintf( buf, "asra" );
-}
-
-static void asrb( char *buf ) {
- sprintf( buf, "asrb" );
-}
-
-static void asr2( char *buf ) {
- sprintf( buf, "asr " );
- do_addressing( buf );
-}
-
-static void abx( char *buf ) {
- sprintf( buf, "abx" );
-}
-
-static void sex( char *buf ) {
- sprintf( buf, "sex" );
-}
-
-static void daa( char *buf ) {
- sprintf( buf, "daa" );
-}
-
-static void mul( char *buf ) {
- sprintf( buf, "mul" );
-}
-
-static void lmul( char *buf ) {
- sprintf( buf, "lmul" );
-}
-
-static void divx( char *buf ) {
- sprintf( buf, "div x,b" );
-}
-
-static void andcc( char *buf ) {
- sprintf( buf, "andcc #$%02x", get_next_byte() );
-}
-
-static void orcc( char *buf ) {
- sprintf( buf, "orcc #$%02x", get_next_byte() );
-}
-
-static void pushs( char *buf ) {
- int mask = get_next_byte(), i;
-
- sprintf( buf, "pushs " );
-
- for ( i = 0; i < 8; i++ ) {
- if ( ( mask >> i ) & 1 ) {
- strcat( buf, stack_reg_s[i] );
- mask &= ~( 1 << i );
- if ( mask )
- strcat( buf, "," );
- else
- return;
- }
- }
-}
-
-static void pushu( char *buf ) {
- int mask = get_next_byte(), i;
-
- sprintf( buf, "pushu " );
-
- for ( i = 0; i < 8; i++ ) {
- if ( ( mask >> i ) & 1 ) {
- strcat( buf, stack_reg_u[i] );
- mask &= ~( 1 << i );
- if ( mask )
- strcat( buf, "," );
- else
- return;
- }
- }
-}
-
-static void pulls( char *buf ) {
- int mask = get_next_byte(), i;
-
- sprintf( buf, "pulls " );
-
- for ( i = 0; i < 8; i++ ) {
- if ( ( mask >> i ) & 1 ) {
- strcat( buf, stack_reg_s[i] );
- if (i == 7)
- flags = DASMFLAG_STEP_OUT;
- mask &= ~( 1 << i );
- if ( mask )
- strcat( buf, "," );
- else
- return;
- }
- }
-}
-
-static void pullu( char *buf ) {
- int mask = get_next_byte(), i;
-
- sprintf( buf, "pullu " );
-
- for ( i = 0; i < 8; i++ ) {
- if ( ( mask >> i ) & 1 ) {
- strcat( buf, stack_reg_s[i] );
- mask &= ~( 1 << i );
- if ( mask )
- strcat( buf, "," );
- else
- return;
- }
- }
-}
-
-static void rola( char *buf ) {
- sprintf( buf, "rola" );
-}
-
-static void rolb( char *buf ) {
- sprintf( buf, "rolb" );
-}
-
-static void rol2( char *buf ) {
- sprintf( buf, "rol " );
- do_addressing( buf );
-}
-
-static void bmove( char *buf ) {
- sprintf( buf, "bmove y,x,u" );
-}
-
-static void move( char *buf ) {
- sprintf( buf, "move y,x,u" );
-}
-
-static void bset( char *buf ) {
- sprintf( buf, "bset a,x,u" );
-}
-
-static void bset2( char *buf ) {
- sprintf( buf, "bset d,x,u" );
-}
-
-static void nop( char *buf ) {
- sprintf( buf, "nop" );
-}
-
-static void tfr( char *buf ) {
- int mask = get_next_byte();
-
- sprintf( buf, "tfr " );
-
- strcat( buf, tfrexg_reg[ mask & 0x07 ] );
- strcat( buf, "," );
- strcat( buf, tfrexg_reg[ ( mask >> 4 ) & 0x07 ] );
-}
-
-static void exg( char *buf ) {
- int mask = get_next_byte();
-
- sprintf( buf, "exg " );
-
- strcat( buf, tfrexg_reg[ mask & 0x07 ] );
- strcat( buf, "," );
- strcat( buf, tfrexg_reg[ ( mask >> 4 ) & 0x07 ] );
-}
-
-static void lsrd( char *buf ) {
- sprintf( buf, "lsrd #$%02x", get_next_byte() );
-}
-
-static void lsrd2( char *buf ) {
- sprintf( buf, "lsrd " );
- do_addressing( buf );
-}
-
-static void rord( char *buf ) {
- sprintf( buf, "rord #$%02x", get_next_byte() );
-}
-
-static void rord2( char *buf ) {
- sprintf( buf, "rord " );
- do_addressing( buf );
-}
-
-static void asrd( char *buf ) {
- sprintf( buf, "asrd #$%02x", get_next_byte() );
-}
-
-static void asrd2( char *buf ) {
- sprintf( buf, "asrd " );
- do_addressing( buf );
-}
-
-static void asld( char *buf ) {
- sprintf( buf, "asld #$%02x", get_next_byte() );
-}
-
-static void asld2( char *buf ) {
- sprintf( buf, "asld " );
- do_addressing( buf );
-}
-
-static void rold( char *buf ) {
- sprintf( buf, "rold #$%02x", get_next_byte() );
-}
-
-static void rold2( char *buf ) {
- sprintf( buf, "rold " );
- do_addressing( buf );
-}
-
-static void lsrw( char *buf ) {
- sprintf( buf, "lsrw " );
- do_addressing( buf );
-}
-
-static void rorw( char *buf ) {
- sprintf( buf, "lsrw " );
- do_addressing( buf );
-}
-
-static void asrw( char *buf ) {
- sprintf( buf, "asrw " );
- do_addressing( buf );
-}
-
-static void aslw( char *buf ) {
- sprintf( buf, "aslw " );
- do_addressing( buf );
-}
-
-static void rolw( char *buf ) {
- sprintf( buf, "rolw " );
- do_addressing( buf );
-}
-
-static void absa( char *buf ) {
- sprintf( buf, "absa" );
-}
-
-static void absb( char *buf ) {
- sprintf( buf, "absb" );
-}
-
-static void absd( char *buf ) {
- sprintf( buf, "absd" );
-}
-
-/*********************************************************************************
-
- Opcode Table
-
-*********************************************************************************/
-
-struct konami_opcode_def {
- void (*decode)( char *buf );
- int confirmed;
-};
-
-static const konami_opcode_def op_table[256] = {
- /* 00 */ { illegal, 0 },
- /* 01 */ { illegal, 0 },
- /* 02 */ { illegal, 0 },
- /* 03 */ { illegal, 0 },
- /* 04 */ { illegal, 0 },
- /* 05 */ { illegal, 0 },
- /* 06 */ { illegal, 0 },
- /* 07 */ { illegal, 0 },
- /* 08 */ { leax, 1 },
- /* 09 */ { leay, 1 },
- /* 0a */ { leau, 1 },
- /* 0b */ { leas, 0 },
- /* 0c */ { pushs, 1 },
- /* 0d */ { pushu, 0 },
- /* 0e */ { pulls, 1 },
- /* 0f */ { pullu, 0 },
-
- /* 10 */ { lda, 1 },
- /* 11 */ { ldb, 1 },
- /* 12 */ { lda2, 1 },
- /* 13 */ { ldb2, 1 },
- /* 14 */ { adda, 1 },
- /* 15 */ { addb, 1 },
- /* 16 */ { adda2, 1 },
- /* 17 */ { addb2, 1 },
- /* 18 */ { adca, 1 },
- /* 19 */ { adcb, 1 },
- /* 1a */ { adca2, 1 },
- /* 1b */ { adcb2, 1 },
- /* 1c */ { suba, 1 },
- /* 1d */ { subb, 1 },
- /* 1e */ { suba2, 1 },
- /* 1f */ { subb2, 1 },
-
- /* 20 */ { sbca, 0 },
- /* 21 */ { sbcb, 0 },
- /* 22 */ { sbca2, 0 },
- /* 23 */ { sbcb2, 0 },
- /* 24 */ { anda, 1 },
- /* 25 */ { andb, 1 },
- /* 26 */ { anda2, 1 },
- /* 27 */ { andb2, 1 },
- /* 28 */ { bita, 0 },
- /* 29 */ { bitb, 0 },
- /* 2a */ { bita2, 0 },
- /* 2b */ { bitb2, 0 },
- /* 2c */ { eora, 0 },
- /* 2d */ { eorb, 0 },
- /* 2e */ { eora2, 0 },
- /* 2f */ { eorb2, 0 },
-
- /* 30 */ { ora, 1 },
- /* 31 */ { orb, 1 },
- /* 32 */ { ora2, 1 },
- /* 33 */ { orb2, 1 },
- /* 34 */ { cmpa, 1 },
- /* 35 */ { cmpb, 1 },
- /* 36 */ { cmpa2, 1 },
- /* 37 */ { cmpb2, 1 },
- /* 38 */ { setlines, 0 },
- /* 39 */ { setlines2, 0 },
- /* 3a */ { sta2, 1 },
- /* 3b */ { stb2, 1 },
- /* 3c */ { andcc, 1 },
- /* 3d */ { orcc, 0 },
- /* 3e */ { exg, 0 },
- /* 3f */ { tfr, 0 },
-
- /* 40 */ { ldd, 1 },
- /* 41 */ { ldd2, 1 },
- /* 42 */ { ldx, 1 },
- /* 43 */ { ldx2, 1 },
- /* 44 */ { ldy, 1 },
- /* 45 */ { ldy2, 1 },
- /* 46 */ { ldu, 1 },
- /* 47 */ { ldu2, 1 },
- /* 48 */ { lds, 1 },
- /* 49 */ { lds2, 1 },
- /* 4a */ { cmpd, 1 },
- /* 4b */ { cmpd2, 1 },
- /* 4c */ { cmpx, 1 },
- /* 4d */ { cmpx2, 1 },
- /* 4e */ { cmpy, 1 },
- /* 4f */ { cmpy2, 1 },
-
- /* 50 */ { cmpu, 1 },
- /* 51 */ { cmpu2, 1 },
- /* 52 */ { cmps, 1 },
- /* 53 */ { cmps2, 1 },
- /* 54 */ { addd, 0 },
- /* 55 */ { addd2, 0 },
- /* 56 */ { subd, 1 },
- /* 57 */ { subd2, 0 },
- /* 58 */ { std2, 1 },
- /* 59 */ { stx2, 1 },
- /* 5a */ { sty2, 1 },
- /* 5b */ { stu2, 1 },
- /* 5c */ { sts2, 1 },
- /* 5d */ { illegal, 0 },
- /* 5e */ { illegal, 0 },
- /* 5f */ { illegal, 0 },
-
- /* 60 */ { bra, 1 },
- /* 61 */ { bhi, 1 },
- /* 62 */ { bcc, 1 },
- /* 63 */ { bne, 1 },
- /* 64 */ { bvc, 1 },
- /* 65 */ { bpl, 1 },
- /* 66 */ { bge, 1 },
- /* 67 */ { bgt, 1 },
- /* 68 */ { lbra, 1 },
- /* 69 */ { lbhi, 1 },
- /* 6a */ { lbcc, 1 },
- /* 6b */ { lbne, 1 },
- /* 6c */ { lbvc, 1 },
- /* 6d */ { lbpl, 1 },
- /* 6e */ { lbge, 1 },
- /* 6f */ { lbgt, 1 },
-
- /* 70 */ { brn, 1 },
- /* 71 */ { bls, 1 },
- /* 72 */ { bcs, 1 },
- /* 73 */ { beq, 1 },
- /* 74 */ { bvs, 1 },
- /* 75 */ { bmi, 1 },
- /* 76 */ { blt, 1 },
- /* 77 */ { ble, 1 },
- /* 78 */ { lbrn, 1 },
- /* 79 */ { lbls, 1 },
- /* 7a */ { lbcs, 1 },
- /* 7b */ { lbeq, 1 },
- /* 7c */ { lbvs, 1 },
- /* 7d */ { lbmi, 1 },
- /* 7e */ { lblt, 1 },
- /* 7f */ { lble, 1 },
-
- /* 80 */ { clra, 1 },
- /* 81 */ { clrb, 1 },
- /* 82 */ { clr2, 1 },
- /* 83 */ { coma, 1 },
- /* 84 */ { comb, 0 },
- /* 85 */ { com2, 0 },
- /* 86 */ { nega, 0 },
- /* 87 */ { negb, 0 },
- /* 88 */ { neg2, 0 },
- /* 89 */ { inca, 1 },
- /* 8a */ { incb, 1 },
- /* 8b */ { inc2, 1 },
- /* 8c */ { deca, 1 },
- /* 8d */ { decb, 1 },
- /* 8e */ { dec2, 1 },
- /* 8f */ { rts, 1 },
-
- /* 90 */ { tsta, 0 },
- /* 91 */ { tstb, 0 },
- /* 92 */ { tst2, 0 },
- /* 93 */ { lsra, 1 },
- /* 94 */ { lsrb, 1 },
- /* 95 */ { lsr2, 0 },
- /* 96 */ { rora, 0 },
- /* 97 */ { rorb, 0 },
- /* 98 */ { ror2, 0 },
- /* 99 */ { asra, 0 },
- /* 9a */ { asrb, 0 },
- /* 9b */ { asr2, 0 },
- /* 9c */ { asla, 1 },
- /* 9d */ { aslb, 1 },
- /* 9e */ { asl2, 0 },
- /* 9f */ { rti, 1 },
-
- /* a0 */ { rola, 1 },
- /* a1 */ { rolb, 0 },
- /* a2 */ { rol2, 0 },
- /* a3 */ { lsrw, 0 },
- /* a4 */ { rorw, 0 },
- /* a5 */ { asrw, 0 },
- /* a6 */ { aslw, 0 },
- /* a7 */ { rolw, 0 },
- /* a8 */ { jmp2, 1 },
- /* a9 */ { jsr2, 1 },
- /* aa */ { bsr, 1 },
- /* ab */ { lbsr, 1 },
- /* ac */ { decbjnz, 0 },
- /* ad */ { decxjnz, 0 },
- /* ae */ { nop, 0 },
- /* af */ { illegal, 0 },
-
- /* b0 */ { abx, 0 },
- /* b1 */ { daa, 0 },
- /* b2 */ { sex, 0 },
- /* b3 */ { mul, 1 },
- /* b4 */ { lmul, 0 },
- /* b5 */ { divx, 0 },
- /* b6 */ { bmove, 1 },
- /* b7 */ { move, 0 },
- /* b8 */ { lsrd, 0 },
- /* b9 */ { lsrd2, 0 },
- /* ba */ { rord, 0 },
- /* bb */ { rord2, 0 },
- /* bc */ { asrd, 0 },
- /* bd */ { asrd2, 0 },
- /* be */ { asld, 0 },
- /* bf */ { asld2, 0 },
-
- /* c0 */ { rold, 0 },
- /* c1 */ { rold2, 0 },
- /* c2 */ { clrd, 1 },
- /* c3 */ { clrw, 0 },
- /* c4 */ { negd, 0 },
- /* c5 */ { negw, 0 },
- /* c6 */ { incd, 0 },
- /* c7 */ { incw, 0 },
- /* c8 */ { decd, 0 },
- /* c9 */ { decw, 0 },
- /* ca */ { tstd, 0 },
- /* cb */ { tstw, 0 },
- /* cc */ { absa, 0 },
- /* cd */ { absb, 0 },
- /* ce */ { absd, 0 },
- /* cf */ { bset, 0 },
-
- /* d0 */ { bset2, 0 },
- /* d1 */ { illegal, 0 },
- /* d2 */ { illegal, 0 },
- /* d3 */ { illegal, 0 },
- /* d4 */ { illegal, 0 },
- /* d5 */ { illegal, 0 },
- /* d6 */ { illegal, 0 },
- /* d7 */ { illegal, 0 },
- /* d8 */ { illegal, 0 },
- /* d9 */ { illegal, 0 },
- /* da */ { illegal, 0 },
- /* db */ { illegal, 0 },
- /* dc */ { illegal, 0 },
- /* dd */ { illegal, 0 },
- /* de */ { illegal, 0 },
- /* df */ { illegal, 0 },
-
- /* e0 */ { illegal, 0 },
- /* e1 */ { illegal, 0 },
- /* e2 */ { illegal, 0 },
- /* e3 */ { illegal, 0 },
- /* e4 */ { illegal, 0 },
- /* e5 */ { illegal, 0 },
- /* e6 */ { illegal, 0 },
- /* e7 */ { illegal, 0 },
- /* e8 */ { illegal, 0 },
- /* e9 */ { illegal, 0 },
- /* ea */ { illegal, 0 },
- /* eb */ { illegal, 0 },
- /* ec */ { illegal, 0 },
- /* ed */ { illegal, 0 },
- /* ee */ { illegal, 0 },
- /* ef */ { illegal, 0 },
-
- /* f0 */ { illegal, 0 },
- /* f1 */ { illegal, 0 },
- /* f2 */ { illegal, 0 },
- /* f3 */ { illegal, 0 },
- /* f4 */ { illegal, 0 },
- /* f5 */ { illegal, 0 },
- /* f6 */ { illegal, 0 },
- /* f7 */ { illegal, 0 },
- /* f8 */ { illegal, 0 },
- /* f9 */ { illegal, 0 },
- /* fa */ { illegal, 0 },
- /* fb */ { illegal, 0 },
- /* fc */ { illegal, 0 },
- /* fd */ { illegal, 0 },
- /* fe */ { illegal, 0 },
- /* ff */ { illegal, 0 }
-};
-
-CPU_DISASSEMBLE( konami )
-{
- buffer[0] = '\0';
-
- local_pc = pc;
- byte_count = 1;
- opram_ptr = opram;
- flags = 0;
-
- (op_table[*oprom].decode)( buffer );
-
- return byte_count | flags | DASMFLAG_SUPPORTED;
-}