From 17e761d6c6d27972093b66221df8ad6035125ada Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 12 Apr 2022 08:36:44 -0400 Subject: [PATCH] =?UTF-8?q?Add=20enough=20code=20to=20pages=200=E2=80=933?= =?UTF-8?q?=20to=20shift=20problem=20to=20decode().?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InstructionSets/68k/Decoder.cpp | 90 ++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 7 deletions(-) diff --git a/InstructionSets/68k/Decoder.cpp b/InstructionSets/68k/Decoder.cpp index 393940b2c..927110904 100644 --- a/InstructionSets/68k/Decoder.cpp +++ b/InstructionSets/68k/Decoder.cpp @@ -128,28 +128,104 @@ template Preinstruction Predecoder::decode(uint16_t instru // Should be unreachable. assert(false); } + + // TODO: be careful that decoders for ADD, SUB, etc, must check the instruction a little + // further to determine whether they're ADDI, SUBI, etc or the regular versions. } // MARK: - Page decoders. Preinstruction Predecoder::decode0(uint16_t instruction) { - (void)instruction; + switch(instruction) { + case 0x003c: return decode(instruction); + case 0x007c: return decode(instruction); + case 0x023c: return decode(instruction); + case 0x027c: return decode(instruction); + case 0x0a3c: return decode(instruction); + case 0x0a7c: return decode(instruction); + + default: break; + } + + switch(instruction & 0xfc0) { + // 4-153 (p257) + case 0x000: return decode(instruction); + case 0x040: return decode(instruction); + case 0x080: return decode(instruction); + + // 4-18 (p122) + case 0x200: return decode(instruction); + case 0x240: return decode(instruction); + case 0x280: return decode(instruction); + + // 4-179 (p283) + case 0x400: return decode(instruction); + case 0x440: return decode(instruction); + case 0x480: return decode(instruction); + + // 4-9 (p113) + case 0x600: return decode(instruction); + case 0x640: return decode(instruction); + case 0x680: return decode(instruction); + + // 4-63 (p167) + case 0x800: return decode(instruction); + + // 4-29 (p133) + case 0x840: return decode(instruction); + + // 4-32 (p136) + case 0x880: return decode(instruction); + + // 4-58 (p162) + case 0x8c0: return decode(instruction); + + // 4-102 (p206) + case 0xa00: return decode(instruction); + case 0xa40: return decode(instruction); + case 0xa80: return decode(instruction); + + // 4-79 (p183) + case 0xc00: return decode(instruction); + case 0xc40: return decode(instruction); + case 0xc80: return decode(instruction); + + default: break; + } + + switch(instruction & 0x1c0) { + case 0x100: return decode(instruction); // 4-62 (p166) + case 0x180: return decode(instruction); // 4-31 (p135) + + case 0x140: return decode(instruction); // 4-28 (p132) + case 0x1c0: return decode(instruction); // 4-57 (p161) + + default: break; + } + + switch(instruction & 0x1f8) { + // 4-133 (p237) + case 0x108: return decode(instruction); + case 0x148: return decode(instruction); + case 0x188: return decode(instruction); + case 0x1c8: return decode(instruction); + + default: break; + } + return Preinstruction(); } Preinstruction Predecoder::decode1(uint16_t instruction) { - (void)instruction; - return Preinstruction(); + return decode(instruction); } Preinstruction Predecoder::decode2(uint16_t instruction) { - (void)instruction; - return Preinstruction(); + return decode(instruction); } Preinstruction Predecoder::decode3(uint16_t instruction) { - (void)instruction; - return Preinstruction(); + return decode(instruction); } Preinstruction Predecoder::decode4(uint16_t instruction) {