Added new AttributedMemory class in prep for overhaul of parsers. Moved 6502 opcode info to Opcodes static class.

This commit is contained in:
Mark Long 2021-01-31 21:28:17 -06:00
parent edd10bec10
commit 4800387ace
25 changed files with 1495 additions and 1096 deletions

View File

@ -26,6 +26,9 @@ INCLUDEPATH += src/internals
INCLUDEPATH += src/ui/diskexplorer/
INCLUDEPATH += src/ui/widgets/
INCLUDEPATH += src/ui
INCLUDEPATH += src/memory
INCLUDEPATH += src/memory/roles
DEFINES += WS_VIDEO
@ -39,6 +42,10 @@ SOURCES += \
src/diskfiles/dos33/tracksectorlist.cxx \
src/diskfiles/dos33/filedescriptiveentry.cxx \
src/diskfiles/dos33/genericfile.cxx \
src/memory/attributedmemory.cpp \
src/memory/memorycell.cpp \
src/memory/memrole.cpp \
src/memory/roles/role_asm_opcode.cpp \
src/ui/startupdialog.cpp \
src/ui/viewers/intbasicfileviewer.cxx \
src/ui/widgets/notesdialog.cpp \
@ -77,7 +84,8 @@ SOURCES += \
src/ui/diskexplorer/DiskExplorerMapWidget.cpp \
src/applesoftfile/ApplesoftRetokenizer.cpp \
src/internals/JumpLineManager.cpp \
src/ui/widgets/FlowLineTextBrowser.cpp
src/ui/widgets/FlowLineTextBrowser.cpp \
src/util/opcodes.cpp
HEADERS += \
@ -89,9 +97,14 @@ HEADERS += \
src/diskfiles/dos33/filedescriptiveentry.h \
src/diskfiles/dos33/genericfile.h \
src/intbasic/IntBasicFile.h \
src/memory/attributedmemory.h \
src/memory/memorycell.h \
src/memory/memrole.h \
src/memory/roles/role_asm_opcode.h \
src/ui/startupdialog.h \
src/ui/viewers/intbasicfileviewer.h \
src/ui/widgets/notesdialog.h \
src/util/opcodes.h \
src/util/util.h \
src/util/applestring.h \
src/applesoftfile/applesoftfile.h \

View File

@ -1,4 +1,8 @@
#include "opcodes.h"
#include "disassembler.h"
#include <QByteArray>
#include <QDebug>
#include <QList>
@ -7,9 +11,8 @@
Disassembler::Disassembler(QByteArray memimage)
{
m_memimage = memimage, makeOpcodeTable();
m_memimage = memimage;
m_memusagemap.clearData();
}
@ -120,7 +123,7 @@ bool Disassembler::disassembleOp(quint16 address, DisassembledItem &retval, Memo
}
quint8 opcode = m_memimage[address];
AssyInstruction op = m_opcodeinfo[opcode];
AssyInstruction op = OpCodes::getAssyInstruction(opcode);
retval.setInstruction(op);
if (opcode == 0x6C || opcode == 0x7c) // Indirect jumps
@ -290,555 +293,6 @@ bool Disassembler::disassembleOp(quint16 address, DisassembledItem &retval, Memo
return true;
}
void Disassembler::makeOpcodeTable()
{
m_opcodeinfo[0x00] = AssyInstruction(0x00, "BRK", AM_Implied);
m_opcodeinfo[0x10] = AssyInstruction(0x10, "BPL", AM_ProgramCounterRelative);
m_opcodeinfo[0x20] = AssyInstruction(0x20, "JSR", AM_Absolute);
m_opcodeinfo[0x30] = AssyInstruction(0x30, "BMI", AM_ProgramCounterRelative);
m_opcodeinfo[0x40] = AssyInstruction(0x40, "RTI", AM_Implied);
m_opcodeinfo[0x50] = AssyInstruction(0x50, "BVC", AM_ProgramCounterRelative);
m_opcodeinfo[0x60] = AssyInstruction(0x60, "RTS", AM_Implied);
m_opcodeinfo[0x70] = AssyInstruction(0x70, "BVS", AM_ProgramCounterRelative);
m_opcodeinfo[0x80] = AssyInstruction(0x80, "BRA", AM_ProgramCounterRelative); //65C02
m_opcodeinfo[0x90] = AssyInstruction(0x90, "BCC", AM_ProgramCounterRelative);
m_opcodeinfo[0xa0] = AssyInstruction(0xa0, "LDY", AM_Immediate);
m_opcodeinfo[0xb0] = AssyInstruction(0xb0, "BCS", AM_ProgramCounterRelative);
m_opcodeinfo[0xc0] = AssyInstruction(0xc0, "CPY", AM_Immediate);
m_opcodeinfo[0xd0] = AssyInstruction(0xd0, "BNE", AM_ProgramCounterRelative);
m_opcodeinfo[0xe0] = AssyInstruction(0xe0, "CPX", AM_Immediate);
m_opcodeinfo[0xf0] = AssyInstruction(0xf0, "BEQ", AM_ProgramCounterRelative);
m_opcodeinfo[0x01] = AssyInstruction(0x01, "ORA", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0x11] = AssyInstruction(0x11, "ORA", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0x21] = AssyInstruction(0x21, "AND", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0x31] = AssyInstruction(0x31, "AND", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0x41] = AssyInstruction(0x41, "EOR", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0x51] = AssyInstruction(0x51, "EOR", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0x61] = AssyInstruction(0x61, "ADC", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0x71] = AssyInstruction(0x71, "ADC", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0x81] = AssyInstruction(0x81, "STA", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0x91] = AssyInstruction(0x91, "STA", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0xa1] = AssyInstruction(0xa1, "LDA", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0xb1] = AssyInstruction(0xb1, "LDA", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0xc1] = AssyInstruction(0xc1, "CMP", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0xd1] = AssyInstruction(0xd1, "CMP", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0xe1] = AssyInstruction(0xe1, "SBC", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0xf1] = AssyInstruction(0xff, "SBC", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0x02] = AssyInstruction(0x02, "???", AM_InvalidOp);
m_opcodeinfo[0x12] = AssyInstruction(0x12, "ORA", AM_ZeroPageIndirect);
m_opcodeinfo[0x22] = AssyInstruction(0x22, "???", AM_InvalidOp);
m_opcodeinfo[0x32] = AssyInstruction(0x32, "AND", AM_ZeroPageIndirect);
m_opcodeinfo[0x42] = AssyInstruction(0x42, "???", AM_InvalidOp);
m_opcodeinfo[0x52] = AssyInstruction(0x52, "EOR", AM_ZeroPageIndirect);
m_opcodeinfo[0x62] = AssyInstruction(0x62, "???", AM_InvalidOp);
m_opcodeinfo[0x72] = AssyInstruction(0x72, "ADC", AM_ZeroPageIndirect);
m_opcodeinfo[0x82] = AssyInstruction(0x82, "???", AM_InvalidOp);
m_opcodeinfo[0x92] = AssyInstruction(0x92, "STA", AM_ZeroPageIndirect); //65C02
m_opcodeinfo[0xa2] = AssyInstruction(0xa2, "LDX", AM_Immediate);
m_opcodeinfo[0xb2] = AssyInstruction(0xb2, "LDA", AM_ZeroPageIndirect); //65C02
m_opcodeinfo[0xc2] = AssyInstruction(0xc2, "???", AM_InvalidOp);
m_opcodeinfo[0xd2] = AssyInstruction(0xd2, "CMP", AM_ZeroPageIndirect);
m_opcodeinfo[0xe2] = AssyInstruction(0xe2, "???", AM_InvalidOp);
m_opcodeinfo[0xf2] = AssyInstruction(0xf2, "SBC", AM_ZeroPageIndirect);
m_opcodeinfo[0x03] = AssyInstruction(0x03, "???", AM_InvalidOp);
m_opcodeinfo[0x13] = AssyInstruction(0x13, "???", AM_InvalidOp);
m_opcodeinfo[0x23] = AssyInstruction(0x23, "???", AM_InvalidOp);
m_opcodeinfo[0x33] = AssyInstruction(0x33, "???", AM_InvalidOp);
m_opcodeinfo[0x43] = AssyInstruction(0x43, "???", AM_InvalidOp);
m_opcodeinfo[0x53] = AssyInstruction(0x53, "???", AM_InvalidOp);
m_opcodeinfo[0x63] = AssyInstruction(0x63, "???", AM_InvalidOp);
m_opcodeinfo[0x73] = AssyInstruction(0x73, "???", AM_InvalidOp);
m_opcodeinfo[0x83] = AssyInstruction(0x83, "???", AM_InvalidOp);
m_opcodeinfo[0x93] = AssyInstruction(0x93, "???", AM_InvalidOp);
m_opcodeinfo[0xa3] = AssyInstruction(0xa3, "???", AM_InvalidOp);
m_opcodeinfo[0xb3] = AssyInstruction(0xb3, "???", AM_InvalidOp);
m_opcodeinfo[0xc3] = AssyInstruction(0xc3, "???", AM_InvalidOp);
m_opcodeinfo[0xd3] = AssyInstruction(0xd3, "???", AM_InvalidOp);
m_opcodeinfo[0xe3] = AssyInstruction(0xe3, "???", AM_InvalidOp);
m_opcodeinfo[0xf3] = AssyInstruction(0xf3, "???", AM_InvalidOp);
m_opcodeinfo[0x04] = AssyInstruction(0x04, "TSB", AM_ZeroPage); //65C02
m_opcodeinfo[0x14] = AssyInstruction(0x14, "TRB", AM_ZeroPage); //65C02
m_opcodeinfo[0x24] = AssyInstruction(0x24, "BIT", AM_ZeroPage);
m_opcodeinfo[0x34] = AssyInstruction(0x34, "BIT", AM_ZeroPageIndexedWithX); //65C02
m_opcodeinfo[0x44] = AssyInstruction(0x44, "???", AM_InvalidOp);
m_opcodeinfo[0x54] = AssyInstruction(0x54, "???", AM_InvalidOp);
m_opcodeinfo[0x64] = AssyInstruction(0x64, "STZ", AM_ZeroPage); //65C02
m_opcodeinfo[0x74] = AssyInstruction(0x74, "STZ", AM_ZeroPageIndexedWithX); //65C02
m_opcodeinfo[0x84] = AssyInstruction(0x84, "STY", AM_ZeroPage);
m_opcodeinfo[0x94] = AssyInstruction(0x94, "STY", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xa4] = AssyInstruction(0xa4, "LDY", AM_ZeroPage);
m_opcodeinfo[0xb4] = AssyInstruction(0xb4, "LDY", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xc4] = AssyInstruction(0xc4, "CPY", AM_ZeroPage);
m_opcodeinfo[0xd4] = AssyInstruction(0xd4, "???", AM_InvalidOp);
m_opcodeinfo[0xe4] = AssyInstruction(0xe4, "CPX", AM_ZeroPage);
m_opcodeinfo[0xf4] = AssyInstruction(0xf4, "???", AM_InvalidOp);
m_opcodeinfo[0x05] = AssyInstruction(0x05, "ORA", AM_ZeroPage);
m_opcodeinfo[0x15] = AssyInstruction(0x15, "ORA", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x25] = AssyInstruction(0x25, "AND", AM_ZeroPage);
m_opcodeinfo[0x35] = AssyInstruction(0x35, "AND", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x45] = AssyInstruction(0x45, "EOR", AM_ZeroPage);
m_opcodeinfo[0x55] = AssyInstruction(0x55, "EOR", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x65] = AssyInstruction(0x65, "ADC", AM_ZeroPage);
m_opcodeinfo[0x75] = AssyInstruction(0x75, "ADC", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x85] = AssyInstruction(0x85, "STA", AM_ZeroPage);
m_opcodeinfo[0x95] = AssyInstruction(0x95, "STA", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xa5] = AssyInstruction(0xa5, "LDA", AM_ZeroPage);
m_opcodeinfo[0xb5] = AssyInstruction(0xb5, "LDA", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xc5] = AssyInstruction(0xc5, "CMP", AM_ZeroPage);
m_opcodeinfo[0xd5] = AssyInstruction(0xd5, "CMP", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xe5] = AssyInstruction(0xe5, "SEC", AM_ZeroPage);
m_opcodeinfo[0xf5] = AssyInstruction(0xf5, "SEC", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x06] = AssyInstruction(0x06, "ASL", AM_ZeroPage);
m_opcodeinfo[0x16] = AssyInstruction(0x16, "ASL", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x26] = AssyInstruction(0x26, "ROL", AM_ZeroPage);
m_opcodeinfo[0x36] = AssyInstruction(0x36, "ROL", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x46] = AssyInstruction(0x46, "LSR", AM_ZeroPage);
m_opcodeinfo[0x56] = AssyInstruction(0x56, "LSR", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x66] = AssyInstruction(0x66, "ROR", AM_ZeroPage);
m_opcodeinfo[0x76] = AssyInstruction(0x76, "ROR", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x86] = AssyInstruction(0x86, "STX", AM_ZeroPage);
m_opcodeinfo[0x96] = AssyInstruction(0x96, "STX", AM_ZeroPageIndexedWithY);
m_opcodeinfo[0xa6] = AssyInstruction(0xa6, "LDX", AM_ZeroPage);
m_opcodeinfo[0xb6] = AssyInstruction(0xb6, "LDX", AM_ZeroPageIndexedWithY);
m_opcodeinfo[0xc6] = AssyInstruction(0xc6, "DEC", AM_ZeroPage);
m_opcodeinfo[0xd6] = AssyInstruction(0xd6, "DEC", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xe6] = AssyInstruction(0xe6, "INC", AM_ZeroPage);
m_opcodeinfo[0xf6] = AssyInstruction(0xf6, "INC", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x07] = AssyInstruction(0x07, "???", AM_InvalidOp);
m_opcodeinfo[0x17] = AssyInstruction(0x17, "???", AM_InvalidOp);
m_opcodeinfo[0x27] = AssyInstruction(0x27, "???", AM_InvalidOp);
m_opcodeinfo[0x37] = AssyInstruction(0x37, "???", AM_InvalidOp);
m_opcodeinfo[0x47] = AssyInstruction(0x47, "???", AM_InvalidOp);
m_opcodeinfo[0x57] = AssyInstruction(0x57, "???", AM_InvalidOp);
m_opcodeinfo[0x67] = AssyInstruction(0x67, "???", AM_InvalidOp);
m_opcodeinfo[0x77] = AssyInstruction(0x77, "???", AM_InvalidOp);
m_opcodeinfo[0x87] = AssyInstruction(0x87, "???", AM_InvalidOp);
m_opcodeinfo[0x97] = AssyInstruction(0x97, "???", AM_InvalidOp);
m_opcodeinfo[0xa7] = AssyInstruction(0xa7, "???", AM_InvalidOp);
m_opcodeinfo[0xb7] = AssyInstruction(0xb7, "???", AM_InvalidOp);
m_opcodeinfo[0xc7] = AssyInstruction(0xc7, "???", AM_InvalidOp);
m_opcodeinfo[0xd7] = AssyInstruction(0xd7, "???", AM_InvalidOp);
m_opcodeinfo[0xe7] = AssyInstruction(0xe7, "???", AM_InvalidOp);
m_opcodeinfo[0xf7] = AssyInstruction(0xf7, "???", AM_InvalidOp);
m_opcodeinfo[0x08] = AssyInstruction(0x08, "PHP", AM_Implied);
m_opcodeinfo[0x18] = AssyInstruction(0x18, "CLC", AM_Implied);
m_opcodeinfo[0x28] = AssyInstruction(0x28, "PLP", AM_Implied);
m_opcodeinfo[0x38] = AssyInstruction(0x38, "SEC", AM_Implied);
m_opcodeinfo[0x48] = AssyInstruction(0x48, "PHA", AM_Implied);
m_opcodeinfo[0x58] = AssyInstruction(0x58, "CLI", AM_Implied);
m_opcodeinfo[0x68] = AssyInstruction(0x68, "PLA", AM_Implied);
m_opcodeinfo[0x78] = AssyInstruction(0x78, "SEI", AM_Implied);
m_opcodeinfo[0x88] = AssyInstruction(0x88, "DEY", AM_Implied);
m_opcodeinfo[0x98] = AssyInstruction(0x98, "TYA", AM_Implied);
m_opcodeinfo[0xa8] = AssyInstruction(0xa8, "TAY", AM_Implied);
m_opcodeinfo[0xb8] = AssyInstruction(0xb8, "CLV", AM_Implied);
m_opcodeinfo[0xc8] = AssyInstruction(0xc8, "INY", AM_Implied);
m_opcodeinfo[0xd8] = AssyInstruction(0xd8, "CLD", AM_Implied);
m_opcodeinfo[0xe8] = AssyInstruction(0xe8, "INX", AM_Implied);
m_opcodeinfo[0xf8] = AssyInstruction(0xf8, "SED", AM_Implied);
m_opcodeinfo[0x09] = AssyInstruction(0x09, "ORA", AM_Immediate);
m_opcodeinfo[0x19] = AssyInstruction(0x19, "ORA", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x29] = AssyInstruction(0x29, "AND", AM_Immediate);
m_opcodeinfo[0x39] = AssyInstruction(0x39, "AND", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x49] = AssyInstruction(0x49, "EOR", AM_Immediate);
m_opcodeinfo[0x59] = AssyInstruction(0x59, "EOR", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x69] = AssyInstruction(0x69, "ADC", AM_Immediate);
m_opcodeinfo[0x79] = AssyInstruction(0x79, "ADC", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x89] = AssyInstruction(0x89, "BIT", AM_Immediate); //65C02
m_opcodeinfo[0x99] = AssyInstruction(0x99, "STA", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xa9] = AssyInstruction(0xa9, "LDA", AM_Immediate);
m_opcodeinfo[0xb9] = AssyInstruction(0xb9, "LDA", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xc9] = AssyInstruction(0xc9, "CMP", AM_Immediate);
m_opcodeinfo[0xd9] = AssyInstruction(0xd9, "CMP", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xe9] = AssyInstruction(0xe9, "SBC", AM_Immediate);
m_opcodeinfo[0xf9] = AssyInstruction(0xf9, "SBC", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x0a] = AssyInstruction(0x0a, "ASL", AM_Accumulator);
m_opcodeinfo[0x1a] = AssyInstruction(0x1a, "INA", AM_Accumulator); //65C02
m_opcodeinfo[0x2a] = AssyInstruction(0x2a, "ROL", AM_Accumulator);
m_opcodeinfo[0x3a] = AssyInstruction(0x3a, "DEC", AM_Accumulator); //65C02
m_opcodeinfo[0x4a] = AssyInstruction(0x4a, "LSR", AM_Accumulator);
m_opcodeinfo[0x5a] = AssyInstruction(0x5a, "PHY", AM_Implied);//65C02
m_opcodeinfo[0x6a] = AssyInstruction(0x6a, "ROR", AM_Accumulator);
m_opcodeinfo[0x7a] = AssyInstruction(0x7a, "PLY", AM_Implied);//65C02
m_opcodeinfo[0x8a] = AssyInstruction(0x8a, "TXA", AM_Implied);
m_opcodeinfo[0x9a] = AssyInstruction(0x9a, "TXS", AM_Implied);
m_opcodeinfo[0xaa] = AssyInstruction(0xaa, "TAX", AM_Implied);
m_opcodeinfo[0xba] = AssyInstruction(0xba, "TSX", AM_Implied);
m_opcodeinfo[0xca] = AssyInstruction(0xca, "DEX", AM_Implied);
m_opcodeinfo[0xda] = AssyInstruction(0xda, "PHX", AM_Implied);//65C02
m_opcodeinfo[0xea] = AssyInstruction(0xea, "NOP", AM_Implied);
m_opcodeinfo[0xfa] = AssyInstruction(0xfa, "PLX", AM_Implied);//65C02
m_opcodeinfo[0x0b] = AssyInstruction(0x0b, "???", AM_InvalidOp);
m_opcodeinfo[0x1b] = AssyInstruction(0x1b, "???", AM_InvalidOp);
m_opcodeinfo[0x2b] = AssyInstruction(0x2b, "???", AM_InvalidOp);
m_opcodeinfo[0x3b] = AssyInstruction(0x3b, "???", AM_InvalidOp);
m_opcodeinfo[0x4b] = AssyInstruction(0x4b, "???", AM_InvalidOp);
m_opcodeinfo[0x5b] = AssyInstruction(0x5b, "???", AM_InvalidOp);
m_opcodeinfo[0x6b] = AssyInstruction(0x6b, "???", AM_InvalidOp);
m_opcodeinfo[0x7b] = AssyInstruction(0x7b, "???", AM_InvalidOp);
m_opcodeinfo[0x8b] = AssyInstruction(0x8b, "???", AM_InvalidOp);
m_opcodeinfo[0x9b] = AssyInstruction(0x9b, "???", AM_InvalidOp);
m_opcodeinfo[0xab] = AssyInstruction(0xab, "???", AM_InvalidOp);
m_opcodeinfo[0xbb] = AssyInstruction(0xbb, "???", AM_InvalidOp);
m_opcodeinfo[0xcb] = AssyInstruction(0xcb, "???", AM_InvalidOp);
m_opcodeinfo[0xdb] = AssyInstruction(0xdb, "???", AM_InvalidOp);
m_opcodeinfo[0xeb] = AssyInstruction(0xeb, "???", AM_InvalidOp);
m_opcodeinfo[0xfb] = AssyInstruction(0xfb, "???", AM_InvalidOp);
m_opcodeinfo[0x0c] = AssyInstruction(0x0c, "TSB", AM_Absolute); //65C02
m_opcodeinfo[0x1c] = AssyInstruction(0x1c, "TRB", AM_Absolute); //65C02
m_opcodeinfo[0x2c] = AssyInstruction(0x2c, "BIT", AM_Absolute);
m_opcodeinfo[0x3c] = AssyInstruction(0x3c, "BIT", AM_AbsoluteIndexedWithX); //65C02
m_opcodeinfo[0x4c] = AssyInstruction(0x4c, "JMP", AM_Absolute);
m_opcodeinfo[0x5c] = AssyInstruction(0x5c, "???", AM_InvalidOp);
m_opcodeinfo[0x6c] = AssyInstruction(0x6c, "JMP", AM_AbsoluteIndirect);
m_opcodeinfo[0x7c] = AssyInstruction(0x7c, "JMP", AM_AbsoluteIndexedIndirect); //65C02
m_opcodeinfo[0x8c] = AssyInstruction(0x8c, "STY", AM_Absolute);
m_opcodeinfo[0x9c] = AssyInstruction(0x9c, "STZ", AM_Absolute);
m_opcodeinfo[0xac] = AssyInstruction(0xac, "LDY", AM_Absolute);
m_opcodeinfo[0xbc] = AssyInstruction(0xbc, "LDY", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xcc] = AssyInstruction(0xcc, "CPY", AM_Absolute);
m_opcodeinfo[0xdc] = AssyInstruction(0xdc, "???", AM_InvalidOp);
m_opcodeinfo[0xec] = AssyInstruction(0xec, "CPX", AM_Absolute);
m_opcodeinfo[0xfc] = AssyInstruction(0xfc, "???", AM_InvalidOp);
m_opcodeinfo[0x0d] = AssyInstruction(0x0d, "ORA", AM_Absolute);
m_opcodeinfo[0x1d] = AssyInstruction(0x1d, "ORA", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x2d] = AssyInstruction(0x2d, "AND", AM_Absolute);
m_opcodeinfo[0x3d] = AssyInstruction(0x3d, "AND", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x4d] = AssyInstruction(0x4d, "EOR", AM_Absolute);
m_opcodeinfo[0x5d] = AssyInstruction(0x5d, "EOR", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x6d] = AssyInstruction(0x6d, "ADC", AM_Absolute);
m_opcodeinfo[0x7d] = AssyInstruction(0x7d, "ADC", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x8d] = AssyInstruction(0x8d, "STA", AM_Absolute);
m_opcodeinfo[0x9d] = AssyInstruction(0x9d, "STA", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xad] = AssyInstruction(0xad, "LDA", AM_Absolute);
m_opcodeinfo[0xbd] = AssyInstruction(0xbd, "LDA", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xcd] = AssyInstruction(0xcd, "CMP", AM_Absolute);
m_opcodeinfo[0xdd] = AssyInstruction(0xdd, "CMP", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xed] = AssyInstruction(0xed, "SBC", AM_Absolute);
m_opcodeinfo[0xfd] = AssyInstruction(0xfd, "SBC", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x0e] = AssyInstruction(0x0e, "ASL", AM_Absolute);
m_opcodeinfo[0x1e] = AssyInstruction(0x1e, "ASL", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x2e] = AssyInstruction(0x2e, "ROL", AM_Absolute);
m_opcodeinfo[0x3e] = AssyInstruction(0x3e, "ROL", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x4e] = AssyInstruction(0x4e, "LSR", AM_Absolute);
m_opcodeinfo[0x5e] = AssyInstruction(0x5e, "LSR", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x6e] = AssyInstruction(0x6e, "ROR", AM_Absolute);
m_opcodeinfo[0x7e] = AssyInstruction(0x7e, "ROR", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x8e] = AssyInstruction(0x8e, "STX", AM_Absolute);
m_opcodeinfo[0x9e] = AssyInstruction(0x9e, "STZ", AM_AbsoluteIndexedWithX); //65C02
m_opcodeinfo[0xae] = AssyInstruction(0xae, "LDX", AM_Absolute);
m_opcodeinfo[0xbe] = AssyInstruction(0xbe, "LDX", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xce] = AssyInstruction(0xce, "DEC", AM_Absolute);
m_opcodeinfo[0xde] = AssyInstruction(0xde, "DEC", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xee] = AssyInstruction(0xee, "INC", AM_Absolute);
m_opcodeinfo[0xfe] = AssyInstruction(0xfe, "INC", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x0f] = AssyInstruction(0x0f, "???", AM_InvalidOp);
m_opcodeinfo[0x1f] = AssyInstruction(0x1f, "???", AM_InvalidOp);
m_opcodeinfo[0x2f] = AssyInstruction(0x2f, "???", AM_InvalidOp);
m_opcodeinfo[0x3f] = AssyInstruction(0x3f, "???", AM_InvalidOp);
m_opcodeinfo[0x4f] = AssyInstruction(0x4f, "???", AM_InvalidOp);
m_opcodeinfo[0x5f] = AssyInstruction(0x5f, "???", AM_InvalidOp);
m_opcodeinfo[0x6f] = AssyInstruction(0x6f, "???", AM_InvalidOp);
m_opcodeinfo[0x7f] = AssyInstruction(0x7f, "???", AM_InvalidOp);
m_opcodeinfo[0x8f] = AssyInstruction(0x8f, "???", AM_InvalidOp);
m_opcodeinfo[0x9f] = AssyInstruction(0x9f, "???", AM_InvalidOp);
m_opcodeinfo[0xaf] = AssyInstruction(0xaf, "???", AM_InvalidOp);
m_opcodeinfo[0xbf] = AssyInstruction(0xbf, "???", AM_InvalidOp);
m_opcodeinfo[0xcf] = AssyInstruction(0xcf, "???", AM_InvalidOp);
m_opcodeinfo[0xdf] = AssyInstruction(0xdf, "???", AM_InvalidOp);
m_opcodeinfo[0xef] = AssyInstruction(0xef, "???", AM_InvalidOp);
m_opcodeinfo[0xff] = AssyInstruction(0xff, "???", AM_InvalidOp);
#ifdef UNUSED_OPCODES
m_opcodeinfo[0x00] = AssyInstruction(0x00, "BRK", AM_Implied);
m_opcodeinfo[0x10] = AssyInstruction(0x10, "BPL", AM_ProgramCounterRelative);
m_opcodeinfo[0x20] = AssyInstruction(0x20, "JSR", AM_Absolute);
m_opcodeinfo[0x30] = AssyInstruction(0x30, "BMI", AM_ProgramCounterRelative);
m_opcodeinfo[0x40] = AssyInstruction(0x40, "RTI", AM_Implied);
m_opcodeinfo[0x50] = AssyInstruction(0x50, "BVC", AM_ProgramCounterRelative);
m_opcodeinfo[0x60] = AssyInstruction(0x60, "RTS", AM_Implied);
m_opcodeinfo[0x70] = AssyInstruction(0x70, "BVS", AM_ProgramCounterRelative);
m_opcodeinfo[0x80] = AssyInstruction(0x80, "nop", AM_ZeroPage);
m_opcodeinfo[0x90] = AssyInstruction(0x90, "BCC", AM_ProgramCounterRelative);
m_opcodeinfo[0xa0] = AssyInstruction(0xa0, "LDY", AM_Immediate);
m_opcodeinfo[0xb0] = AssyInstruction(0xb0, "BCC", AM_ProgramCounterRelative);
m_opcodeinfo[0xc0] = AssyInstruction(0xc0, "LDY", AM_Immediate);
m_opcodeinfo[0xd0] = AssyInstruction(0xd0, "BCS", AM_ProgramCounterRelative);
m_opcodeinfo[0xe0] = AssyInstruction(0xe0, "CPX", AM_Immediate);
m_opcodeinfo[0xf0] = AssyInstruction(0xf0, "BEQ", AM_ProgramCounterRelative);
m_opcodeinfo[0x01] = AssyInstruction(0x01, "ORA", AM_AbsoluteIndexedIndirect);
m_opcodeinfo[0x11] = AssyInstruction(0x11, "ORA", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x21] = AssyInstruction(0x21, "AND", AM_AbsoluteIndexedIndirect);
m_opcodeinfo[0x31] = AssyInstruction(0x31, "AND", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x41] = AssyInstruction(0x41, "EOR", AM_AbsoluteIndexedIndirect);
m_opcodeinfo[0x51] = AssyInstruction(0x51, "EOR", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x61] = AssyInstruction(0x61, "ADC", AM_AbsoluteIndexedIndirect);
m_opcodeinfo[0x71] = AssyInstruction(0x71, "ADC", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x81] = AssyInstruction(0x81, "STA", AM_AbsoluteIndexedIndirect);
m_opcodeinfo[0x91] = AssyInstruction(0x91, "STA", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xa1] = AssyInstruction(0xa1, "LDA", AM_AbsoluteIndexedIndirect);
m_opcodeinfo[0xb1] = AssyInstruction(0xb1, "LDA", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xc1] = AssyInstruction(0xc1, "CMP", AM_AbsoluteIndexedIndirect);
m_opcodeinfo[0xd1] = AssyInstruction(0xd1, "CMP", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xe1] = AssyInstruction(0xe1, "SBC", AM_AbsoluteIndexedIndirect);
m_opcodeinfo[0xf1] = AssyInstruction(0xff, "SBC", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x02] = AssyInstruction(0x02, "halt", AM_Immediate);
m_opcodeinfo[0x12] = AssyInstruction(0x12, "asl-ora", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0x22] = AssyInstruction(0x22, "and", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x32] = AssyInstruction(0x32, "halt", AM_Immediate);
m_opcodeinfo[0x42] = AssyInstruction(0x42, "halt", AM_Immediate);
m_opcodeinfo[0x52] = AssyInstruction(0x52, "halt", AM_Immediate);
m_opcodeinfo[0x62] = AssyInstruction(0x62, "halt", AM_Immediate);
m_opcodeinfo[0x72] = AssyInstruction(0x72, "halt", AM_Immediate);
m_opcodeinfo[0x82] = AssyInstruction(0x82, "halt", AM_Immediate);
m_opcodeinfo[0x92] = AssyInstruction(0x92, "halt", AM_Immediate);
m_opcodeinfo[0xa2] = AssyInstruction(0xa2, "LDX", AM_Immediate);
m_opcodeinfo[0xb2] = AssyInstruction(0xb2, "halt", AM_Immediate);
m_opcodeinfo[0xc2] = AssyInstruction(0xc2, "halt", AM_Immediate);
m_opcodeinfo[0xd2] = AssyInstruction(0xd2, "halt", AM_Immediate);
m_opcodeinfo[0xe2] = AssyInstruction(0xe2, "halt", AM_Immediate);
m_opcodeinfo[0xf2] = AssyInstruction(0xf2, "halt", AM_Immediate);
m_opcodeinfo[0x03] = AssyInstruction(0x03, "asl/ora", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0x13] = AssyInstruction(0x13, "asl/ora", AM_ZeroPageIndirect);
m_opcodeinfo[0x23] = AssyInstruction(0x23, "rol/and", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0x33] = AssyInstruction(0x33, "rol/and", AM_ZeroPageIndexedWithY);
m_opcodeinfo[0x43] = AssyInstruction(0x43, "lsr/eor", AM_ZeroPage);
m_opcodeinfo[0x53] = AssyInstruction(0x53, "lsr/eor", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0x63] = AssyInstruction(0x63, "ror/adc", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0x73] = AssyInstruction(0x73, "ror/adc", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0x83] = AssyInstruction(0x83, "sta/stx", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0x93] = AssyInstruction(0x93, "sta/stx", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0xa3] = AssyInstruction(0xa3, "lda/ldx", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0xb3] = AssyInstruction(0xb3, "lda/ldx", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0xc3] = AssyInstruction(0xc3, "dec/cmp", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0xd3] = AssyInstruction(0xd3, "dec/cmp", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0xe3] = AssyInstruction(0xe3, "inc/sbc", AM_ZeroPageIndexedIndirect);
m_opcodeinfo[0xf3] = AssyInstruction(0xf3, "inc/sbc", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0x04] = AssyInstruction(0x04, "nop", AM_ZeroPage);
m_opcodeinfo[0x14] = AssyInstruction(0x14, "nop", AM_ZeroPage);
m_opcodeinfo[0x24] = AssyInstruction(0x24, "BIT", AM_ZeroPage);
m_opcodeinfo[0x34] = AssyInstruction(0x34, "nop", AM_ZeroPage);
m_opcodeinfo[0x44] = AssyInstruction(0x44, "nop", AM_ZeroPage);
m_opcodeinfo[0x54] = AssyInstruction(0x54, "nop", AM_ZeroPage);
m_opcodeinfo[0x64] = AssyInstruction(0x64, "nop", AM_ZeroPage);
m_opcodeinfo[0x74] = AssyInstruction(0x74, "nop", AM_ZeroPage);
m_opcodeinfo[0x84] = AssyInstruction(0x84, "STY", AM_ZeroPage);
m_opcodeinfo[0x94] = AssyInstruction(0x94, "STY", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xa4] = AssyInstruction(0xa4, "nop", AM_ZeroPage);
m_opcodeinfo[0xb4] = AssyInstruction(0xb4, "LDY", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xc4] = AssyInstruction(0xc4, "CPY", AM_ZeroPage);
m_opcodeinfo[0xd4] = AssyInstruction(0xd4, "nop", AM_ZeroPage);
m_opcodeinfo[0xe4] = AssyInstruction(0xe4, "CPX", AM_ZeroPage);
m_opcodeinfo[0xf4] = AssyInstruction(0xf4, "nop", AM_ZeroPage);
m_opcodeinfo[0x05] = AssyInstruction(0x05, "ORA", AM_ZeroPage);
m_opcodeinfo[0x15] = AssyInstruction(0x15, "ORA", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x25] = AssyInstruction(0x25, "AND", AM_ZeroPage);
m_opcodeinfo[0x35] = AssyInstruction(0x35, "AND", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x45] = AssyInstruction(0x45, "EOR", AM_ZeroPage);
m_opcodeinfo[0x55] = AssyInstruction(0x55, "EOR", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x65] = AssyInstruction(0x65, "ADC", AM_ZeroPage);
m_opcodeinfo[0x75] = AssyInstruction(0x75, "ADC", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x85] = AssyInstruction(0x85, "STA", AM_ZeroPage);
m_opcodeinfo[0x95] = AssyInstruction(0x95, "STA", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xa5] = AssyInstruction(0xa5, "LDA", AM_ZeroPage);
m_opcodeinfo[0xb5] = AssyInstruction(0xb5, "LDA", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xc5] = AssyInstruction(0xc5, "CMP", AM_ZeroPage);
m_opcodeinfo[0xd5] = AssyInstruction(0xd5, "CMP", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xe5] = AssyInstruction(0xe5, "SEC", AM_ZeroPage);
m_opcodeinfo[0xf5] = AssyInstruction(0xf5, "SEC", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x06] = AssyInstruction(0x06, "ASL", AM_ZeroPage);
m_opcodeinfo[0x16] = AssyInstruction(0x16, "ASL", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x26] = AssyInstruction(0x26, "ROL", AM_ZeroPage);
m_opcodeinfo[0x36] = AssyInstruction(0x36, "ROL", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x46] = AssyInstruction(0x46, "LSR", AM_ZeroPage);
m_opcodeinfo[0x56] = AssyInstruction(0x56, "LSR", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x66] = AssyInstruction(0x66, "ROR", AM_ZeroPage);
m_opcodeinfo[0x76] = AssyInstruction(0x76, "ROR", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x86] = AssyInstruction(0x86, "STX", AM_ZeroPage);
m_opcodeinfo[0x96] = AssyInstruction(0x96, "STX", AM_ZeroPageIndexedWithY);
m_opcodeinfo[0xa6] = AssyInstruction(0xa6, "LDX", AM_ZeroPage);
m_opcodeinfo[0xb6] = AssyInstruction(0xb6, "LDX", AM_ZeroPageIndexedWithY);
m_opcodeinfo[0xc6] = AssyInstruction(0xc6, "DEC", AM_ZeroPage);
m_opcodeinfo[0xd6] = AssyInstruction(0xd6, "DEC", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0xe6] = AssyInstruction(0xe6, "INC", AM_ZeroPage);
m_opcodeinfo[0xf6] = AssyInstruction(0xf6, "INC", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x07] = AssyInstruction(0x07, "asl/ora", AM_ZeroPage);
m_opcodeinfo[0x17] = AssyInstruction(0x17, "asl/ora", AM_ZeroPageIndirectIndexedWithY);
m_opcodeinfo[0x27] = AssyInstruction(0x27, "rol/and", AM_ZeroPage);
m_opcodeinfo[0x37] = AssyInstruction(0x37, "rol/and", AM_ZeroPageIndexedWithX);
m_opcodeinfo[0x47] = AssyInstruction(0x47, "lsr/eor", AM_ZeroPage);
m_opcodeinfo[0x57] = AssyInstruction(0x57, "lsr/eor", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x67] = AssyInstruction(0x67, "ror/adc", AM_ZeroPage);
m_opcodeinfo[0x77] = AssyInstruction(0x77, "ror/adc", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x87] = AssyInstruction(0x87, "sta/stx", AM_ZeroPage);
m_opcodeinfo[0x97] = AssyInstruction(0x97, "sta/stx", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xa7] = AssyInstruction(0xa7, "lda/ldx", AM_ZeroPage);
m_opcodeinfo[0xb7] = AssyInstruction(0xb7, "ldx/ldx", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xc7] = AssyInstruction(0xc7, "dec/cmp", AM_ZeroPage);
m_opcodeinfo[0xd7] = AssyInstruction(0xd7, "dec/cmp", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xe7] = AssyInstruction(0xe7, "inc/sbc", AM_ZeroPage);
m_opcodeinfo[0xf7] = AssyInstruction(0xf7, "inc/sbc", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x08] = AssyInstruction(0x08, "PHP", AM_Implied);
m_opcodeinfo[0x18] = AssyInstruction(0x18, "CLC", AM_Implied);
m_opcodeinfo[0x28] = AssyInstruction(0x28, "PLP", AM_Implied);
m_opcodeinfo[0x38] = AssyInstruction(0x38, "SEC", AM_Implied);
m_opcodeinfo[0x48] = AssyInstruction(0x48, "PHA", AM_Implied);
m_opcodeinfo[0x58] = AssyInstruction(0x58, "CLI", AM_Implied);
m_opcodeinfo[0x68] = AssyInstruction(0x68, "PLA", AM_Implied);
m_opcodeinfo[0x78] = AssyInstruction(0x78, "SEI", AM_Implied);
m_opcodeinfo[0x88] = AssyInstruction(0x88, "DEY", AM_Implied);
m_opcodeinfo[0x98] = AssyInstruction(0x98, "TYA", AM_Implied);
m_opcodeinfo[0xa8] = AssyInstruction(0xa8, "TAY", AM_Implied);
m_opcodeinfo[0xb8] = AssyInstruction(0xb8, "CLV", AM_Implied);
m_opcodeinfo[0xc8] = AssyInstruction(0xc8, "INY", AM_Implied);
m_opcodeinfo[0xd8] = AssyInstruction(0xd8, "CLD", AM_Implied);
m_opcodeinfo[0xe8] = AssyInstruction(0xe8, "INX", AM_Implied);
m_opcodeinfo[0xf8] = AssyInstruction(0xf8, "SED", AM_Implied);
m_opcodeinfo[0x09] = AssyInstruction(0x09, "ORA", AM_Immediate);
m_opcodeinfo[0x19] = AssyInstruction(0x19, "ORA", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x29] = AssyInstruction(0x29, "AND", AM_Immediate);
m_opcodeinfo[0x39] = AssyInstruction(0x39, "AND", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x49] = AssyInstruction(0x49, "EOR", AM_Immediate);
m_opcodeinfo[0x59] = AssyInstruction(0x59, "EOR", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x69] = AssyInstruction(0x69, "ADC", AM_Immediate);
m_opcodeinfo[0x79] = AssyInstruction(0x79, "ADC", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x89] = AssyInstruction(0x89, "nop", AM_ZeroPage);
m_opcodeinfo[0x99] = AssyInstruction(0x99, "STA", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xa9] = AssyInstruction(0xa9, "LDA", AM_Immediate);
m_opcodeinfo[0xb9] = AssyInstruction(0xb9, "LDA", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xc9] = AssyInstruction(0xc9, "CMP", AM_Immediate);
m_opcodeinfo[0xd9] = AssyInstruction(0xd9, "CMP", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xe9] = AssyInstruction(0xe9, "SBC", AM_Immediate);
m_opcodeinfo[0xf9] = AssyInstruction(0xf9, "SBC", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x0a] = AssyInstruction(0x0a, "ASL", AM_Accumulator);
m_opcodeinfo[0x1a] = AssyInstruction(0x1a, "nop", AM_Implied);
m_opcodeinfo[0x2a] = AssyInstruction(0x2a, "ROL", AM_Accumulator);
m_opcodeinfo[0x3a] = AssyInstruction(0x3a, "nop", AM_Implied);
m_opcodeinfo[0x4a] = AssyInstruction(0x4a, "LSR", AM_Accumulator);
m_opcodeinfo[0x5a] = AssyInstruction(0x5a, "nop", AM_Implied);
m_opcodeinfo[0x6a] = AssyInstruction(0x6a, "ROR", AM_Accumulator);
m_opcodeinfo[0x7a] = AssyInstruction(0x7a, "nop", AM_Implied);
m_opcodeinfo[0x8a] = AssyInstruction(0x8a, "TXA", AM_Implied);
m_opcodeinfo[0x9a] = AssyInstruction(0x9a, "TXS", AM_Implied);
m_opcodeinfo[0xaa] = AssyInstruction(0xaa, "TAX", AM_Implied);
m_opcodeinfo[0xba] = AssyInstruction(0xba, "TSX", AM_Implied);
m_opcodeinfo[0xca] = AssyInstruction(0xca, "DEX", AM_Implied);
m_opcodeinfo[0xda] = AssyInstruction(0xda, "nop", AM_Implied);
m_opcodeinfo[0xea] = AssyInstruction(0xea, "NOP", AM_Implied);
m_opcodeinfo[0xfa] = AssyInstruction(0xfa, "nop", AM_Implied);
m_opcodeinfo[0x0b] = AssyInstruction(0x0b, "and/mov bit7->Cy", AM_Immediate);
m_opcodeinfo[0x1b] = AssyInstruction(0x1b, "asl/ora", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x2b] = AssyInstruction(0x2b, "and/mov bit7->Cy", AM_Immediate);
m_opcodeinfo[0x3b] = AssyInstruction(0x3b, "asl/ora", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x4b] = AssyInstruction(0x4b, "and/lsr A", AM_Immediate);
m_opcodeinfo[0x5b] = AssyInstruction(0x5b, "lsr/eor", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x6b] = AssyInstruction(0x6b, "and/ror A", AM_Immediate);
m_opcodeinfo[0x7b] = AssyInstruction(0x7b, "ror/adc", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x8b] = AssyInstruction(0x8b, "txa/and", AM_Immediate);
m_opcodeinfo[0x9b] = AssyInstruction(0x9b, "sta/stx", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xab] = AssyInstruction(0xab, "lda/ldx", AM_Implied);
m_opcodeinfo[0xbb] = AssyInstruction(0xbb, "lda/ldx", AM_Implied);
m_opcodeinfo[0xcb] = AssyInstruction(0xcb, "sbx", AM_Immediate);
m_opcodeinfo[0xdb] = AssyInstruction(0xdb, "dec/cmp", AM_Absolute);
m_opcodeinfo[0xeb] = AssyInstruction(0xeb, "sbc", AM_Immediate);
m_opcodeinfo[0xfb] = AssyInstruction(0xfb, "inc/sbc", AM_Absolute);
m_opcodeinfo[0x0c] = AssyInstruction(0x0c, "nop", AM_Absolute);
m_opcodeinfo[0x1c] = AssyInstruction(0x1c, "nop", AM_Absolute);
m_opcodeinfo[0x2c] = AssyInstruction(0x2c, "BIT", AM_Absolute);
m_opcodeinfo[0x3c] = AssyInstruction(0x3c, "nop", AM_Absolute);
m_opcodeinfo[0x4c] = AssyInstruction(0x4c, "JMP", AM_Absolute);
m_opcodeinfo[0x5c] = AssyInstruction(0x5c, "nop", AM_Absolute);
m_opcodeinfo[0x6c] = AssyInstruction(0x6c, "JMP", AM_AbsoluteIndirect);
m_opcodeinfo[0x7c] = AssyInstruction(0x7c, "nop", AM_Absolute);
m_opcodeinfo[0x8c] = AssyInstruction(0x8c, "STY", AM_Absolute);
m_opcodeinfo[0x9c] = AssyInstruction(0x9c, "sta/stx", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xac] = AssyInstruction(0xac, "LDY", AM_Absolute);
m_opcodeinfo[0xbc] = AssyInstruction(0xbc, "LDY", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xcc] = AssyInstruction(0xcc, "CPY", AM_Absolute);
m_opcodeinfo[0xdc] = AssyInstruction(0xdc, "???", AM_InvalidOp);
m_opcodeinfo[0xec] = AssyInstruction(0xec, "CPX", AM_Absolute);
m_opcodeinfo[0xfc] = AssyInstruction(0xfc, "???", AM_InvalidOp);
m_opcodeinfo[0x0d] = AssyInstruction(0x0d, "ORA", AM_Absolute);
m_opcodeinfo[0x1d] = AssyInstruction(0x1d, "ORA", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x2d] = AssyInstruction(0x2d, "AND", AM_Absolute);
m_opcodeinfo[0x3d] = AssyInstruction(0x3d, "AND", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x4d] = AssyInstruction(0x4d, "EOR", AM_Absolute);
m_opcodeinfo[0x5d] = AssyInstruction(0x5d, "EOR", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x6d] = AssyInstruction(0x6d, "ADC", AM_Absolute);
m_opcodeinfo[0x7d] = AssyInstruction(0x7d, "ADC", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x8d] = AssyInstruction(0x8d, "STA", AM_Absolute);
m_opcodeinfo[0x9d] = AssyInstruction(0x9d, "STA", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xad] = AssyInstruction(0xad, "LDA", AM_Absolute);
m_opcodeinfo[0xbd] = AssyInstruction(0xbd, "LDA", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xcd] = AssyInstruction(0xcd, "CMP", AM_Absolute);
m_opcodeinfo[0xdd] = AssyInstruction(0xdd, "CMP", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xed] = AssyInstruction(0xed, "SBC", AM_Absolute);
m_opcodeinfo[0xfd] = AssyInstruction(0xfd, "SBC", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x0e] = AssyInstruction(0x0e, "ASL", AM_Absolute);
m_opcodeinfo[0x1e] = AssyInstruction(0x1e, "ASL", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x2e] = AssyInstruction(0x2e, "ROL", AM_Absolute);
m_opcodeinfo[0x3e] = AssyInstruction(0x3e, "ROL", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x4e] = AssyInstruction(0x4e, "LSR", AM_Absolute);
m_opcodeinfo[0x5e] = AssyInstruction(0x5e, "LSR", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x6e] = AssyInstruction(0x6e, "ROR", AM_Absolute);
m_opcodeinfo[0x7e] = AssyInstruction(0x7e, "ROR", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x8e] = AssyInstruction(0x8e, "STX", AM_Absolute);
m_opcodeinfo[0x9e] = AssyInstruction(0x9e, "sta/stx", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xae] = AssyInstruction(0xae, "LDX", AM_Absolute);
m_opcodeinfo[0xbe] = AssyInstruction(0xbe, "LDX", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xce] = AssyInstruction(0xce, "DEC", AM_Absolute);
m_opcodeinfo[0xde] = AssyInstruction(0xde, "DEC", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xee] = AssyInstruction(0xee, "INC", AM_Absolute);
m_opcodeinfo[0xfe] = AssyInstruction(0xfe, "INC", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x0f] = AssyInstruction(0x0f, "asl/ora", AM_Absolute);
m_opcodeinfo[0x1f] = AssyInstruction(0x1f, "asl/ora", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x2f] = AssyInstruction(0x2f, "rol/and", AM_Absolute);
m_opcodeinfo[0x3f] = AssyInstruction(0x3f, "rol/and", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x4f] = AssyInstruction(0x4f, "lsr/eor", AM_Absolute);
m_opcodeinfo[0x5f] = AssyInstruction(0x5f, "lsr/eor", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x6f] = AssyInstruction(0x6f, "ror/adc", AM_Absolute);
m_opcodeinfo[0x7f] = AssyInstruction(0x7f, "ror/adc", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0x8f] = AssyInstruction(0x8f, "sta/stx", AM_Absolute);
m_opcodeinfo[0x9f] = AssyInstruction(0x9f, "sta/stx", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xaf] = AssyInstruction(0xaf, "lda/ldx", AM_Absolute);
m_opcodeinfo[0xbf] = AssyInstruction(0xbf, "ldx/ldx", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0xcf] = AssyInstruction(0xcf, "dec/cmp", AM_Absolute);
m_opcodeinfo[0xdf] = AssyInstruction(0xdf, "dec/cmp", AM_AbsoluteIndexedWithX);
m_opcodeinfo[0xef] = AssyInstruction(0xef, "inc/sbc", AM_Absolute);
m_opcodeinfo[0xff] = AssyInstruction(0xff, "inc/sbc", AM_AbsoluteIndexedWithX);
#endif
}
void Disassembler::setUnknownToData(quint16 from, quint16 to)
{
@ -851,37 +305,6 @@ void Disassembler::setUnknownToData(quint16 from, quint16 to)
}
}
AssyInstruction::AssyInstruction(quint8 opcode, QString mnemonic, AddressMode am) {
m_opcode = opcode;
m_mnemonic = mnemonic;
m_addressMode = am;
}
quint8 AssyInstruction::numArgs() {
switch (m_addressMode) {
case AM_Absolute:
case AM_AbsoluteIndexedIndirect:
case AM_AbsoluteIndexedWithX:
case AM_AbsoluteIndexedWithY:
case AM_AbsoluteIndirect:
return 2;
case AM_ProgramCounterRelative:
case AM_ZeroPage:
case AM_ZeroPageIndirectIndexedWithY:
case AM_ZeroPageIndexedIndirect:
case AM_ZeroPageIndexedWithX:
case AM_ZeroPageIndexedWithY:
case AM_ZeroPageIndirect:
case AM_Immediate:
return 1;
case AM_InvalidOp:
case AM_Implied:
case AM_Accumulator:
default:
return 0;
}
}
DisassembledItem::DisassembledItem(AssyInstruction instr) {
m_canNotFollow = false;
setInstruction(instr);

View File

@ -4,6 +4,7 @@
#include "MemoryUsageMap.h"
#include "util.h"
#include "JumpLineManager.h"
#include "opcodes.h"
#include <QByteArray>
#include <QStringList>
@ -12,24 +13,24 @@
#include <QStack>
enum AddressMode {
AM_InvalidOp,
AM_Absolute, // a
AM_AbsoluteIndexedIndirect, // (a,x)
AM_AbsoluteIndexedWithX, // a,x
AM_AbsoluteIndexedWithY, // a,y
AM_AbsoluteIndirect, // (a)
AM_Immediate, // #
AM_Implied, // i
AM_Accumulator, // A
AM_ProgramCounterRelative, // r
AM_ZeroPage, // zp
AM_ZeroPageIndexedIndirect, // (zp,x)
AM_ZeroPageIndexedWithX, // zp,x
AM_ZeroPageIndexedWithY, // zp,y
AM_ZeroPageIndirect, // (zp)
AM_ZeroPageIndirectIndexedWithY // (zp),y
};
//enum AddressMode {
// AM_InvalidOp,
// AM_Absolute, // a
// AM_AbsoluteIndexedIndirect, // (a,x)
// AM_AbsoluteIndexedWithX, // a,x
// AM_AbsoluteIndexedWithY, // a,y
// AM_AbsoluteIndirect, // (a)
// AM_Immediate, // #
// AM_Implied, // i
// AM_Accumulator, // A
// AM_ProgramCounterRelative, // r
// AM_ZeroPage, // zp
// AM_ZeroPageIndexedIndirect, // (zp,x)
// AM_ZeroPageIndexedWithX, // zp,x
// AM_ZeroPageIndexedWithY, // zp,y
// AM_ZeroPageIndirect, // (zp)
// AM_ZeroPageIndirectIndexedWithY // (zp),y
//};
//////////////////////////////////////////////////////////////////////////////
class AddressStack
@ -56,27 +57,27 @@ class AddressStack
//////////////////////////////////////////////////////////////////////////////
struct AssyInstruction {
//struct AssyInstruction {
public:
//public:
AssyInstruction(quint8 opcode = 0x00, QString mnemonic = "???", AddressMode am = AM_InvalidOp);
// AssyInstruction(quint8 opcode = 0x00, QString mnemonic = "???", AddressMode am = AM_InvalidOp);
AddressMode addressMode() { return m_addressMode; }
// AddressMode addressMode() { return m_addressMode; }
QString mnemonic() { return m_mnemonic; }
// QString mnemonic() { return m_mnemonic; }
quint8 opcode() { return m_opcode; }
// quint8 opcode() { return m_opcode; }
quint8 numArgs();
// quint8 numArgs();
QString debugStr() { return QString("%1 %2 %3").arg(uint8ToHex(m_opcode)).arg(m_mnemonic).arg(m_addressMode); }
// QString debugStr() { return QString("%1 %2 %3").arg(uint8ToHex(m_opcode)).arg(m_mnemonic).arg(m_addressMode); }
private:
QString m_mnemonic;
quint8 m_opcode;
AddressMode m_addressMode;
};
//private:
// QString m_mnemonic;
// quint8 m_opcode;
// AddressMode m_addressMode;
//};
//////////////////////////////////////////////////////////////////////////////
class DisassembledItem {
@ -184,22 +185,16 @@ public:
void setUnknownToData(quint16 from, quint16 to);
QString getMnemonicForOp(quint8 opcode)
{
return m_opcodeinfo[opcode].mnemonic();
}
JumpLines getJumpLines() const { return m_jumplines; }
private:
bool disassembleOp(quint16 address, DisassembledItem &retval, MemoryUsageMap *memuse = Q_NULLPTR);
void makeOpcodeTable();
quint16 m_from;
quint16 m_to;
QHash<quint8,AssyInstruction> m_opcodeinfo;
QByteArray m_memimage;
AddressStack m_stack;

View File

@ -9,7 +9,6 @@
#include "diskfile.h"
#include "catalogsector.h"
#include "applesoftfile.h"
//#include "DiskExplorer.h"
#include "startupdialog.h"
int main(int argc, char** argv)
@ -23,9 +22,8 @@ int main(int argc, char** argv)
auto x = QFontDatabase::addApplicationFont(":/fonts/A2_40Col.ttf");
auto y = QFontDatabase::addApplicationFont(":/fonts/A2_80Col.ttf");
// qDebug("40Col: %d 80Col: %d",x,y);
// qDebug() << "40: " << QFontDatabase::applicationFontFamilies(0);
// qDebug() << "80: " << QFontDatabase::applicationFontFamilies(1);
if (x < 0) { qWarning("Could not load A2_40Col.ttf font."); }
if (y < 0) { qWarning("Could not load A2_80Col.ttf font."); }
StartupDialog w;
w.show();

View File

@ -0,0 +1,98 @@
#include "attributedmemory.h"
#include <QDebug>
AttributedMemory::AttributedMemory(quint16 expectedBottom,
quint16 expectedTop)
{
setExpectedRange(expectedBottom, expectedTop);
for (int idx = 0; idx <= 0xffff; idx++)
{
MemoryCell cell;
cell.setAddress(idx);
m_cells.append(cell);
}
}
void AttributedMemory::setExpectedRange(quint16 bottom, quint16 top)
{
m_expected_top = qMax(bottom,top);
m_expected_bottom = qMin(bottom,top);
}
bool AttributedMemory::setValueAt(quint16 address,
quint8 withValue,
MemRole *andRole)
{
m_cells[address].setValue(withValue);
if (andRole)
{
return setRoleAt(address, andRole);
}
return true;
}
bool AttributedMemory::setRoleAt(quint16 address,
MemRole *withRole)
{
if (withRole)
{
return m_cells[address].setRole(withRole);
}
return false;
}
bool AttributedMemory::hasRoleAt(quint16 address, int withId)
{
return m_cells[address].hasRole(withId);
}
MemRole *AttributedMemory::getRoleAt(quint16 address, int withId)
{
return m_cells[address].getRole(withId);
}
QList<MemRole *> AttributedMemory::getAllRolesAt(quint16 address)
{
return m_cells[address].getAllRoles();
}
QByteArray AttributedMemory::getAllValues() const
{
return getAllValuesInRange(0x0000,0x0ffff);
}
QByteArray AttributedMemory::getAllValuesInExpectedRange() const
{
return getAllValuesInRange(m_expected_bottom,m_expected_top);
}
QByteArray AttributedMemory::getAllValuesInRange(quint16 bottom, quint16 top) const
{
quint16 expbot = qMin(bottom,top);
quint16 exptop = qMax(bottom,top);
QByteArray retval;
for (int idx = expbot; idx <= exptop; idx++)
{
retval.append(m_cells.at(idx).value());
}
return retval;
}
bool AttributedMemory::addFile(QByteArray data, quint16 start)
{
if (start+data.length() > 65536) {
qWarning() << "Memory overflow adding data."; return false;
}
for (int idx = 0; idx < data.length(); idx++)
{
m_cells[start+idx].setValue(data[idx]);
}
return true;
}

View File

@ -0,0 +1,43 @@
#ifndef ATTRIBUTEDMEMORY_H
#define ATTRIBUTEDMEMORY_H
#include "memorycell.h"
class AttributedMemory
{
public:
AttributedMemory(quint16 expectedBottom = 0x0000,
quint16 expectedTop = 0xffff);
void setExpectedRange(quint16 bottom, quint16 top);
quint16 getExpectedBottom() const { return m_expected_bottom; }
quint16 getExpectedTop() const;
quint16 getExpectedSize() const { return m_expected_top-m_expected_bottom; }
bool setValueAt(quint16 address, quint8 withValue, MemRole *andRole = nullptr);
quint8 valueAt(quint16 address) const { return m_cells[address].value(); };
bool setRoleAt(quint16 address, MemRole *withRole);
bool hasRoleAt(quint16 address, int withId);
MemRole *getRoleAt(quint16 address, int withId);
QList<MemRole *> getAllRolesAt(quint16 address);
QByteArray getAllValues() const;
QByteArray getAllValuesInExpectedRange() const;
QByteArray getAllValuesInRange(quint16 bottom, quint16 top) const;
quint8 at(quint16 address) const { return m_cells[address].value(); }
bool addFile(QByteArray data, quint16 start); // From Memory.h. Should be replaced?
protected:
quint16 m_expected_bottom;
quint16 m_expected_top;
QList<MemoryCell> m_cells;
};
#endif // ATTRIBUTEDMEMORY_H

51
src/memory/memorycell.cpp Normal file
View File

@ -0,0 +1,51 @@
#include "memorycell.h"
MemoryCell::MemoryCell(quint8 val)
{
m_value = val;
}
MemoryCell::~MemoryCell()
{
auto keys = m_roles.keys();
foreach (auto key, keys)
{
delete (m_roles.take(key));
}
}
bool MemoryCell::setRole(MemRole *role)
{
if (!role) return false;
if (hasRole(role->id()))
{
return false;
}
m_roles.insert(role->id(),role);
role->setParent(this);
return true;
}
MemRole *MemoryCell::getRole(int id)
{
if (hasRole(id))
{
return m_roles[id];
}
return nullptr;
}
bool MemoryCell::hasRole(int id) const
{
return m_roles.contains(id);
}
QList<MemRole *> MemoryCell::getAllRoles()
{
return m_roles.values();
}

35
src/memory/memorycell.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef MEMORYCELL_H
#define MEMORYCELL_H
#include "memrole.h"
#include <Qt>
#include <QHash>
class MemoryCell
{
public:
MemoryCell(quint8 val = 0);
virtual ~MemoryCell();
void setAddress(quint16 address) { m_address = address; }
quint16 address() const { return m_address; }
bool setRole(MemRole *role);
MemRole *getRole(int id);
bool hasRole(int id) const;
void setValue(quint8 val) { m_value = val; }
quint8 value() const { return m_value; }
operator quint8() const { return m_value; }
QList<MemRole *> getAllRoles();
private:
quint8 m_value;
quint16 m_address;
QHash<int,MemRole *> m_roles;
};
#endif // MEMORYCELL_H

16
src/memory/memrole.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "memrole.h"
MemRole::MemRole()
{
m_parent = nullptr;
}
MemRole::~MemRole()
{
}
void MemRole::setParent(MemoryCell *parent)
{
m_parent = parent;
}

22
src/memory/memrole.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef MEMROLE_H
#define MEMROLE_H
class MemoryCell;
class MemRole
{
public:
MemRole();
virtual ~MemRole();
virtual int id() const = 0;
void setParent(MemoryCell *parent);
MemoryCell *parent( ) const { return m_parent; }
protected:
MemoryCell *m_parent;
};
#endif // MEMROLE_H

View File

@ -0,0 +1,18 @@
#include "role_asm_opcode.h"
#include "opcodes.h"
#include "memorycell.h"
RoleAsmOpcode::RoleAsmOpcode()
{
}
RoleAsmOpcode::~RoleAsmOpcode()
{
}
QString RoleAsmOpcode::getMnemonic()
{
return OpCodes::getMnemonic(m_parent->value());
}

View File

@ -0,0 +1,19 @@
#ifndef ROLE_ASM_OPCODE_H
#define ROLE_ASM_OPCODE_H
#include "memrole.h"
#include <QString>
class RoleAsmOpcode : public MemRole
{
public:
RoleAsmOpcode();
virtual ~RoleAsmOpcode();
virtual int id() const { return 1; }
QString getMnemonic();
};
#endif // ROLE_ASM_OPCODE_H

View File

@ -1,20 +1,20 @@
KREATIVE SOFTWARE RELAY FONTS FREE USE LICENSE
version 1.2f
Permission is hereby granted, free of charge, to any person or entity (the "User") obtaining a copy of the included font files (the "Software") produced by Kreative Software, to utilize, display, embed, or redistribute the Software, subject to the following conditions:
1. The User may not sell copies of the Software for a fee.
1a. The User may give away copies of the Software free of charge provided this license and any documentation is included verbatim and credit is given to Kreative Korporation or Kreative Software.
2. The User may not modify, reverse-engineer, or create any derivative works of the Software.
3. Any Software carrying the following font names or variations thereof is not covered by this license and may not be used under the terms of this license: Jewel Hill, Miss Diode n Friends, This is Beckie's font!
3a. Any Software carrying a font name ending with the string "Pro CE" is not covered by this license and may not be used under the terms of this license.
4. This license becomes null and void if any of the above conditions are not met.
5. Kreative Software reserves the right to change this license at any time without notice.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE SOFTWARE OR FROM OTHER DEALINGS IN THE SOFTWARE.
KREATIVE SOFTWARE RELAY FONTS FREE USE LICENSE
version 1.2f
Permission is hereby granted, free of charge, to any person or entity (the "User") obtaining a copy of the included font files (the "Software") produced by Kreative Software, to utilize, display, embed, or redistribute the Software, subject to the following conditions:
1. The User may not sell copies of the Software for a fee.
1a. The User may give away copies of the Software free of charge provided this license and any documentation is included verbatim and credit is given to Kreative Korporation or Kreative Software.
2. The User may not modify, reverse-engineer, or create any derivative works of the Software.
3. Any Software carrying the following font names or variations thereof is not covered by this license and may not be used under the terms of this license: Jewel Hill, Miss Diode n Friends, This is Beckie's font!
3a. Any Software carrying a font name ending with the string "Pro CE" is not covered by this license and may not be used under the terms of this license.
4. This license becomes null and void if any of the above conditions are not met.
5. Kreative Software reserves the right to change this license at any time without notice.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE SOFTWARE OR FROM OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,64 +1,64 @@
# AppleSAWS
## Apple Software Analysis WorkShop v.0.0.3pr
https://github.com/markdavidlong/AppleSAWS
### Welcome
This is a toolkit for exploring DOS 3.3 disk images and their contents. I started this because
I had become interested in a game that I used to play a long time ago and I
wanted to dig deeper into the internals of how it worked. Since it was a nice
combination of a series of Applesoft and Binary files, I decided that a tool
to help explore those types of things would be handy. Of course, I've ended
up spending far more time writing the tool than I have actually exploring the
game, but nonetheless, it's been a fun ongoing project.
***
### Legal Stuff:
I am grateful to be able to include a couple of wonderful Apple II inspired fonts
from KreativeKorp, **Print Char 21** and **PR Number 3** available from
https://www.kreativekorp.com/software/fonts/apple2.shtml
Accordingly, here is their license:
```
KREATIVE SOFTWARE RELAY FONTS FREE USE LICENSE
version 1.2f
Permission is hereby granted, free of charge, to any person or entity (the "User") obtaining a copy of the included font files (the "Software") produced by Kreative Software, to utilize, display, embed, or redistribute the Software, subject to the following conditions:
1. The User may not sell copies of the Software for a fee.
1a. The User may give away copies of the Software free of charge provided this license and any documentation is included verbatim and credit is given to Kreative Korporation or Kreative Software.
2. The User may not modify, reverse-engineer, or create any derivative works of the Software.
3. Any Software carrying the following font names or variations thereof is not covered by this license and may not be used under the terms of this license: Jewel Hill, Miss Diode n Friends, This is Beckie's font!
3a. Any Software carrying a font name ending with the string "Pro CE" is not covered by this license and may not be used under the terms of this license.
4. This license becomes null and void if any of the above conditions are not met.
5. Kreative Software reserves the right to change this license at any time without notice.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE SOFTWARE OR FROM OTHER DEALINGS IN THE SOFTWARE.
```
***
And, of course, this program is released under the MIT License:
```
The MIT License (MIT)
Copyright (c) 2015-2021 Mark D. Long
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
# AppleSAWS
## Apple Software Analysis WorkShop v.0.0.3pr
https://github.com/markdavidlong/AppleSAWS
### Welcome
This is a toolkit for exploring DOS 3.3 disk images and their contents. I started this because
I had become interested in a game that I used to play a long time ago and I
wanted to dig deeper into the internals of how it worked. Since it was a nice
combination of a series of Applesoft and Binary files, I decided that a tool
to help explore those types of things would be handy. Of course, I've ended
up spending far more time writing the tool than I have actually exploring the
game, but nonetheless, it's been a fun ongoing project.
***
### Legal Stuff:
I am grateful to be able to include a couple of wonderful Apple II inspired fonts
from KreativeKorp, **Print Char 21** and **PR Number 3** available from
https://www.kreativekorp.com/software/fonts/apple2.shtml
Accordingly, here is their license:
```
KREATIVE SOFTWARE RELAY FONTS FREE USE LICENSE
version 1.2f
Permission is hereby granted, free of charge, to any person or entity (the "User") obtaining a copy of the included font files (the "Software") produced by Kreative Software, to utilize, display, embed, or redistribute the Software, subject to the following conditions:
1. The User may not sell copies of the Software for a fee.
1a. The User may give away copies of the Software free of charge provided this license and any documentation is included verbatim and credit is given to Kreative Korporation or Kreative Software.
2. The User may not modify, reverse-engineer, or create any derivative works of the Software.
3. Any Software carrying the following font names or variations thereof is not covered by this license and may not be used under the terms of this license: Jewel Hill, Miss Diode n Friends, This is Beckie's font!
3a. Any Software carrying a font name ending with the string "Pro CE" is not covered by this license and may not be used under the terms of this license.
4. This license becomes null and void if any of the above conditions are not met.
5. Kreative Software reserves the right to change this license at any time without notice.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE SOFTWARE OR FROM OTHER DEALINGS IN THE SOFTWARE.
```
***
And, of course, this program is released under the MIT License:
```
The MIT License (MIT)
Copyright (c) 2015-2021 Mark D. Long
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```

View File

@ -1,10 +1,10 @@
<RCC>
<qresource prefix="/fonts">
<file>FreeLicense.txt</file>
<file alias="A2_40Col.ttf">PrintChar21.ttf</file>
<file alias="A2_80Col.ttf">PRNumber3.ttf</file>
</qresource>
<qresource prefix="/notes">
<file>notes.txt</file>
</qresource>
</RCC>
<RCC>
<qresource prefix="/fonts">
<file>FreeLicense.txt</file>
<file alias="A2_40Col.ttf">PrintChar21.ttf</file>
<file alias="A2_80Col.ttf">PRNumber3.ttf</file>
</qresource>
<qresource prefix="/notes">
<file>notes.txt</file>
</qresource>
</RCC>

View File

@ -1,43 +1,43 @@
#include "startupdialog.h"
#include "ui_startupdialog.h"
#include "diskexplorer/DiskExplorer.h"
#include <QFileDialog>
StartupDialog::StartupDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::StartupDialog)
{
m_notes = new NotesDialog(this);
ui->setupUi(this);
}
StartupDialog::~StartupDialog()
{
delete ui;
}
void StartupDialog::on_exploreContentsBtn_clicked()
{
DiskExplorer *w = new DiskExplorer(this);
w->showLoadDialog(false);
}
void StartupDialog::on_exploreDiskImageBtn_clicked()
{
}
void StartupDialog::on_bootSectorCompareBtn_clicked()
{
}
void StartupDialog::on_infoBtn_clicked()
{
m_notes->show();
}
#include "startupdialog.h"
#include "ui_startupdialog.h"
#include "diskexplorer/DiskExplorer.h"
#include <QFileDialog>
StartupDialog::StartupDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::StartupDialog)
{
m_notes = new NotesDialog(this);
ui->setupUi(this);
}
StartupDialog::~StartupDialog()
{
delete ui;
}
void StartupDialog::on_exploreContentsBtn_clicked()
{
DiskExplorer *w = new DiskExplorer(this);
w->showLoadDialog(false);
}
void StartupDialog::on_exploreDiskImageBtn_clicked()
{
}
void StartupDialog::on_bootSectorCompareBtn_clicked()
{
}
void StartupDialog::on_infoBtn_clicked()
{
m_notes->show();
}

View File

@ -1,41 +1,41 @@
#ifndef STARTUPDIALOG_H
#define STARTUPDIALOG_H
#include "notesdialog.h"
#include "hrcgcontrolsinfo.h"
#include "hexconverter.h"
#include "hexdumpviewer.h"
#include <QDialog>
#include "asciiinfodialog.h"
namespace Ui {
class StartupDialog;
}
class StartupDialog : public QDialog
{
Q_OBJECT
public:
explicit StartupDialog(QWidget *parent = nullptr);
~StartupDialog();
private slots:
void on_exploreContentsBtn_clicked();
void on_exploreDiskImageBtn_clicked();
void on_bootSectorCompareBtn_clicked();
void on_infoBtn_clicked();
private:
Ui::StartupDialog *ui;
NotesDialog *m_notes;
HRCGControlsInfo *m_hrcgDialog;
HexConverter *m_hexConverter;
AsciiInfoDialog *m_AsciiInfoDialog;
};
#endif // STARTUPDIALOG_H
#ifndef STARTUPDIALOG_H
#define STARTUPDIALOG_H
#include "notesdialog.h"
#include "hrcgcontrolsinfo.h"
#include "hexconverter.h"
#include "hexdumpviewer.h"
#include <QDialog>
#include "asciiinfodialog.h"
namespace Ui {
class StartupDialog;
}
class StartupDialog : public QDialog
{
Q_OBJECT
public:
explicit StartupDialog(QWidget *parent = nullptr);
~StartupDialog();
private slots:
void on_exploreContentsBtn_clicked();
void on_exploreDiskImageBtn_clicked();
void on_bootSectorCompareBtn_clicked();
void on_infoBtn_clicked();
private:
Ui::StartupDialog *ui;
NotesDialog *m_notes;
HRCGControlsInfo *m_hrcgDialog;
HexConverter *m_hexConverter;
AsciiInfoDialog *m_AsciiInfoDialog;
};
#endif // STARTUPDIALOG_H

View File

@ -1,153 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StartupDialog</class>
<widget class="QDialog" name="StartupDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>312</width>
<height>197</height>
</rect>
</property>
<property name="windowTitle">
<string>AppleSAWS</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>122</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="exploreContentsBtn">
<property name="text">
<string>Explore Disk Image Contents ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="exploreDiskImageBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Explore Disk Image File ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bootSectorCompareBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Boot Sector Comparison ...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>20</number>
</property>
<item>
<widget class="QLabel" name="titleLabel">
<property name="font">
<font>
<family>Arial</family>
<pointsize>18</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>AppleSAWS</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="versionLabel">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>V. 0.0.3pr</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="infoBtn">
<property name="text">
<string>?</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="copyrightLabel">
<property name="text">
<string>(C) 2015-2021 Mark D. Long</string>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StartupDialog</class>
<widget class="QDialog" name="StartupDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>312</width>
<height>197</height>
</rect>
</property>
<property name="windowTitle">
<string>AppleSAWS</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>122</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="exploreContentsBtn">
<property name="text">
<string>Explore Disk Image Contents ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="exploreDiskImageBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Explore Disk Image File ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bootSectorCompareBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Boot Sector Comparison ...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>20</number>
</property>
<item>
<widget class="QLabel" name="titleLabel">
<property name="font">
<font>
<family>Arial</family>
<pointsize>18</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>AppleSAWS</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="versionLabel">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>V. 0.0.3pr</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="infoBtn">
<property name="text">
<string>?</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="copyrightLabel">
<property name="text">
<string>(C) 2015-2021 Mark D. Long</string>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -4,6 +4,8 @@
#include "memory.h"
#include "util.h"
#include "relocatablefile.h"
#include "opcodes.h"
#include <QSettings>
#include <QMenu>
@ -152,7 +154,8 @@ QStringList DisassemblerViewer::getDisassemblyStrings() {
void DisassemblerViewer::disassemble(QList<quint16> entryPoints) {
Disassembler dis(m_mem.values());
//Disassembler dis(m_mem.values());
Disassembler dis(m_mem.getAllValues());
int length = m_file->length();
qDebug() << "DV: from: << " << m_file->address() << " to " << length;
int end = m_file->address()+length;
@ -241,7 +244,7 @@ void DisassemblerViewer::disassemble(QList<quint16> entryPoints) {
newline += QString("%1: %2 %3\t(%4)\t'%5'").arg(uint16ToHex(idx))
.arg(uint8ToHex(m_mem.at(idx)))
.arg(makeDescriptorStringForVal(m_mem.at(idx)))
.arg(dis.getMnemonicForOp(m_mem.at(idx)))
.arg(OpCodes::getMnemonic(m_mem.at(idx)))
.arg(AppleChar::printable(m_mem.at(idx)));
}
formattedLines.append(newline);

View File

@ -4,7 +4,8 @@
#include <QWidget>
#include <QByteArray>
#include "memory.h"
//#include "memory.h"
#include "attributedmemory.h"
#include "binaryfile.h"
#include "relocatablefile.h"
#include "fileviewerinterface.h"
@ -61,7 +62,8 @@ private:
BinaryFileMetadata *m_bfm;
Memory m_mem;
//Memory m_mem;
AttributedMemory m_mem;
bool m_isRelo;

View File

@ -1,28 +1,28 @@
#include "notesdialog.h"
#include "ui_notesdialog.h"
#include <QFile>
NotesDialog::NotesDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::NotesDialog)
{
ui->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QByteArray text;
QFile notes(":/notes/notes.txt");
if (notes.open(QIODevice::ReadOnly | QIODevice::Text))
{
text = notes.readAll();
notes.close();
}
else
{
text = "No notes available right now! Maybe next version!";
}
ui->notesArea->setMarkdown(text);
}
NotesDialog::~NotesDialog()
{
delete ui;
}
#include "notesdialog.h"
#include "ui_notesdialog.h"
#include <QFile>
NotesDialog::NotesDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::NotesDialog)
{
ui->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QByteArray text;
QFile notes(":/notes/notes.txt");
if (notes.open(QIODevice::ReadOnly | QIODevice::Text))
{
text = notes.readAll();
notes.close();
}
else
{
text = "No notes available right now! Maybe next version!";
}
ui->notesArea->setMarkdown(text);
}
NotesDialog::~NotesDialog()
{
delete ui;
}

View File

@ -1,22 +1,22 @@
#ifndef NOTESDIALOG_H
#define NOTESDIALOG_H
#include <QDialog>
namespace Ui {
class NotesDialog;
}
class NotesDialog : public QDialog
{
Q_OBJECT
public:
explicit NotesDialog(QWidget *parent = nullptr);
~NotesDialog();
private:
Ui::NotesDialog *ui;
};
#endif // NOTESDIALOG_H
#ifndef NOTESDIALOG_H
#define NOTESDIALOG_H
#include <QDialog>
namespace Ui {
class NotesDialog;
}
class NotesDialog : public QDialog
{
Q_OBJECT
public:
explicit NotesDialog(QWidget *parent = nullptr);
~NotesDialog();
private:
Ui::NotesDialog *ui;
};
#endif // NOTESDIALOG_H

View File

@ -1,86 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NotesDialog</class>
<widget class="QDialog" name="NotesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>479</width>
<height>409</height>
</rect>
</property>
<property name="windowTitle">
<string>AppleSAWS</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Application Notes</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="notesArea">
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="openLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>NotesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>NotesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NotesDialog</class>
<widget class="QDialog" name="NotesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>479</width>
<height>409</height>
</rect>
</property>
<property name="windowTitle">
<string>AppleSAWS</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Application Notes</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="notesArea">
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="openLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>NotesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>NotesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

586
src/util/opcodes.cpp Normal file
View File

@ -0,0 +1,586 @@
#include "opcodes.h"
OpCodes::OpCodes()
{
}
void OpCodes::makeOpcodeTable(QHash<quint8,AssyInstruction>* opcode_table)
{
opcode_table->insert(0x00,AssyInstruction(0x00, "BRK", AM_Implied));
opcode_table->insert(0x10,AssyInstruction(0x10, "BPL", AM_ProgramCounterRelative));
opcode_table->insert(0x20,AssyInstruction(0x20, "JSR", AM_Absolute));
opcode_table->insert(0x30,AssyInstruction(0x30, "BMI", AM_ProgramCounterRelative));
opcode_table->insert(0x40,AssyInstruction(0x40, "RTI", AM_Implied));
opcode_table->insert(0x50,AssyInstruction(0x50, "BVC", AM_ProgramCounterRelative));
opcode_table->insert(0x60,AssyInstruction(0x60, "RTS", AM_Implied));
opcode_table->insert(0x70,AssyInstruction(0x70, "BVS", AM_ProgramCounterRelative));
opcode_table->insert(0x80,AssyInstruction(0x80, "BRA", AM_ProgramCounterRelative)); //65C02
opcode_table->insert(0x90,AssyInstruction(0x90, "BCC", AM_ProgramCounterRelative));
opcode_table->insert(0xa0,AssyInstruction(0xa0, "LDY", AM_Immediate));
opcode_table->insert(0xb0,AssyInstruction(0xb0, "BCS", AM_ProgramCounterRelative));
opcode_table->insert(0xc0,AssyInstruction(0xc0, "CPY", AM_Immediate));
opcode_table->insert(0xd0,AssyInstruction(0xd0, "BNE", AM_ProgramCounterRelative));
opcode_table->insert(0xe0,AssyInstruction(0xe0, "CPX", AM_Immediate));
opcode_table->insert(0xf0,AssyInstruction(0xf0, "BEQ", AM_ProgramCounterRelative));
opcode_table->insert(0x01,AssyInstruction(0x01, "ORA", AM_ZeroPageIndexedIndirect));
opcode_table->insert(0x11,AssyInstruction(0x11, "ORA", AM_ZeroPageIndirectIndexedWithY));
opcode_table->insert(0x21,AssyInstruction(0x21, "AND", AM_ZeroPageIndexedIndirect));
opcode_table->insert(0x31,AssyInstruction(0x31, "AND", AM_ZeroPageIndirectIndexedWithY));
opcode_table->insert(0x41,AssyInstruction(0x41, "EOR", AM_ZeroPageIndexedIndirect));
opcode_table->insert(0x51,AssyInstruction(0x51, "EOR", AM_ZeroPageIndirectIndexedWithY));
opcode_table->insert(0x61,AssyInstruction(0x61, "ADC", AM_ZeroPageIndexedIndirect));
opcode_table->insert(0x71,AssyInstruction(0x71, "ADC", AM_ZeroPageIndirectIndexedWithY));
opcode_table->insert(0x81,AssyInstruction(0x81, "STA", AM_ZeroPageIndexedIndirect));
opcode_table->insert(0x91,AssyInstruction(0x91, "STA", AM_ZeroPageIndirectIndexedWithY));
opcode_table->insert(0xa1,AssyInstruction(0xa1, "LDA", AM_ZeroPageIndexedIndirect));
opcode_table->insert(0xb1,AssyInstruction(0xb1, "LDA", AM_ZeroPageIndirectIndexedWithY));
opcode_table->insert(0xc1,AssyInstruction(0xc1, "CMP", AM_ZeroPageIndexedIndirect));
opcode_table->insert(0xd1,AssyInstruction(0xd1, "CMP", AM_ZeroPageIndirectIndexedWithY));
opcode_table->insert(0xe1,AssyInstruction(0xe1, "SBC", AM_ZeroPageIndexedIndirect));
opcode_table->insert(0xf1,AssyInstruction(0xff, "SBC", AM_ZeroPageIndirectIndexedWithY));
opcode_table->insert(0x02,AssyInstruction(0x02, "???", AM_InvalidOp));
opcode_table->insert(0x12,AssyInstruction(0x12, "ORA", AM_ZeroPageIndirect));
opcode_table->insert(0x22,AssyInstruction(0x22, "???", AM_InvalidOp));
opcode_table->insert(0x32,AssyInstruction(0x32, "AND", AM_ZeroPageIndirect));
opcode_table->insert(0x42,AssyInstruction(0x42, "???", AM_InvalidOp));
opcode_table->insert(0x52,AssyInstruction(0x52, "EOR", AM_ZeroPageIndirect));
opcode_table->insert(0x62,AssyInstruction(0x62, "???", AM_InvalidOp));
opcode_table->insert(0x72,AssyInstruction(0x72, "ADC", AM_ZeroPageIndirect));
opcode_table->insert(0x82,AssyInstruction(0x82, "???", AM_InvalidOp));
opcode_table->insert(0x92,AssyInstruction(0x92, "STA", AM_ZeroPageIndirect)); //65C02
opcode_table->insert(0xa2,AssyInstruction(0xa2, "LDX", AM_Immediate));
opcode_table->insert(0xb2,AssyInstruction(0xb2, "LDA", AM_ZeroPageIndirect)); //65C02
opcode_table->insert(0xc2,AssyInstruction(0xc2, "???", AM_InvalidOp));
opcode_table->insert(0xd2,AssyInstruction(0xd2, "CMP", AM_ZeroPageIndirect));
opcode_table->insert(0xe2,AssyInstruction(0xe2, "???", AM_InvalidOp));
opcode_table->insert(0xf2,AssyInstruction(0xf2, "SBC", AM_ZeroPageIndirect));
opcode_table->insert(0x03,AssyInstruction(0x03, "???", AM_InvalidOp));
opcode_table->insert(0x13,AssyInstruction(0x13, "???", AM_InvalidOp));
opcode_table->insert(0x23,AssyInstruction(0x23, "???", AM_InvalidOp));
opcode_table->insert(0x33,AssyInstruction(0x33, "???", AM_InvalidOp));
opcode_table->insert(0x43,AssyInstruction(0x43, "???", AM_InvalidOp));
opcode_table->insert(0x53,AssyInstruction(0x53, "???", AM_InvalidOp));
opcode_table->insert(0x63,AssyInstruction(0x63, "???", AM_InvalidOp));
opcode_table->insert(0x73,AssyInstruction(0x73, "???", AM_InvalidOp));
opcode_table->insert(0x83,AssyInstruction(0x83, "???", AM_InvalidOp));
opcode_table->insert(0x93,AssyInstruction(0x93, "???", AM_InvalidOp));
opcode_table->insert(0xa3,AssyInstruction(0xa3, "???", AM_InvalidOp));
opcode_table->insert(0xb3,AssyInstruction(0xb3, "???", AM_InvalidOp));
opcode_table->insert(0xc3,AssyInstruction(0xc3, "???", AM_InvalidOp));
opcode_table->insert(0xd3,AssyInstruction(0xd3, "???", AM_InvalidOp));
opcode_table->insert(0xe3,AssyInstruction(0xe3, "???", AM_InvalidOp));
opcode_table->insert(0xf3,AssyInstruction(0xf3, "???", AM_InvalidOp));
opcode_table->insert(0x04,AssyInstruction(0x04, "TSB", AM_ZeroPage)); //65C02
opcode_table->insert(0x14,AssyInstruction(0x14, "TRB", AM_ZeroPage)); //65C02
opcode_table->insert(0x24,AssyInstruction(0x24, "BIT", AM_ZeroPage));
opcode_table->insert(0x34,AssyInstruction(0x34, "BIT", AM_ZeroPageIndexedWithX)); //65C02
opcode_table->insert(0x44,AssyInstruction(0x44, "???", AM_InvalidOp));
opcode_table->insert(0x54,AssyInstruction(0x54, "???", AM_InvalidOp));
opcode_table->insert(0x64,AssyInstruction(0x64, "STZ", AM_ZeroPage)); //65C02
opcode_table->insert(0x74,AssyInstruction(0x74, "STZ", AM_ZeroPageIndexedWithX)); //65C02
opcode_table->insert(0x84,AssyInstruction(0x84, "STY", AM_ZeroPage));
opcode_table->insert(0x94,AssyInstruction(0x94, "STY", AM_ZeroPageIndexedWithX));
opcode_table->insert(0xa4,AssyInstruction(0xa4, "LDY", AM_ZeroPage));
opcode_table->insert(0xb4,AssyInstruction(0xb4, "LDY", AM_ZeroPageIndexedWithX));
opcode_table->insert(0xc4,AssyInstruction(0xc4, "CPY", AM_ZeroPage));
opcode_table->insert(0xd4,AssyInstruction(0xd4, "???", AM_InvalidOp));
opcode_table->insert(0xe4,AssyInstruction(0xe4, "CPX", AM_ZeroPage));
opcode_table->insert(0xf4,AssyInstruction(0xf4, "???", AM_InvalidOp));
opcode_table->insert(0x05,AssyInstruction(0x05, "ORA", AM_ZeroPage));
opcode_table->insert(0x15,AssyInstruction(0x15, "ORA", AM_ZeroPageIndexedWithX));
opcode_table->insert(0x25,AssyInstruction(0x25, "AND", AM_ZeroPage));
opcode_table->insert(0x35,AssyInstruction(0x35, "AND", AM_ZeroPageIndexedWithX));
opcode_table->insert(0x45,AssyInstruction(0x45, "EOR", AM_ZeroPage));
opcode_table->insert(0x55,AssyInstruction(0x55, "EOR", AM_ZeroPageIndexedWithX));
opcode_table->insert(0x65,AssyInstruction(0x65, "ADC", AM_ZeroPage));
opcode_table->insert(0x75,AssyInstruction(0x75, "ADC", AM_ZeroPageIndexedWithX));
opcode_table->insert(0x85,AssyInstruction(0x85, "STA", AM_ZeroPage));
opcode_table->insert(0x95,AssyInstruction(0x95, "STA", AM_ZeroPageIndexedWithX));
opcode_table->insert(0xa5,AssyInstruction(0xa5, "LDA", AM_ZeroPage));
opcode_table->insert(0xb5,AssyInstruction(0xb5, "LDA", AM_ZeroPageIndexedWithX));
opcode_table->insert(0xc5,AssyInstruction(0xc5, "CMP", AM_ZeroPage));
opcode_table->insert(0xd5,AssyInstruction(0xd5, "CMP", AM_ZeroPageIndexedWithX));
opcode_table->insert(0xe5,AssyInstruction(0xe5, "SEC", AM_ZeroPage));
opcode_table->insert(0xf5,AssyInstruction(0xf5, "SEC", AM_ZeroPageIndexedWithX));
opcode_table->insert(0x06,AssyInstruction(0x06, "ASL", AM_ZeroPage));
opcode_table->insert(0x16,AssyInstruction(0x16, "ASL", AM_ZeroPageIndexedWithX));
opcode_table->insert(0x26,AssyInstruction(0x26, "ROL", AM_ZeroPage));
opcode_table->insert(0x36,AssyInstruction(0x36, "ROL", AM_ZeroPageIndexedWithX));
opcode_table->insert(0x46,AssyInstruction(0x46, "LSR", AM_ZeroPage));
opcode_table->insert(0x56,AssyInstruction(0x56, "LSR", AM_ZeroPageIndexedWithX));
opcode_table->insert(0x66,AssyInstruction(0x66, "ROR", AM_ZeroPage));
opcode_table->insert(0x76,AssyInstruction(0x76, "ROR", AM_ZeroPageIndexedWithX));
opcode_table->insert(0x86,AssyInstruction(0x86, "STX", AM_ZeroPage));
opcode_table->insert(0x96,AssyInstruction(0x96, "STX", AM_ZeroPageIndexedWithY));
opcode_table->insert(0xa6,AssyInstruction(0xa6, "LDX", AM_ZeroPage));
opcode_table->insert(0xb6,AssyInstruction(0xb6, "LDX", AM_ZeroPageIndexedWithY));
opcode_table->insert(0xc6,AssyInstruction(0xc6, "DEC", AM_ZeroPage));
opcode_table->insert(0xd6,AssyInstruction(0xd6, "DEC", AM_ZeroPageIndexedWithX));
opcode_table->insert(0xe6,AssyInstruction(0xe6, "INC", AM_ZeroPage));
opcode_table->insert(0xf6,AssyInstruction(0xf6, "INC", AM_ZeroPageIndexedWithX));
opcode_table->insert(0x07,AssyInstruction(0x07, "???", AM_InvalidOp));
opcode_table->insert(0x17,AssyInstruction(0x17, "???", AM_InvalidOp));
opcode_table->insert(0x27,AssyInstruction(0x27, "???", AM_InvalidOp));
opcode_table->insert(0x37,AssyInstruction(0x37, "???", AM_InvalidOp));
opcode_table->insert(0x47,AssyInstruction(0x47, "???", AM_InvalidOp));
opcode_table->insert(0x57,AssyInstruction(0x57, "???", AM_InvalidOp));
opcode_table->insert(0x67,AssyInstruction(0x67, "???", AM_InvalidOp));
opcode_table->insert(0x77,AssyInstruction(0x77, "???", AM_InvalidOp));
opcode_table->insert(0x87,AssyInstruction(0x87, "???", AM_InvalidOp));
opcode_table->insert(0x97,AssyInstruction(0x97, "???", AM_InvalidOp));
opcode_table->insert(0xa7,AssyInstruction(0xa7, "???", AM_InvalidOp));
opcode_table->insert(0xb7,AssyInstruction(0xb7, "???", AM_InvalidOp));
opcode_table->insert(0xc7,AssyInstruction(0xc7, "???", AM_InvalidOp));
opcode_table->insert(0xd7,AssyInstruction(0xd7, "???", AM_InvalidOp));
opcode_table->insert(0xe7,AssyInstruction(0xe7, "???", AM_InvalidOp));
opcode_table->insert(0xf7,AssyInstruction(0xf7, "???", AM_InvalidOp));
opcode_table->insert(0x08,AssyInstruction(0x08, "PHP", AM_Implied));
opcode_table->insert(0x18,AssyInstruction(0x18, "CLC", AM_Implied));
opcode_table->insert(0x28,AssyInstruction(0x28, "PLP", AM_Implied));
opcode_table->insert(0x38,AssyInstruction(0x38, "SEC", AM_Implied));
opcode_table->insert(0x48,AssyInstruction(0x48, "PHA", AM_Implied));
opcode_table->insert(0x58,AssyInstruction(0x58, "CLI", AM_Implied));
opcode_table->insert(0x68,AssyInstruction(0x68, "PLA", AM_Implied));
opcode_table->insert(0x78,AssyInstruction(0x78, "SEI", AM_Implied));
opcode_table->insert(0x88,AssyInstruction(0x88, "DEY", AM_Implied));
opcode_table->insert(0x98,AssyInstruction(0x98, "TYA", AM_Implied));
opcode_table->insert(0xa8,AssyInstruction(0xa8, "TAY", AM_Implied));
opcode_table->insert(0xb8,AssyInstruction(0xb8, "CLV", AM_Implied));
opcode_table->insert(0xc8,AssyInstruction(0xc8, "INY", AM_Implied));
opcode_table->insert(0xd8,AssyInstruction(0xd8, "CLD", AM_Implied));
opcode_table->insert(0xe8,AssyInstruction(0xe8, "INX", AM_Implied));
opcode_table->insert(0xf8,AssyInstruction(0xf8, "SED", AM_Implied));
opcode_table->insert(0x09,AssyInstruction(0x09, "ORA", AM_Immediate));
opcode_table->insert(0x19,AssyInstruction(0x19, "ORA", AM_AbsoluteIndexedWithY));
opcode_table->insert(0x29,AssyInstruction(0x29, "AND", AM_Immediate));
opcode_table->insert(0x39,AssyInstruction(0x39, "AND", AM_AbsoluteIndexedWithY));
opcode_table->insert(0x49,AssyInstruction(0x49, "EOR", AM_Immediate));
opcode_table->insert(0x59,AssyInstruction(0x59, "EOR", AM_AbsoluteIndexedWithY));
opcode_table->insert(0x69,AssyInstruction(0x69, "ADC", AM_Immediate));
opcode_table->insert(0x79,AssyInstruction(0x79, "ADC", AM_AbsoluteIndexedWithY));
opcode_table->insert(0x89,AssyInstruction(0x89, "BIT", AM_Immediate)); //65C02
opcode_table->insert(0x99,AssyInstruction(0x99, "STA", AM_AbsoluteIndexedWithY));
opcode_table->insert(0xa9,AssyInstruction(0xa9, "LDA", AM_Immediate));
opcode_table->insert(0xb9,AssyInstruction(0xb9, "LDA", AM_AbsoluteIndexedWithY));
opcode_table->insert(0xc9,AssyInstruction(0xc9, "CMP", AM_Immediate));
opcode_table->insert(0xd9,AssyInstruction(0xd9, "CMP", AM_AbsoluteIndexedWithY));
opcode_table->insert(0xe9,AssyInstruction(0xe9, "SBC", AM_Immediate));
opcode_table->insert(0xf9,AssyInstruction(0xf9, "SBC", AM_AbsoluteIndexedWithY));
opcode_table->insert(0x0a,AssyInstruction(0x0a, "ASL", AM_Accumulator));
opcode_table->insert(0x1a,AssyInstruction(0x1a, "INA", AM_Accumulator)); //65C02
opcode_table->insert(0x2a,AssyInstruction(0x2a, "ROL", AM_Accumulator));
opcode_table->insert(0x3a,AssyInstruction(0x3a, "DEC", AM_Accumulator)); //65C02
opcode_table->insert(0x4a,AssyInstruction(0x4a, "LSR", AM_Accumulator));
opcode_table->insert(0x5a,AssyInstruction(0x5a, "PHY", AM_Implied));//65C02
opcode_table->insert(0x6a,AssyInstruction(0x6a, "ROR", AM_Accumulator));
opcode_table->insert(0x7a,AssyInstruction(0x7a, "PLY", AM_Implied));//65C02
opcode_table->insert(0x8a,AssyInstruction(0x8a, "TXA", AM_Implied));
opcode_table->insert(0x9a,AssyInstruction(0x9a, "TXS", AM_Implied));
opcode_table->insert(0xaa,AssyInstruction(0xaa, "TAX", AM_Implied));
opcode_table->insert(0xba,AssyInstruction(0xba, "TSX", AM_Implied));
opcode_table->insert(0xca,AssyInstruction(0xca, "DEX", AM_Implied));
opcode_table->insert(0xda,AssyInstruction(0xda, "PHX", AM_Implied));//65C02
opcode_table->insert(0xea,AssyInstruction(0xea, "NOP", AM_Implied));
opcode_table->insert(0xfa,AssyInstruction(0xfa, "PLX", AM_Implied));//65C02
opcode_table->insert(0x0b,AssyInstruction(0x0b, "???", AM_InvalidOp));
opcode_table->insert(0x1b,AssyInstruction(0x1b, "???", AM_InvalidOp));
opcode_table->insert(0x2b,AssyInstruction(0x2b, "???", AM_InvalidOp));
opcode_table->insert(0x3b,AssyInstruction(0x3b, "???", AM_InvalidOp));
opcode_table->insert(0x4b,AssyInstruction(0x4b, "???", AM_InvalidOp));
opcode_table->insert(0x5b,AssyInstruction(0x5b, "???", AM_InvalidOp));
opcode_table->insert(0x6b,AssyInstruction(0x6b, "???", AM_InvalidOp));
opcode_table->insert(0x7b,AssyInstruction(0x7b, "???", AM_InvalidOp));
opcode_table->insert(0x8b,AssyInstruction(0x8b, "???", AM_InvalidOp));
opcode_table->insert(0x9b,AssyInstruction(0x9b, "???", AM_InvalidOp));
opcode_table->insert(0xab,AssyInstruction(0xab, "???", AM_InvalidOp));
opcode_table->insert(0xbb,AssyInstruction(0xbb, "???", AM_InvalidOp));
opcode_table->insert(0xcb,AssyInstruction(0xcb, "???", AM_InvalidOp));
opcode_table->insert(0xdb,AssyInstruction(0xdb, "???", AM_InvalidOp));
opcode_table->insert(0xeb,AssyInstruction(0xeb, "???", AM_InvalidOp));
opcode_table->insert(0xfb,AssyInstruction(0xfb, "???", AM_InvalidOp));
opcode_table->insert(0x0c,AssyInstruction(0x0c, "TSB", AM_Absolute)); //65C02
opcode_table->insert(0x1c,AssyInstruction(0x1c, "TRB", AM_Absolute)); //65C02
opcode_table->insert(0x2c,AssyInstruction(0x2c, "BIT", AM_Absolute));
opcode_table->insert(0x3c,AssyInstruction(0x3c, "BIT", AM_AbsoluteIndexedWithX)); //65C02
opcode_table->insert(0x4c,AssyInstruction(0x4c, "JMP", AM_Absolute));
opcode_table->insert(0x5c,AssyInstruction(0x5c, "???", AM_InvalidOp));
opcode_table->insert(0x6c,AssyInstruction(0x6c, "JMP", AM_AbsoluteIndirect));
opcode_table->insert(0x7c,AssyInstruction(0x7c, "JMP", AM_AbsoluteIndexedIndirect)); //65C02
opcode_table->insert(0x8c,AssyInstruction(0x8c, "STY", AM_Absolute));
opcode_table->insert(0x9c,AssyInstruction(0x9c, "STZ", AM_Absolute));
opcode_table->insert(0xac,AssyInstruction(0xac, "LDY", AM_Absolute));
opcode_table->insert(0xbc,AssyInstruction(0xbc, "LDY", AM_AbsoluteIndexedWithX));
opcode_table->insert(0xcc,AssyInstruction(0xcc, "CPY", AM_Absolute));
opcode_table->insert(0xdc,AssyInstruction(0xdc, "???", AM_InvalidOp));
opcode_table->insert(0xec,AssyInstruction(0xec, "CPX", AM_Absolute));
opcode_table->insert(0xfc,AssyInstruction(0xfc, "???", AM_InvalidOp));
opcode_table->insert(0x0d,AssyInstruction(0x0d, "ORA", AM_Absolute));
opcode_table->insert(0x1d,AssyInstruction(0x1d, "ORA", AM_AbsoluteIndexedWithX));
opcode_table->insert(0x2d,AssyInstruction(0x2d, "AND", AM_Absolute));
opcode_table->insert(0x3d,AssyInstruction(0x3d, "AND", AM_AbsoluteIndexedWithX));
opcode_table->insert(0x4d,AssyInstruction(0x4d, "EOR", AM_Absolute));
opcode_table->insert(0x5d,AssyInstruction(0x5d, "EOR", AM_AbsoluteIndexedWithX));
opcode_table->insert(0x6d,AssyInstruction(0x6d, "ADC", AM_Absolute));
opcode_table->insert(0x7d,AssyInstruction(0x7d, "ADC", AM_AbsoluteIndexedWithX));
opcode_table->insert(0x8d,AssyInstruction(0x8d, "STA", AM_Absolute));
opcode_table->insert(0x9d,AssyInstruction(0x9d, "STA", AM_AbsoluteIndexedWithX));
opcode_table->insert(0xad,AssyInstruction(0xad, "LDA", AM_Absolute));
opcode_table->insert(0xbd,AssyInstruction(0xbd, "LDA", AM_AbsoluteIndexedWithX));
opcode_table->insert(0xcd,AssyInstruction(0xcd, "CMP", AM_Absolute));
opcode_table->insert(0xdd,AssyInstruction(0xdd, "CMP", AM_AbsoluteIndexedWithX));
opcode_table->insert(0xed,AssyInstruction(0xed, "SBC", AM_Absolute));
opcode_table->insert(0xfd,AssyInstruction(0xfd, "SBC", AM_AbsoluteIndexedWithX));
opcode_table->insert(0x0e,AssyInstruction(0x0e, "ASL", AM_Absolute));
opcode_table->insert(0x1e,AssyInstruction(0x1e, "ASL", AM_AbsoluteIndexedWithX));
opcode_table->insert(0x2e,AssyInstruction(0x2e, "ROL", AM_Absolute));
opcode_table->insert(0x3e,AssyInstruction(0x3e, "ROL", AM_AbsoluteIndexedWithX));
opcode_table->insert(0x4e,AssyInstruction(0x4e, "LSR", AM_Absolute));
opcode_table->insert(0x5e,AssyInstruction(0x5e, "LSR", AM_AbsoluteIndexedWithX));
opcode_table->insert(0x6e,AssyInstruction(0x6e, "ROR", AM_Absolute));
opcode_table->insert(0x7e,AssyInstruction(0x7e, "ROR", AM_AbsoluteIndexedWithX));
opcode_table->insert(0x8e,AssyInstruction(0x8e, "STX", AM_Absolute));
opcode_table->insert(0x9e,AssyInstruction(0x9e, "STZ", AM_AbsoluteIndexedWithX)); //65C02
opcode_table->insert(0xae,AssyInstruction(0xae, "LDX", AM_Absolute));
opcode_table->insert(0xbe,AssyInstruction(0xbe, "LDX", AM_AbsoluteIndexedWithY));
opcode_table->insert(0xce,AssyInstruction(0xce, "DEC", AM_Absolute));
opcode_table->insert(0xde,AssyInstruction(0xde, "DEC", AM_AbsoluteIndexedWithX));
opcode_table->insert(0xee,AssyInstruction(0xee, "INC", AM_Absolute));
opcode_table->insert(0xfe,AssyInstruction(0xfe, "INC", AM_AbsoluteIndexedWithX));
opcode_table->insert(0x0f,AssyInstruction(0x0f, "???", AM_InvalidOp));
opcode_table->insert(0x1f,AssyInstruction(0x1f, "???", AM_InvalidOp));
opcode_table->insert(0x2f,AssyInstruction(0x2f, "???", AM_InvalidOp));
opcode_table->insert(0x3f,AssyInstruction(0x3f, "???", AM_InvalidOp));
opcode_table->insert(0x4f,AssyInstruction(0x4f, "???", AM_InvalidOp));
opcode_table->insert(0x5f,AssyInstruction(0x5f, "???", AM_InvalidOp));
opcode_table->insert(0x6f,AssyInstruction(0x6f, "???", AM_InvalidOp));
opcode_table->insert(0x7f,AssyInstruction(0x7f, "???", AM_InvalidOp));
opcode_table->insert(0x8f,AssyInstruction(0x8f, "???", AM_InvalidOp));
opcode_table->insert(0x9f,AssyInstruction(0x9f, "???", AM_InvalidOp));
opcode_table->insert(0xaf,AssyInstruction(0xaf, "???", AM_InvalidOp));
opcode_table->insert(0xbf,AssyInstruction(0xbf, "???", AM_InvalidOp));
opcode_table->insert(0xcf,AssyInstruction(0xcf, "???", AM_InvalidOp));
opcode_table->insert(0xdf,AssyInstruction(0xdf, "???", AM_InvalidOp));
opcode_table->insert(0xef,AssyInstruction(0xef, "???", AM_InvalidOp));
opcode_table->insert(0xff,AssyInstruction(0xff, "???", AM_InvalidOp));
#ifdef UNUSED_OPCODES
m_opcodeinfo->insert(0x00,AssyInstruction(0x00, "BRK", AM_Implied));
m_opcodeinfo->insert(0x10,AssyInstruction(0x10, "BPL", AM_ProgramCounterRelative);
m_opcodeinfo->insert(0x20,AssyInstruction(0x20, "JSR", AM_Absolute));
m_opcodeinfo->insert(0x30,AssyInstruction(0x30, "BMI", AM_ProgramCounterRelative);
m_opcodeinfo->insert(0x40,AssyInstruction(0x40, "RTI", AM_Implied));
m_opcodeinfo->insert(0x50,AssyInstruction(0x50, "BVC", AM_ProgramCounterRelative);
m_opcodeinfo->insert(0x60,AssyInstruction(0x60, "RTS", AM_Implied));
m_opcodeinfo->insert(0x70,AssyInstruction(0x70, "BVS", AM_ProgramCounterRelative);
m_opcodeinfo->insert(0x80,AssyInstruction(0x80, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0x90,AssyInstruction(0x90, "BCC", AM_ProgramCounterRelative);
m_opcodeinfo->insert(0xa0,AssyInstruction(0xa0, "LDY", AM_Immediate));
m_opcodeinfo->insert(0xb0,AssyInstruction(0xb0, "BCC", AM_ProgramCounterRelative);
m_opcodeinfo->insert(0xc0,AssyInstruction(0xc0, "LDY", AM_Immediate));
m_opcodeinfo->insert(0xd0,AssyInstruction(0xd0, "BCS", AM_ProgramCounterRelative);
m_opcodeinfo->insert(0xe0,AssyInstruction(0xe0, "CPX", AM_Immediate));
m_opcodeinfo->insert(0xf0,AssyInstruction(0xf0, "BEQ", AM_ProgramCounterRelative);
m_opcodeinfo->insert(0x01,AssyInstruction(0x01, "ORA", AM_AbsoluteIndexedIndirect));
m_opcodeinfo->insert(0x11,AssyInstruction(0x11, "ORA", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x21,AssyInstruction(0x21, "AND", AM_AbsoluteIndexedIndirect));
m_opcodeinfo->insert(0x31,AssyInstruction(0x31, "AND", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x41,AssyInstruction(0x41, "EOR", AM_AbsoluteIndexedIndirect));
m_opcodeinfo->insert(0x51,AssyInstruction(0x51, "EOR", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x61,AssyInstruction(0x61, "ADC", AM_AbsoluteIndexedIndirect));
m_opcodeinfo->insert(0x71,AssyInstruction(0x71, "ADC", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x81,AssyInstruction(0x81, "STA", AM_AbsoluteIndexedIndirect));
m_opcodeinfo->insert(0x91,AssyInstruction(0x91, "STA", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0xa1,AssyInstruction(0xa1, "LDA", AM_AbsoluteIndexedIndirect));
m_opcodeinfo->insert(0xb1,AssyInstruction(0xb1, "LDA", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0xc1,AssyInstruction(0xc1, "CMP", AM_AbsoluteIndexedIndirect));
m_opcodeinfo->insert(0xd1,AssyInstruction(0xd1, "CMP", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0xe1,AssyInstruction(0xe1, "SBC", AM_AbsoluteIndexedIndirect));
m_opcodeinfo->insert(0xf1,AssyInstruction(0xff, "SBC", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x02,AssyInstruction(0x02, "halt", AM_Immediate));
m_opcodeinfo->insert(0x12,AssyInstruction(0x12, "asl-ora", AM_ZeroPageIndexedIndirect));
m_opcodeinfo->insert(0x22,AssyInstruction(0x22, "and", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x32,AssyInstruction(0x32, "halt", AM_Immediate));
m_opcodeinfo->insert(0x42,AssyInstruction(0x42, "halt", AM_Immediate));
m_opcodeinfo->insert(0x52,AssyInstruction(0x52, "halt", AM_Immediate));
m_opcodeinfo->insert(0x62,AssyInstruction(0x62, "halt", AM_Immediate));
m_opcodeinfo->insert(0x72,AssyInstruction(0x72, "halt", AM_Immediate));
m_opcodeinfo->insert(0x82,AssyInstruction(0x82, "halt", AM_Immediate));
m_opcodeinfo->insert(0x92,AssyInstruction(0x92, "halt", AM_Immediate));
m_opcodeinfo->insert(0xa2,AssyInstruction(0xa2, "LDX", AM_Immediate));
m_opcodeinfo->insert(0xb2,AssyInstruction(0xb2, "halt", AM_Immediate));
m_opcodeinfo->insert(0xc2,AssyInstruction(0xc2, "halt", AM_Immediate));
m_opcodeinfo->insert(0xd2,AssyInstruction(0xd2, "halt", AM_Immediate));
m_opcodeinfo->insert(0xe2,AssyInstruction(0xe2, "halt", AM_Immediate));
m_opcodeinfo->insert(0xf2,AssyInstruction(0xf2, "halt", AM_Immediate));
m_opcodeinfo->insert(0x03,AssyInstruction(0x03, "asl/ora", AM_ZeroPageIndexedIndirect));
m_opcodeinfo->insert(0x13,AssyInstruction(0x13, "asl/ora", AM_ZeroPageIndirect));
m_opcodeinfo->insert(0x23,AssyInstruction(0x23, "rol/and", AM_ZeroPageIndexedIndirect));
m_opcodeinfo->insert(0x33,AssyInstruction(0x33, "rol/and", AM_ZeroPageIndexedWithY));
m_opcodeinfo->insert(0x43,AssyInstruction(0x43, "lsr/eor", AM_ZeroPage));
m_opcodeinfo->insert(0x53,AssyInstruction(0x53, "lsr/eor", AM_ZeroPageIndirectIndexedWithY));
m_opcodeinfo->insert(0x63,AssyInstruction(0x63, "ror/adc", AM_ZeroPageIndexedIndirect));
m_opcodeinfo->insert(0x73,AssyInstruction(0x73, "ror/adc", AM_ZeroPageIndirectIndexedWithY));
m_opcodeinfo->insert(0x83,AssyInstruction(0x83, "sta/stx", AM_ZeroPageIndexedIndirect));
m_opcodeinfo->insert(0x93,AssyInstruction(0x93, "sta/stx", AM_ZeroPageIndirectIndexedWithY));
m_opcodeinfo->insert(0xa3,AssyInstruction(0xa3, "lda/ldx", AM_ZeroPageIndexedIndirect));
m_opcodeinfo->insert(0xb3,AssyInstruction(0xb3, "lda/ldx", AM_ZeroPageIndirectIndexedWithY));
m_opcodeinfo->insert(0xc3,AssyInstruction(0xc3, "dec/cmp", AM_ZeroPageIndexedIndirect));
m_opcodeinfo->insert(0xd3,AssyInstruction(0xd3, "dec/cmp", AM_ZeroPageIndirectIndexedWithY));
m_opcodeinfo->insert(0xe3,AssyInstruction(0xe3, "inc/sbc", AM_ZeroPageIndexedIndirect));
m_opcodeinfo->insert(0xf3,AssyInstruction(0xf3, "inc/sbc", AM_ZeroPageIndirectIndexedWithY));
m_opcodeinfo->insert(0x04,AssyInstruction(0x04, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0x14,AssyInstruction(0x14, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0x24,AssyInstruction(0x24, "BIT", AM_ZeroPage));
m_opcodeinfo->insert(0x34,AssyInstruction(0x34, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0x44,AssyInstruction(0x44, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0x54,AssyInstruction(0x54, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0x64,AssyInstruction(0x64, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0x74,AssyInstruction(0x74, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0x84,AssyInstruction(0x84, "STY", AM_ZeroPage));
m_opcodeinfo->insert(0x94,AssyInstruction(0x94, "STY", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0xa4,AssyInstruction(0xa4, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0xb4,AssyInstruction(0xb4, "LDY", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0xc4,AssyInstruction(0xc4, "CPY", AM_ZeroPage));
m_opcodeinfo->insert(0xd4,AssyInstruction(0xd4, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0xe4,AssyInstruction(0xe4, "CPX", AM_ZeroPage));
m_opcodeinfo->insert(0xf4,AssyInstruction(0xf4, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0x05,AssyInstruction(0x05, "ORA", AM_ZeroPage));
m_opcodeinfo->insert(0x15,AssyInstruction(0x15, "ORA", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x25,AssyInstruction(0x25, "AND", AM_ZeroPage));
m_opcodeinfo->insert(0x35,AssyInstruction(0x35, "AND", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x45,AssyInstruction(0x45, "EOR", AM_ZeroPage));
m_opcodeinfo->insert(0x55,AssyInstruction(0x55, "EOR", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x65,AssyInstruction(0x65, "ADC", AM_ZeroPage));
m_opcodeinfo->insert(0x75,AssyInstruction(0x75, "ADC", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x85,AssyInstruction(0x85, "STA", AM_ZeroPage));
m_opcodeinfo->insert(0x95,AssyInstruction(0x95, "STA", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0xa5,AssyInstruction(0xa5, "LDA", AM_ZeroPage));
m_opcodeinfo->insert(0xb5,AssyInstruction(0xb5, "LDA", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0xc5,AssyInstruction(0xc5, "CMP", AM_ZeroPage));
m_opcodeinfo->insert(0xd5,AssyInstruction(0xd5, "CMP", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0xe5,AssyInstruction(0xe5, "SEC", AM_ZeroPage));
m_opcodeinfo->insert(0xf5,AssyInstruction(0xf5, "SEC", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x06,AssyInstruction(0x06, "ASL", AM_ZeroPage));
m_opcodeinfo->insert(0x16,AssyInstruction(0x16, "ASL", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x26,AssyInstruction(0x26, "ROL", AM_ZeroPage));
m_opcodeinfo->insert(0x36,AssyInstruction(0x36, "ROL", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x46,AssyInstruction(0x46, "LSR", AM_ZeroPage));
m_opcodeinfo->insert(0x56,AssyInstruction(0x56, "LSR", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x66,AssyInstruction(0x66, "ROR", AM_ZeroPage));
m_opcodeinfo->insert(0x76,AssyInstruction(0x76, "ROR", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x86,AssyInstruction(0x86, "STX", AM_ZeroPage));
m_opcodeinfo->insert(0x96,AssyInstruction(0x96, "STX", AM_ZeroPageIndexedWithY));
m_opcodeinfo->insert(0xa6,AssyInstruction(0xa6, "LDX", AM_ZeroPage));
m_opcodeinfo->insert(0xb6,AssyInstruction(0xb6, "LDX", AM_ZeroPageIndexedWithY));
m_opcodeinfo->insert(0xc6,AssyInstruction(0xc6, "DEC", AM_ZeroPage));
m_opcodeinfo->insert(0xd6,AssyInstruction(0xd6, "DEC", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0xe6,AssyInstruction(0xe6, "INC", AM_ZeroPage));
m_opcodeinfo->insert(0xf6,AssyInstruction(0xf6, "INC", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x07,AssyInstruction(0x07, "asl/ora", AM_ZeroPage));
m_opcodeinfo->insert(0x17,AssyInstruction(0x17, "asl/ora", AM_ZeroPageIndirectIndexedWithY));
m_opcodeinfo->insert(0x27,AssyInstruction(0x27, "rol/and", AM_ZeroPage));
m_opcodeinfo->insert(0x37,AssyInstruction(0x37, "rol/and", AM_ZeroPageIndexedWithX));
m_opcodeinfo->insert(0x47,AssyInstruction(0x47, "lsr/eor", AM_ZeroPage));
m_opcodeinfo->insert(0x57,AssyInstruction(0x57, "lsr/eor", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x67,AssyInstruction(0x67, "ror/adc", AM_ZeroPage));
m_opcodeinfo->insert(0x77,AssyInstruction(0x77, "ror/adc", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x87,AssyInstruction(0x87, "sta/stx", AM_ZeroPage));
m_opcodeinfo->insert(0x97,AssyInstruction(0x97, "sta/stx", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0xa7,AssyInstruction(0xa7, "lda/ldx", AM_ZeroPage));
m_opcodeinfo->insert(0xb7,AssyInstruction(0xb7, "ldx/ldx", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0xc7,AssyInstruction(0xc7, "dec/cmp", AM_ZeroPage));
m_opcodeinfo->insert(0xd7,AssyInstruction(0xd7, "dec/cmp", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0xe7,AssyInstruction(0xe7, "inc/sbc", AM_ZeroPage));
m_opcodeinfo->insert(0xf7,AssyInstruction(0xf7, "inc/sbc", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x08,AssyInstruction(0x08, "PHP", AM_Implied));
m_opcodeinfo->insert(0x18,AssyInstruction(0x18, "CLC", AM_Implied));
m_opcodeinfo->insert(0x28,AssyInstruction(0x28, "PLP", AM_Implied));
m_opcodeinfo->insert(0x38,AssyInstruction(0x38, "SEC", AM_Implied));
m_opcodeinfo->insert(0x48,AssyInstruction(0x48, "PHA", AM_Implied));
m_opcodeinfo->insert(0x58,AssyInstruction(0x58, "CLI", AM_Implied));
m_opcodeinfo->insert(0x68,AssyInstruction(0x68, "PLA", AM_Implied));
m_opcodeinfo->insert(0x78,AssyInstruction(0x78, "SEI", AM_Implied));
m_opcodeinfo->insert(0x88,AssyInstruction(0x88, "DEY", AM_Implied));
m_opcodeinfo->insert(0x98,AssyInstruction(0x98, "TYA", AM_Implied));
m_opcodeinfo->insert(0xa8,AssyInstruction(0xa8, "TAY", AM_Implied));
m_opcodeinfo->insert(0xb8,AssyInstruction(0xb8, "CLV", AM_Implied));
m_opcodeinfo->insert(0xc8,AssyInstruction(0xc8, "INY", AM_Implied));
m_opcodeinfo->insert(0xd8,AssyInstruction(0xd8, "CLD", AM_Implied));
m_opcodeinfo->insert(0xe8,AssyInstruction(0xe8, "INX", AM_Implied));
m_opcodeinfo->insert(0xf8,AssyInstruction(0xf8, "SED", AM_Implied));
m_opcodeinfo->insert(0x09,AssyInstruction(0x09, "ORA", AM_Immediate));
m_opcodeinfo->insert(0x19,AssyInstruction(0x19, "ORA", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x29,AssyInstruction(0x29, "AND", AM_Immediate));
m_opcodeinfo->insert(0x39,AssyInstruction(0x39, "AND", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x49,AssyInstruction(0x49, "EOR", AM_Immediate));
m_opcodeinfo->insert(0x59,AssyInstruction(0x59, "EOR", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x69,AssyInstruction(0x69, "ADC", AM_Immediate));
m_opcodeinfo->insert(0x79,AssyInstruction(0x79, "ADC", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x89,AssyInstruction(0x89, "nop", AM_ZeroPage));
m_opcodeinfo->insert(0x99,AssyInstruction(0x99, "STA", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0xa9,AssyInstruction(0xa9, "LDA", AM_Immediate));
m_opcodeinfo->insert(0xb9,AssyInstruction(0xb9, "LDA", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0xc9,AssyInstruction(0xc9, "CMP", AM_Immediate));
m_opcodeinfo->insert(0xd9,AssyInstruction(0xd9, "CMP", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0xe9,AssyInstruction(0xe9, "SBC", AM_Immediate));
m_opcodeinfo->insert(0xf9,AssyInstruction(0xf9, "SBC", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x0a,AssyInstruction(0x0a, "ASL", AM_Accumulator));
m_opcodeinfo->insert(0x1a,AssyInstruction(0x1a, "nop", AM_Implied));
m_opcodeinfo->insert(0x2a,AssyInstruction(0x2a, "ROL", AM_Accumulator));
m_opcodeinfo->insert(0x3a,AssyInstruction(0x3a, "nop", AM_Implied));
m_opcodeinfo->insert(0x4a,AssyInstruction(0x4a, "LSR", AM_Accumulator));
m_opcodeinfo->insert(0x5a,AssyInstruction(0x5a, "nop", AM_Implied));
m_opcodeinfo->insert(0x6a,AssyInstruction(0x6a, "ROR", AM_Accumulator));
m_opcodeinfo->insert(0x7a,AssyInstruction(0x7a, "nop", AM_Implied));
m_opcodeinfo->insert(0x8a,AssyInstruction(0x8a, "TXA", AM_Implied));
m_opcodeinfo->insert(0x9a,AssyInstruction(0x9a, "TXS", AM_Implied));
m_opcodeinfo->insert(0xaa,AssyInstruction(0xaa, "TAX", AM_Implied));
m_opcodeinfo->insert(0xba,AssyInstruction(0xba, "TSX", AM_Implied));
m_opcodeinfo->insert(0xca,AssyInstruction(0xca, "DEX", AM_Implied));
m_opcodeinfo->insert(0xda,AssyInstruction(0xda, "nop", AM_Implied));
m_opcodeinfo->insert(0xea,AssyInstruction(0xea, "NOP", AM_Implied));
m_opcodeinfo->insert(0xfa,AssyInstruction(0xfa, "nop", AM_Implied));
m_opcodeinfo->insert(0x0b,AssyInstruction(0x0b, "and/mov bit7->Cy", AM_Immediate));
m_opcodeinfo->insert(0x1b,AssyInstruction(0x1b, "asl/ora", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x2b,AssyInstruction(0x2b, "and/mov bit7->Cy", AM_Immediate));
m_opcodeinfo->insert(0x3b,AssyInstruction(0x3b, "asl/ora", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x4b,AssyInstruction(0x4b, "and/lsr A", AM_Immediate));
m_opcodeinfo->insert(0x5b,AssyInstruction(0x5b, "lsr/eor", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x6b,AssyInstruction(0x6b, "and/ror A", AM_Immediate));
m_opcodeinfo->insert(0x7b,AssyInstruction(0x7b, "ror/adc", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0x8b,AssyInstruction(0x8b, "txa/and", AM_Immediate));
m_opcodeinfo->insert(0x9b,AssyInstruction(0x9b, "sta/stx", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0xab,AssyInstruction(0xab, "lda/ldx", AM_Implied));
m_opcodeinfo->insert(0xbb,AssyInstruction(0xbb, "lda/ldx", AM_Implied));
m_opcodeinfo->insert(0xcb,AssyInstruction(0xcb, "sbx", AM_Immediate));
m_opcodeinfo->insert(0xdb,AssyInstruction(0xdb, "dec/cmp", AM_Absolute));
m_opcodeinfo->insert(0xeb,AssyInstruction(0xeb, "sbc", AM_Immediate));
m_opcodeinfo->insert(0xfb,AssyInstruction(0xfb, "inc/sbc", AM_Absolute));
m_opcodeinfo->insert(0x0c,AssyInstruction(0x0c, "nop", AM_Absolute));
m_opcodeinfo->insert(0x1c,AssyInstruction(0x1c, "nop", AM_Absolute));
m_opcodeinfo->insert(0x2c,AssyInstruction(0x2c, "BIT", AM_Absolute));
m_opcodeinfo->insert(0x3c,AssyInstruction(0x3c, "nop", AM_Absolute));
m_opcodeinfo->insert(0x4c,AssyInstruction(0x4c, "JMP", AM_Absolute));
m_opcodeinfo->insert(0x5c,AssyInstruction(0x5c, "nop", AM_Absolute));
m_opcodeinfo->insert(0x6c,AssyInstruction(0x6c, "JMP", AM_AbsoluteIndirect));
m_opcodeinfo->insert(0x7c,AssyInstruction(0x7c, "nop", AM_Absolute));
m_opcodeinfo->insert(0x8c,AssyInstruction(0x8c, "STY", AM_Absolute));
m_opcodeinfo->insert(0x9c,AssyInstruction(0x9c, "sta/stx", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0xac,AssyInstruction(0xac, "LDY", AM_Absolute));
m_opcodeinfo->insert(0xbc,AssyInstruction(0xbc, "LDY", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0xcc,AssyInstruction(0xcc, "CPY", AM_Absolute));
m_opcodeinfo->insert(0xdc,AssyInstruction(0xdc, "???", AM_InvalidOp));
m_opcodeinfo->insert(0xec,AssyInstruction(0xec, "CPX", AM_Absolute));
m_opcodeinfo->insert(0xfc,AssyInstruction(0xfc, "???", AM_InvalidOp));
m_opcodeinfo->insert(0x0d,AssyInstruction(0x0d, "ORA", AM_Absolute));
m_opcodeinfo->insert(0x1d,AssyInstruction(0x1d, "ORA", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x2d,AssyInstruction(0x2d, "AND", AM_Absolute));
m_opcodeinfo->insert(0x3d,AssyInstruction(0x3d, "AND", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x4d,AssyInstruction(0x4d, "EOR", AM_Absolute));
m_opcodeinfo->insert(0x5d,AssyInstruction(0x5d, "EOR", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x6d,AssyInstruction(0x6d, "ADC", AM_Absolute));
m_opcodeinfo->insert(0x7d,AssyInstruction(0x7d, "ADC", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x8d,AssyInstruction(0x8d, "STA", AM_Absolute));
m_opcodeinfo->insert(0x9d,AssyInstruction(0x9d, "STA", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0xad,AssyInstruction(0xad, "LDA", AM_Absolute));
m_opcodeinfo->insert(0xbd,AssyInstruction(0xbd, "LDA", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0xcd,AssyInstruction(0xcd, "CMP", AM_Absolute));
m_opcodeinfo->insert(0xdd,AssyInstruction(0xdd, "CMP", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0xed,AssyInstruction(0xed, "SBC", AM_Absolute));
m_opcodeinfo->insert(0xfd,AssyInstruction(0xfd, "SBC", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x0e,AssyInstruction(0x0e, "ASL", AM_Absolute));
m_opcodeinfo->insert(0x1e,AssyInstruction(0x1e, "ASL", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x2e,AssyInstruction(0x2e, "ROL", AM_Absolute));
m_opcodeinfo->insert(0x3e,AssyInstruction(0x3e, "ROL", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x4e,AssyInstruction(0x4e, "LSR", AM_Absolute));
m_opcodeinfo->insert(0x5e,AssyInstruction(0x5e, "LSR", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x6e,AssyInstruction(0x6e, "ROR", AM_Absolute));
m_opcodeinfo->insert(0x7e,AssyInstruction(0x7e, "ROR", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x8e,AssyInstruction(0x8e, "STX", AM_Absolute));
m_opcodeinfo->insert(0x9e,AssyInstruction(0x9e, "sta/stx", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0xae,AssyInstruction(0xae, "LDX", AM_Absolute));
m_opcodeinfo->insert(0xbe,AssyInstruction(0xbe, "LDX", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0xce,AssyInstruction(0xce, "DEC", AM_Absolute));
m_opcodeinfo->insert(0xde,AssyInstruction(0xde, "DEC", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0xee,AssyInstruction(0xee, "INC", AM_Absolute));
m_opcodeinfo->insert(0xfe,AssyInstruction(0xfe, "INC", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x0f,AssyInstruction(0x0f, "asl/ora", AM_Absolute));
m_opcodeinfo->insert(0x1f,AssyInstruction(0x1f, "asl/ora", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x2f,AssyInstruction(0x2f, "rol/and", AM_Absolute));
m_opcodeinfo->insert(0x3f,AssyInstruction(0x3f, "rol/and", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x4f,AssyInstruction(0x4f, "lsr/eor", AM_Absolute));
m_opcodeinfo->insert(0x5f,AssyInstruction(0x5f, "lsr/eor", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x6f,AssyInstruction(0x6f, "ror/adc", AM_Absolute));
m_opcodeinfo->insert(0x7f,AssyInstruction(0x7f, "ror/adc", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0x8f,AssyInstruction(0x8f, "sta/stx", AM_Absolute));
m_opcodeinfo->insert(0x9f,AssyInstruction(0x9f, "sta/stx", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0xaf,AssyInstruction(0xaf, "lda/ldx", AM_Absolute));
m_opcodeinfo->insert(0xbf,AssyInstruction(0xbf, "ldx/ldx", AM_AbsoluteIndexedWithY));
m_opcodeinfo->insert(0xcf,AssyInstruction(0xcf, "dec/cmp", AM_Absolute));
m_opcodeinfo->insert(0xdf,AssyInstruction(0xdf, "dec/cmp", AM_AbsoluteIndexedWithX));
m_opcodeinfo->insert(0xef,AssyInstruction(0xef, "inc/sbc", AM_Absolute));
m_opcodeinfo->insert(0xff,AssyInstruction(0xff, "inc/sbc", AM_AbsoluteIndexedWithX));
#endif
}
AssyInstruction::AssyInstruction(quint8 opcode, QString mnemonic, AddressMode am) {
m_opcode = opcode;
m_mnemonic = mnemonic;
m_addressMode = am;
}
quint8 AssyInstruction::numArgs() {
switch (m_addressMode) {
case AM_Absolute:
case AM_AbsoluteIndexedIndirect:
case AM_AbsoluteIndexedWithX:
case AM_AbsoluteIndexedWithY:
case AM_AbsoluteIndirect:
return 2;
case AM_ProgramCounterRelative:
case AM_ZeroPage:
case AM_ZeroPageIndirectIndexedWithY:
case AM_ZeroPageIndexedIndirect:
case AM_ZeroPageIndexedWithX:
case AM_ZeroPageIndexedWithY:
case AM_ZeroPageIndirect:
case AM_Immediate:
return 1;
case AM_InvalidOp:
case AM_Implied:
case AM_Accumulator:
default:
return 0;
}
}

77
src/util/opcodes.h Normal file
View File

@ -0,0 +1,77 @@
#ifndef OPCODES_H
#define OPCODES_H
#include "util.h"
#include <QString>
#include <QHash>
enum AddressMode {
AM_InvalidOp,
AM_Absolute, // a
AM_AbsoluteIndexedIndirect, // (a,x)
AM_AbsoluteIndexedWithX, // a,x
AM_AbsoluteIndexedWithY, // a,y
AM_AbsoluteIndirect, // (a)
AM_Immediate, // #
AM_Implied, // i
AM_Accumulator, // A
AM_ProgramCounterRelative, // r
AM_ZeroPage, // zp
AM_ZeroPageIndexedIndirect, // (zp,x)
AM_ZeroPageIndexedWithX, // zp,x
AM_ZeroPageIndexedWithY, // zp,y
AM_ZeroPageIndirect, // (zp)
AM_ZeroPageIndirectIndexedWithY // (zp),y
};
struct AssyInstruction {
public:
AssyInstruction(quint8 opcode = 0x00, QString mnemonic = "???", AddressMode am = AM_InvalidOp);
AddressMode addressMode() { return m_addressMode; }
QString mnemonic() { return m_mnemonic; }
quint8 opcode() { return m_opcode; }
quint8 numArgs();
QString debugStr() { return QString("%1 %2 %3").arg(uint8ToHex(m_opcode)).arg(m_mnemonic).arg(m_addressMode); }
private:
QString m_mnemonic;
quint8 m_opcode;
AddressMode m_addressMode;
};
class OpCodes
{
public:
static QString getMnemonic(quint8 opcode)
{
return getAssyInstruction(opcode).mnemonic();
}
static AssyInstruction &getAssyInstruction(quint8 id)
{
static QHash<quint8,AssyInstruction> m_opcodeinfo;
if (m_opcodeinfo.size() == 0)
{
makeOpcodeTable(&m_opcodeinfo);
}
return m_opcodeinfo[id];
}
protected:
OpCodes();
static void makeOpcodeTable(QHash<quint8,AssyInstruction>* m_opcodeinfo);
};
#endif // OPCODES_H