disasm long jump table

This commit is contained in:
Kelvin Sherlock 2013-08-03 23:58:32 -04:00
parent 4a1aace4d7
commit e53dbcce13

View File

@ -82,20 +82,48 @@ void code0(uint32_t data_size)
offset = 16; offset = 16;
bool longA5 = false;
while (offset < data_size) while (offset < data_size)
{ {
uint16_t off = memoryReadWord(offset);
if (memoryReadWord(offset + 2) == 0x3F3C && memoryReadWord(offset + 6) == 0xA9F0)
{
uint16_t seg = memoryReadWord(offset + 4);
// pc +2 since the first byte is the offset, not code. if (longA5)
printf("$%08X %04X : %04X\n", pc + 2, seg, off); {
uint16_t segment = memoryReadWord(offset);
uint32_t segOffset = memoryReadLong(offset + 4);
if (memoryReadWord(offset + 2) == 0xA9F0)
{
printf("$%08X %04X : %08X\n", pc + 2, segment, segOffset);
} }
else else
{ {
printf("$%08X ???\n", pc + 2); printf("$%08X ???\n", pc + 2);
} }
}
else
{
uint16_t data[4];
for (unsigned i = 0; i < 4; ++i)
data[i] = memoryReadWord(offset + 2 * i);
if (data[1] == 0xffff)
{
longA5 = true;
printf("--------\n");
}
else if (data[1] == 0x3F3C && data[3] == 0xA9F0)
{
uint16_t segment = data[0];
uint16_t segOffset = data[2];
// pc +2 since the first byte is the offset, not code.
printf("$%08X %04X : %04X\n", pc + 2, segment, segOffset);
}
else
{
printf("$%08X ???\n", pc + 2);
}
}
offset += 8; offset += 8;
pc += 8; pc += 8;
} }