Skip to content

Commit

Permalink
Merge pull request #147 from shattered/_533b17ab
Browse files Browse the repository at this point in the history
8080: use M addressing mode
  • Loading branch information
davidgiven authored May 24, 2024
2 parents 63aaa79 + 489fb66 commit f412ec4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/cowbe/arch8080.cow.ng
Original file line number Diff line number Diff line change
Expand Up @@ -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($$); }

Expand All @@ -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($$); }

Expand All @@ -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); }

Expand Down Expand Up @@ -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); }

Expand All @@ -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;
Expand Down

0 comments on commit f412ec4

Please sign in to comment.