From 6f52a266681f999a4d5a3f9e9f05a07fa7078fc3 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 19 Jan 2016 22:11:45 -0800 Subject: [PATCH] LR35902: Implement bitwise instructions, RST --- src/lr35902/emitter-lr35902.h | 532 +++++++++++++++++----------------- src/lr35902/isa-lr35902.c | 73 +++++ 2 files changed, 339 insertions(+), 266 deletions(-) diff --git a/src/lr35902/emitter-lr35902.h b/src/lr35902/emitter-lr35902.h index 2ed25b89c..548c0d997 100644 --- a/src/lr35902/emitter-lr35902.h +++ b/src/lr35902/emitter-lr35902.h @@ -17,7 +17,7 @@ DECLARE_INSTRUCTION_LR35902(EMITTER, INCB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, DECB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, LDB_), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLCA_), \ DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, ADDHL_BC), \ DECLARE_INSTRUCTION_LR35902(EMITTER, LDA_BC), \ @@ -33,7 +33,7 @@ DECLARE_INSTRUCTION_LR35902(EMITTER, INCD), \ DECLARE_INSTRUCTION_LR35902(EMITTER, DECD), \ DECLARE_INSTRUCTION_LR35902(EMITTER, LDD_), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLA_), \ DECLARE_INSTRUCTION_LR35902(EMITTER, JR), \ DECLARE_INSTRUCTION_LR35902(EMITTER, ADDHL_DE), \ DECLARE_INSTRUCTION_LR35902(EMITTER, LDA_DE), \ @@ -209,7 +209,7 @@ DECLARE_INSTRUCTION_LR35902(EMITTER, CALLNZ), \ DECLARE_INSTRUCTION_LR35902(EMITTER, PUSHBC), \ DECLARE_INSTRUCTION_LR35902(EMITTER, ADD), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RST00), \ DECLARE_INSTRUCTION_LR35902(EMITTER, RETZ), \ DECLARE_INSTRUCTION_LR35902(EMITTER, RET), \ DECLARE_INSTRUCTION_LR35902(EMITTER, JPZ), \ @@ -217,7 +217,7 @@ DECLARE_INSTRUCTION_LR35902(EMITTER, CALLZ), \ DECLARE_INSTRUCTION_LR35902(EMITTER, CALL), \ DECLARE_INSTRUCTION_LR35902(EMITTER, ADC), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RST08), \ DECLARE_INSTRUCTION_LR35902(EMITTER, RETNC), \ DECLARE_INSTRUCTION_LR35902(EMITTER, POPDE), \ DECLARE_INSTRUCTION_LR35902(EMITTER, JPNC), \ @@ -225,7 +225,7 @@ DECLARE_INSTRUCTION_LR35902(EMITTER, CALLNC), \ DECLARE_INSTRUCTION_LR35902(EMITTER, PUSHDE), \ DECLARE_INSTRUCTION_LR35902(EMITTER, SUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RST10), \ DECLARE_INSTRUCTION_LR35902(EMITTER, RETC), \ DECLARE_INSTRUCTION_LR35902(EMITTER, RETI), \ DECLARE_INSTRUCTION_LR35902(EMITTER, JPC), \ @@ -233,7 +233,7 @@ DECLARE_INSTRUCTION_LR35902(EMITTER, CALLC), \ DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, SBC), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RST18), \ DECLARE_INSTRUCTION_LR35902(EMITTER, LDIOA), \ DECLARE_INSTRUCTION_LR35902(EMITTER, POPHL), \ DECLARE_INSTRUCTION_LR35902(EMITTER, LDIOCA), \ @@ -241,7 +241,7 @@ DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, PUSHHL), \ DECLARE_INSTRUCTION_LR35902(EMITTER, AND), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RST20), \ DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, JPHL), \ DECLARE_INSTRUCTION_LR35902(EMITTER, LDIA), \ @@ -249,7 +249,7 @@ DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, XOR), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RST28), \ DECLARE_INSTRUCTION_LR35902(EMITTER, LDAIO), \ DECLARE_INSTRUCTION_LR35902(EMITTER, POPAF), \ DECLARE_INSTRUCTION_LR35902(EMITTER, LDAIOC), \ @@ -257,7 +257,7 @@ DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, PUSHAF), \ DECLARE_INSTRUCTION_LR35902(EMITTER, OR), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RST30), \ DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, LDAI), \ @@ -265,264 +265,264 @@ DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ DECLARE_INSTRUCTION_LR35902(EMITTER, CP), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB) + DECLARE_INSTRUCTION_LR35902(EMITTER, RST38) #define DECLARE_LR35902_CB_EMITTER_BLOCK(EMITTER) \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \ - DECLARE_INSTRUCTION_LR35902(EMITTER, STUB) + DECLARE_INSTRUCTION_LR35902(EMITTER, RLCB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLCC), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLCD), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLCE), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLCH), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLCL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLCHL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLCA), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRCB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRCC), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRCD), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRCE), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRCH), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRCL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRCHL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRCA), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLC), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLD), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLE), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLH), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLHL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RLA), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRC), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRD), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRE), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRH), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRHL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RRA), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SLAB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SLAC), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SLAD), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SLAE), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SLAH), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SLAL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SLAHL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SLAA), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRAB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRAC), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRAD), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRAE), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRAH), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRAL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRAHL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRAA), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SWAPB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SWAPC), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SWAPD), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SWAPE), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SWAPH), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SWAPL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SWAPHL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SWAPA), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRLB), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRLC), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRLD), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRLE), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRLH), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRLL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRLHL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SRLA), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT0B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT0C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT0D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT0E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT0H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT0L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT0HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT0A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT1B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT1C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT1D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT1E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT1H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT1L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT1HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT1A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT2B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT2C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT2D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT2E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT2H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT2L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT2HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT2A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT3B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT3C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT3D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT3E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT3H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT3L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT3HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT3A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT4B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT4C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT4D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT4E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT4H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT4L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT4HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT4A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT5B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT5C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT5D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT5E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT5H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT5L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT5HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT5A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT6B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT6C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT6D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT6E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT6H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT6L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT6HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT6A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT7B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT7C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT7D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT7E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT7H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT7L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT7HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, BIT7A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES0B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES0C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES0D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES0E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES0H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES0L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES0HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES0A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES1B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES1C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES1D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES1E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES1H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES1L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES1HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES1A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES2B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES2C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES2D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES2E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES2H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES2L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES2HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES2A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES3B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES3C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES3D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES3E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES3H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES3L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES3HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES3A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES4B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES4C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES4D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES4E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES4H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES4L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES4HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES4A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES5B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES5C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES5D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES5E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES5H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES5L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES5HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES5A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES6B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES6C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES6D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES6E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES6H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES6L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES6HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES6A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES7B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES7C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES7D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES7E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES7H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES7L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES7HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, RES7A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET0B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET0C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET0D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET0E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET0H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET0L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET0HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET0A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET1B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET1C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET1D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET1E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET1H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET1L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET1HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET1A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET2B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET2C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET2D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET2E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET2H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET2L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET2HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET2A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET3B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET3C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET3D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET3E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET3H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET3L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET3HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET3A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET4B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET4C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET4D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET4E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET4H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET4L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET4HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET4A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET5B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET5C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET5D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET5E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET5H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET5L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET5HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET5A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET6B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET6C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET6D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET6E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET6H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET6L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET6HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET6A), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET7B), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET7C), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET7D), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET7E), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET7H), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET7L), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET7HL), \ + DECLARE_INSTRUCTION_LR35902(EMITTER, SET7A) #endif diff --git a/src/lr35902/isa-lr35902.c b/src/lr35902/isa-lr35902.c index 83ca03442..773797430 100644 --- a/src/lr35902/isa-lr35902.c +++ b/src/lr35902/isa-lr35902.c @@ -564,10 +564,83 @@ DEFINE_POPPUSH_INSTRUCTION_LR35902(DE, D, d, e); DEFINE_POPPUSH_INSTRUCTION_LR35902(HL, H, h, l); DEFINE_POPPUSH_INSTRUCTION_LR35902(AF, A, a, f.packed); +#define DEFINE_CB_2_INSTRUCTION_LR35902(NAME, BODY) \ + DEFINE_INSTRUCTION_LR35902(NAME ## B, uint8_t reg = cpu->b; BODY; cpu->b = reg) \ + DEFINE_INSTRUCTION_LR35902(NAME ## C, uint8_t reg = cpu->c; BODY; cpu->c = reg) \ + DEFINE_INSTRUCTION_LR35902(NAME ## D, uint8_t reg = cpu->d; BODY; cpu->d = reg) \ + DEFINE_INSTRUCTION_LR35902(NAME ## E, uint8_t reg = cpu->e; BODY; cpu->e = reg) \ + DEFINE_INSTRUCTION_LR35902(NAME ## H, uint8_t reg = cpu->h; BODY; cpu->h = reg) \ + DEFINE_INSTRUCTION_LR35902(NAME ## L, uint8_t reg = cpu->l; BODY; cpu->l = reg) \ + DEFINE_INSTRUCTION_LR35902(NAME ## HLDelay, \ + uint8_t reg = cpu->bus; \ + BODY; \ + cpu->bus = reg; \ + cpu->executionState = LR35902_CORE_MEMORY_LOAD; \ + cpu->instruction = _LR35902InstructionNOP;) \ + DEFINE_INSTRUCTION_LR35902(NAME ## HL, \ + cpu->index = LR35902ReadHL(cpu); \ + cpu->executionState = LR35902_CORE_MEMORY_LOAD; \ + cpu->instruction = _LR35902Instruction ## NAME ## HLDelay;) \ + DEFINE_INSTRUCTION_LR35902(NAME ## A, uint8_t reg = cpu->a; BODY; cpu->a = reg) + +#define DEFINE_CB_INSTRUCTION_LR35902(NAME, BODY) \ + DEFINE_CB_2_INSTRUCTION_LR35902(NAME ## 0, uint8_t bit = 1; BODY) \ + DEFINE_CB_2_INSTRUCTION_LR35902(NAME ## 1, uint8_t bit = 2; BODY) \ + DEFINE_CB_2_INSTRUCTION_LR35902(NAME ## 2, uint8_t bit = 4; BODY) \ + DEFINE_CB_2_INSTRUCTION_LR35902(NAME ## 3, uint8_t bit = 8; BODY) \ + DEFINE_CB_2_INSTRUCTION_LR35902(NAME ## 4, uint8_t bit = 16; BODY) \ + DEFINE_CB_2_INSTRUCTION_LR35902(NAME ## 5, uint8_t bit = 32; BODY) \ + DEFINE_CB_2_INSTRUCTION_LR35902(NAME ## 6, uint8_t bit = 64; BODY) \ + DEFINE_CB_2_INSTRUCTION_LR35902(NAME ## 7, uint8_t bit = 128; BODY) + +DEFINE_CB_INSTRUCTION_LR35902(BIT, cpu->f.n = 0; cpu->f.h = 1; cpu->f.z = !(reg & bit)) +DEFINE_CB_INSTRUCTION_LR35902(RES, reg &= ~bit) +DEFINE_CB_INSTRUCTION_LR35902(SET, reg |= bit) + +#define DEFINE_CB_ALU_INSTRUCTION_LR35902(NAME, BODY) \ + DEFINE_CB_2_INSTRUCTION_LR35902(NAME, \ + BODY; \ + cpu->f.n = 0; \ + cpu->f.h = 0; \ + cpu->f.z = !reg;) + +DEFINE_CB_ALU_INSTRUCTION_LR35902(RL, int wide = (reg << 1) | cpu->f.c; reg = wide; cpu->f.c = wide >> 8) +DEFINE_CB_ALU_INSTRUCTION_LR35902(RLC, reg = (reg << 1) | (reg >> 7); cpu->f.c = reg & 1) +DEFINE_CB_ALU_INSTRUCTION_LR35902(RR, int low = reg & 1; reg = (reg >> 1) | (cpu->f.c << 7); cpu->f.c = low) +DEFINE_CB_ALU_INSTRUCTION_LR35902(RRC, int low = reg & 1; reg = (reg >> 1) | (low << 7); cpu->f.c = low) +DEFINE_CB_ALU_INSTRUCTION_LR35902(SLA, cpu->f.c = reg >> 7; reg <<= 1) +DEFINE_CB_ALU_INSTRUCTION_LR35902(SRA, reg = ((int8_t) reg) >> 1; cpu->f.c = 0) +DEFINE_CB_ALU_INSTRUCTION_LR35902(SRL, cpu->f.c = reg & 1; reg >>= 1) +DEFINE_CB_ALU_INSTRUCTION_LR35902(SWAP, reg = (reg << 4) | (reg >> 4); cpu->f.c = 0) + +DEFINE_INSTRUCTION_LR35902(RLA_, + int wide = (cpu->a << 1) | cpu->f.c; + cpu->a = wide; + cpu->f.z = 0; + cpu->f.h = 0; + cpu->f.n = 0; + cpu->f.c = wide >> 8;) + +DEFINE_INSTRUCTION_LR35902(RLCA_, + cpu->a = (cpu->a << 1) | (cpu->a >> 7); + cpu->f.z = 0; + cpu->f.h = 0; + cpu->f.n = 0; + cpu->f.c = cpu->a & 1;) + DEFINE_INSTRUCTION_LR35902(DI, cpu->irqh.setInterrupts(cpu, false)); DEFINE_INSTRUCTION_LR35902(EI, cpu->irqh.setInterrupts(cpu, true)); DEFINE_INSTRUCTION_LR35902(HALT, cpu->cycles = cpu->nextEvent); +DEFINE_INSTRUCTION_LR35902(RST00, LR35902RaiseIRQ(cpu, 0x00)); +DEFINE_INSTRUCTION_LR35902(RST08, LR35902RaiseIRQ(cpu, 0x08)); +DEFINE_INSTRUCTION_LR35902(RST10, LR35902RaiseIRQ(cpu, 0x10)); +DEFINE_INSTRUCTION_LR35902(RST18, LR35902RaiseIRQ(cpu, 0x18)); +DEFINE_INSTRUCTION_LR35902(RST20, LR35902RaiseIRQ(cpu, 0x20)); +DEFINE_INSTRUCTION_LR35902(RST28, LR35902RaiseIRQ(cpu, 0x28)); +DEFINE_INSTRUCTION_LR35902(RST30, LR35902RaiseIRQ(cpu, 0x30)); +DEFINE_INSTRUCTION_LR35902(RST38, LR35902RaiseIRQ(cpu, 0x38)); + DEFINE_INSTRUCTION_LR35902(STUB, cpu->irqh.hitStub(cpu)); static const LR35902Instruction _lr35902CBInstructionTable[0x100] = {