diff options
author | Jana Rekittke <jana@rekittke.name> | 2009-07-02 21:14:37 +0200 |
---|---|---|
committer | Benedikt Böhm <bb@xnull.de> | 2009-07-02 21:14:37 +0200 |
commit | 1c67357ad255533b03cb22d31b7c6cf31028fc99 (patch) | |
tree | 705dc88564544942f87a9946a54e872074ef4f74 | |
parent | 87b6f874776b253f77f4a1bf4c1844d99a8e544f (diff) | |
download | swppy-1c67357ad255533b03cb22d31b7c6cf31028fc99.tar.gz swppy-1c67357ad255533b03cb22d31b7c6cf31028fc99.tar.xz swppy-1c67357ad255533b03cb22d31b7c6cf31028fc99.zip |
adapt instructions changes from back/tac.py
-rw-r--r-- | src/emu/cpu.c | 32 | ||||
-rw-r--r-- | src/emu/opc.c | 13 | ||||
-rw-r--r-- | src/emu/opc.h | 13 |
3 files changed, 29 insertions, 29 deletions
diff --git a/src/emu/cpu.c b/src/emu/cpu.c index 5256cb6..7e62ffb 100644 --- a/src/emu/cpu.c +++ b/src/emu/cpu.c @@ -198,29 +198,27 @@ void execute(uint32_t IR) Z = (GPR[a] == GPR[b]); N = (GPR[a] < GPR[b]); break; - case OPC_BEQ: - if (Z) + case OPC_BEZ: + if (GPR[a] == 0) PC += c * sizeof(uint32_t); break; - case OPC_BNE: - if (!Z) - PC += c * sizeof(uint32_t); + case OPC_EQ: + GPR[a] = Z; break; - case OPC_BLT: - if (N) - PC += c * sizeof(uint32_t); + case OPC_NE: + GPR[a] = !Z; break; - case OPC_BGE: - if (!N) - PC += c * sizeof(uint32_t); + case OPC_LT: + GPR[a] = N; break; - case OPC_BLE: - if (Z || N) - PC += c * sizeof(uint32_t); + case OPC_LE: + GPR[a] = Z || N; break; - case OPC_BGT: - if (!Z && !N) - PC += c * sizeof(uint32_t); + case OPC_GE: + GPR[a] = !N; + break; + case OPC_GT: + GPR[a] = !Z && !N; case OPC_J: PC = GPR[a]; break; diff --git a/src/emu/opc.c b/src/emu/opc.c index 870a272..fa46b26 100644 --- a/src/emu/opc.c +++ b/src/emu/opc.c @@ -28,12 +28,13 @@ opc_mapping_t opc_map[] = { { "SH", OPC_SH }, { "SW", OPC_SW }, { "CMP", OPC_CMP }, - { "BEQ", OPC_BEQ }, - { "BNE", OPC_BNE }, - { "BLT", OPC_BLT }, - { "BGE", OPC_BGE }, - { "BLE", OPC_BLE }, - { "BGT", OPC_BGT }, + { "BEZ", OPC_BEZ }, + { "EQ", OPC_EQ }, + { "NE", OPC_NE }, + { "LT", OPC_LT }, + { "GE", OPC_GE }, + { "LE", OPC_LE }, + { "GT", OPC_GT }, { "J", OPC_J }, { "JAL", OPC_JAL }, { "SYS", OPC_SYS }, diff --git a/src/emu/opc.h b/src/emu/opc.h index 45d21a8..b766afa 100644 --- a/src/emu/opc.h +++ b/src/emu/opc.h @@ -47,12 +47,13 @@ /* branch instructions */ #define OPC_CMP 030 -#define OPC_BEQ 031 -#define OPC_BNE 032 -#define OPC_BLT 033 -#define OPC_BGE 034 -#define OPC_BLE 035 -#define OPC_BGT 036 +#define OPC_BEZ 031 +#define OPC_EQ 032 +#define OPC_NE 033 +#define OPC_LT 034 +#define OPC_LE 035 +#define OPC_GE 036 +#define OPC_GT 037 /* jump instructions */ #define OPC_J 040 |