Changed some disassembler code

This commit is contained in:
Mark Long 2016-10-10 12:45:07 -05:00
parent e1efec04b0
commit 4df14ff010
3 changed files with 70 additions and 46 deletions

Binary file not shown.

View File

@ -166,48 +166,48 @@ void Disassembler::makeOpcodeTable()
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, "???", AM_InvalidOp);
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, "BCC", AM_ProgramCounterRelative);
m_opcodeinfo[0xc0] = AssyInstruction(0xc0, "LDY", AM_Immediate);
m_opcodeinfo[0xd0] = AssyInstruction(0xd0, "BCS", AM_ProgramCounterRelative);
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_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[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, "???", AM_InvalidOp);
m_opcodeinfo[0x12] = AssyInstruction(0x12, "ORA", AM_ZeroPageIndirect);
m_opcodeinfo[0x22] = AssyInstruction(0x22, "???", AM_InvalidOp);
m_opcodeinfo[0x32] = AssyInstruction(0x32, "???", AM_InvalidOp);
m_opcodeinfo[0x32] = AssyInstruction(0x32, "AND", AM_ZeroPageIndirect);
m_opcodeinfo[0x42] = AssyInstruction(0x42, "???", AM_InvalidOp);
m_opcodeinfo[0x52] = AssyInstruction(0x52, "???", AM_InvalidOp);
m_opcodeinfo[0x52] = AssyInstruction(0x52, "EOR", AM_ZeroPageIndirect);
m_opcodeinfo[0x62] = AssyInstruction(0x62, "???", AM_InvalidOp);
m_opcodeinfo[0x72] = AssyInstruction(0x72, "???", AM_InvalidOp);
m_opcodeinfo[0x72] = AssyInstruction(0x72, "ADC", AM_ZeroPageIndirect);
m_opcodeinfo[0x82] = AssyInstruction(0x82, "???", AM_InvalidOp);
m_opcodeinfo[0x92] = AssyInstruction(0x92, "???", AM_InvalidOp);
m_opcodeinfo[0x92] = AssyInstruction(0x92, "STA", AM_ZeroPageIndirect); //65C02
m_opcodeinfo[0xa2] = AssyInstruction(0xa2, "LDX", AM_Immediate);
m_opcodeinfo[0xb2] = AssyInstruction(0xb2, "???", AM_InvalidOp);
m_opcodeinfo[0xb2] = AssyInstruction(0xb2, "LDA", AM_ZeroPageIndirect); //65C02
m_opcodeinfo[0xc2] = AssyInstruction(0xc2, "???", AM_InvalidOp);
m_opcodeinfo[0xd2] = AssyInstruction(0xd2, "???", AM_InvalidOp);
m_opcodeinfo[0xd2] = AssyInstruction(0xd2, "CMP", AM_ZeroPageIndirect);
m_opcodeinfo[0xe2] = AssyInstruction(0xe2, "???", AM_InvalidOp);
m_opcodeinfo[0xf2] = AssyInstruction(0xf2, "???", AM_InvalidOp);
m_opcodeinfo[0xf2] = AssyInstruction(0xf2, "SBC", AM_ZeroPageIndirect);
m_opcodeinfo[0x03] = AssyInstruction(0x03, "???", AM_InvalidOp);
m_opcodeinfo[0x13] = AssyInstruction(0x13, "???", AM_InvalidOp);
@ -226,14 +226,14 @@ void Disassembler::makeOpcodeTable()
m_opcodeinfo[0xe3] = AssyInstruction(0xe3, "???", AM_InvalidOp);
m_opcodeinfo[0xf3] = AssyInstruction(0xf3, "???", AM_InvalidOp);
m_opcodeinfo[0x04] = AssyInstruction(0x04, "???", AM_InvalidOp);
m_opcodeinfo[0x14] = AssyInstruction(0x14, "???", 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, "???", AM_InvalidOp);
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, "???", AM_InvalidOp);
m_opcodeinfo[0x74] = AssyInstruction(0x74, "???", 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);
@ -319,7 +319,7 @@ void Disassembler::makeOpcodeTable()
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, "???", AM_InvalidOp);
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);
@ -329,21 +329,21 @@ void Disassembler::makeOpcodeTable()
m_opcodeinfo[0xf9] = AssyInstruction(0xf9, "SBC", AM_AbsoluteIndexedWithY);
m_opcodeinfo[0x0a] = AssyInstruction(0x0a, "ASL", AM_Accumulator);
m_opcodeinfo[0x1a] = AssyInstruction(0x1a, "???", AM_InvalidOp);
m_opcodeinfo[0x1a] = AssyInstruction(0x1a, "INA", AM_Accumulator); //65C02
m_opcodeinfo[0x2a] = AssyInstruction(0x2a, "ROL", AM_Accumulator);
m_opcodeinfo[0x3a] = AssyInstruction(0x3a, "???", AM_InvalidOp);
m_opcodeinfo[0x3a] = AssyInstruction(0x3a, "DEC", AM_Accumulator); //65C02
m_opcodeinfo[0x4a] = AssyInstruction(0x4a, "LSR", AM_Accumulator);
m_opcodeinfo[0x5a] = AssyInstruction(0x5a, "???", AM_InvalidOp);
m_opcodeinfo[0x5a] = AssyInstruction(0x5a, "PHY", AM_Implied);//65C02
m_opcodeinfo[0x6a] = AssyInstruction(0x6a, "ROR", AM_Accumulator);
m_opcodeinfo[0x7a] = AssyInstruction(0x7a, "???", AM_InvalidOp);
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, "???", AM_InvalidOp);
m_opcodeinfo[0xda] = AssyInstruction(0xda, "PHX", AM_Implied);//65C02
m_opcodeinfo[0xea] = AssyInstruction(0xea, "NOP", AM_Implied);
m_opcodeinfo[0xfa] = AssyInstruction(0xfa, "???", AM_InvalidOp);
m_opcodeinfo[0xfa] = AssyInstruction(0xfa, "PLX", AM_Implied);//65C02
m_opcodeinfo[0x0b] = AssyInstruction(0x0b, "???", AM_InvalidOp);
m_opcodeinfo[0x1b] = AssyInstruction(0x1b, "???", AM_InvalidOp);
@ -362,16 +362,16 @@ void Disassembler::makeOpcodeTable()
m_opcodeinfo[0xeb] = AssyInstruction(0xeb, "???", AM_InvalidOp);
m_opcodeinfo[0xfb] = AssyInstruction(0xfb, "???", AM_InvalidOp);
m_opcodeinfo[0x0c] = AssyInstruction(0x0c, "???", AM_InvalidOp);
m_opcodeinfo[0x1c] = AssyInstruction(0x1c, "???", 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, "???", AM_InvalidOp);
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, "???", AM_InvalidOp);
m_opcodeinfo[0x7c] = AssyInstruction(0x7c, "JMP", AM_AbsoluteIndexedIndirect); //65C02
m_opcodeinfo[0x8c] = AssyInstruction(0x8c, "STY", AM_Absolute);
m_opcodeinfo[0x9c] = AssyInstruction(0x9c, "???", AM_InvalidOp);
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);
@ -405,7 +405,7 @@ void Disassembler::makeOpcodeTable()
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, "???", AM_InvalidOp);
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);

View File

@ -310,6 +310,10 @@ QString MazeViewer::inventoryToString(quint8 inv)
quint8 gems = (inv & 0xf0) >> 4;
quint8 gold_or_special = (inv & 0x0f);
if (gems == 0 && gold_or_special == 0) {
return "";
}
if (gems == 0) // Special item;
{
if (gold_or_special == 0x00) { return ""; }
@ -330,10 +334,30 @@ QString MazeViewer::inventoryToString(quint8 inv)
if (gold_or_special == 0x0F) { return "UNKN 15"; }
return "";
}
else if (gold_or_special == 0)
{
if (gems == 0x01) { return "MagicShld (4)";}
if (gems == 0x02) { return "MthrlArmr (6)";}
if (gems == 0x03) { return "MagicSwd (255)";}
if (gems == 0x04) { return "MagicSwd (5)";}
if (gems == 0x05) { return "MagicArrs (3)";}
if (gems == 0x06) { return "MgcWarAx (4)";}
if (gems == 0x07) { return "MagicStf (4)";}
if (gems == 0x08) { return "GldRng (1)";}
if (gems == 0x09) { return "GldRng (2)";}
if (gems == 0x0a) { return "GldRng (4)";}
if (gems == 0x0b) { return "GldRng (8)";}
if (gems == 0x0c) { return "GldRng (16)";}
if (gems == 0x0d) { return "GldRng (32)";}
if (gems == 0x0e) { return "GldRng (64)";}
if (gems == 0x0f) { return "GldRng (128)"; }
}
else
{
return QString("%1Gm,%2Au").arg(gems).arg(gold_or_special * 4);
}
return "";
}
QString MazeViewer::monsterToString(quint8 mc)