all repos — mgba @ 5e18eabd0413472b22eff7f15d5d5698a3b2048c

mGBA Game Boy Advance Emulator

Stub out format 8
Jeffrey Pfau jeffrey@endrift.com
Tue, 09 Apr 2013 22:51:21 -0700
commit

5e18eabd0413472b22eff7f15d5d5698a3b2048c

parent

be021605bc04cf61712cdc36bb77cd854d281350

1 files changed, 35 insertions(+), 2 deletions(-)

jump to
M src/isa-thumb.csrc/isa-thumb.c

@@ -84,8 +84,6 @@

DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(ADD, ) DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(SUB, ) -#define DECLARE_INSTRUCTION_THUMB(EMITTER, NAME) \ - EMITTER ## NAME #define DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB(NAME, IMMEDIATE, BODY) \ DEFINE_INSTRUCTION_THUMB(NAME, \ int immediate = IMMEDIATE; \

@@ -133,6 +131,33 @@ DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(MUL, )

DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(BIC, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(MVN, ) +#define DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME, H1, H2, BODY) \ + DEFINE_INSTRUCTION_THUMB(NAME, \ + int rd = opcode & 0x0007 | H1; \ + int rm = (opcode >> 3) & 0x0007 | H2; \ + BODY;) + +#define DEFINE_INSTRUCTION_WITH_HIGH_THUMB(NAME, BODY) \ + DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME ## 00, 0, 0, BODY) \ + DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME ## 01, 0, 8, BODY) \ + DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME ## 10, 8, 0, BODY) \ + DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME ## 11, 8, 8, BODY) + +DEFINE_INSTRUCTION_WITH_HIGH_THUMB(ADD4, ) +DEFINE_INSTRUCTION_WITH_HIGH_THUMB(CMP3, ) +DEFINE_INSTRUCTION_WITH_HIGH_THUMB(MOV3, ) + +DEFINE_INSTRUCTION_THUMB(ILL, ) + +#define DECLARE_INSTRUCTION_THUMB(EMITTER, NAME) \ + EMITTER ## NAME + +#define DECLARE_INSTRUCTION_WITH_HIGH_THUMB(EMITTER, NAME) \ + DECLARE_INSTRUCTION_THUMB(EMITTER, NAME ## 00), \ + DECLARE_INSTRUCTION_THUMB(EMITTER, NAME ## 01), \ + DECLARE_INSTRUCTION_THUMB(EMITTER, NAME ## 10), \ + DECLARE_INSTRUCTION_THUMB(EMITTER, NAME ## 11) + #define DUMMY(X, ...) X, #define DUMMY_4(...) \ DUMMY(__VA_ARGS__) \

@@ -168,6 +193,14 @@ DECLARE_INSTRUCTION_THUMB(EMITTER, ORR), \

DECLARE_INSTRUCTION_THUMB(EMITTER, MUL), \ DECLARE_INSTRUCTION_THUMB(EMITTER, BIC), \ DECLARE_INSTRUCTION_THUMB(EMITTER, MVN), \ + DECLARE_INSTRUCTION_WITH_HIGH_THUMB(EMITTER, ADD4), \ + DECLARE_INSTRUCTION_WITH_HIGH_THUMB(EMITTER, CMP3), \ + DECLARE_INSTRUCTION_WITH_HIGH_THUMB(EMITTER, MOV3), \ + DECLARE_INSTRUCTION_THUMB(EMITTER, ILL), \ + DECLARE_INSTRUCTION_THUMB(EMITTER, ILL), \ + DECLARE_INSTRUCTION_THUMB(EMITTER, ILL), \ + DECLARE_INSTRUCTION_THUMB(EMITTER, ILL), \ + DECLARE_INSTRUCTION_THUMB(EMITTER, ILL) static const ThumbInstruction _thumbTable[0x400] = { DECLARE_THUMB_EMITTER_BLOCK(_ThumbInstruction)