From 489fb66d051ffd3352d9224db4d7fae51bbb8ea5 Mon Sep 17 00:00:00 2001 From: Sergey Svishchev Date: Fri, 24 May 2024 14:00:16 +0300 Subject: [PATCH] 8080: use M addressing mode --- src/cowbe/arch8080.cow.ng | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/cowbe/arch8080.cow.ng b/src/cowbe/arch8080.cow.ng index 12b63afa..fe6adb34 100644 --- a/src/cowbe/arch8080.cow.ng +++ b/src/cowbe/arch8080.cow.ng @@ -891,6 +891,9 @@ gen STORE4(stk4, DEREF4(hl)) uses all gen a := ADD1(b|d|h:lhs, a) { E_add($lhs); } +gen a := ADD1(DEREF1(hl), a) + { E("\tadd m\n"); } + gen a|b|d|h := ADD1($$, CONSTANT(value==-1)) { E_dcr($$); } @@ -900,6 +903,9 @@ gen a|b|d|h := ADD1($$, CONSTANT(value==1)) gen a := SUB1(a, b|d|h:rhs) { E_sub($rhs); } +gen a := SUB1(a, DEREF1(hl)) + { E("\tsub m\n"); } + gen a|b|d|h := SUB1($$, CONSTANT(value==1)) { E_dcr($$); } @@ -921,18 +927,27 @@ gen a := NEG1(b|d|h:lhs) gen a := OR1(a, b|d|h:lhs) { E_ora($lhs); } +gen a := OR1(a, DEREF1(hl)) + { E("\tora m\n"); } + gen a := OR1(a, CONSTANT():c) { E_ori($c.value as uint8); } gen a := AND1(a, b|d|h:lhs) { E_ana($lhs); } +gen a := AND1(a, DEREF1(hl)) + { E("\tana m\n"); } + gen a := AND1(a, CONSTANT():c) { E_ani($c.value as uint8); } gen a := EOR1(a, b|d|h:lhs) { E_xra($lhs); } +gen a := EOR1(a, DEREF1(hl)) + { E("\txra m\n"); } + gen a := EOR1(a, CONSTANT():c) { E_xri($c.value as uint8); } @@ -1288,6 +1303,12 @@ gen BEQ0(CONSTANT():c1, CONSTANT():c2):b uses all gen BEQ1(b|d|h:nota, a):b uses all { bequ1(self.n[0], $nota); } +gen BEQ1(a, DEREF1(hl)) uses all +{ + E("\tcmp m\n"); + E_jumps_jz_jnz(self.n[0]); +} + gen BEQ1(a, CONSTANT():c):b uses all { bequ1c(self.n[0], $c.value as uint8); } @@ -1297,6 +1318,12 @@ gen BLTU1(a, b|d|h:rhs):b uses all E_jumps_jc_jnc(self.n[0]); } +gen BLTU1(a, DEREF1(hl)) uses all +{ + E("\tcmp m\n"); + E_jumps_jc_jnc(self.n[0]); +} + gen BLTU1(a, CONSTANT():c):b uses all { var v := $c.value as uint8;