summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/emu/cpu.c32
-rw-r--r--src/emu/opc.c13
-rw-r--r--src/emu/opc.h13
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