Skip to content

Commit c98d96a

Browse files
authored
Merge pull request #167 from shattered/_9056c248
z80: use (hl) addressing mode (port of #147)
2 parents 7164de7 + 618efd6 commit c98d96a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/cowbe/archz80.cow.ng

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,9 @@ gen STORE4(CONSTANT():c, DEREF4(ADDRESS():a)) uses hl
12211221
gen a := ADD1(a, b|d|h:lhs)
12221222
{ E_add(REG_A, $lhs); }
12231223

1224+
gen a := ADD1(a, DEREF1(hl))
1225+
{ R_flush(REG_A); E("\tadd a,(hl)\n"); }
1226+
12241227
gen a|b|d|h := ADD1($$, CONSTANT(value==-1))
12251228
{ E_dec($$); }
12261229

@@ -1233,6 +1236,9 @@ gen a := ADD1(a, CONSTANT():c)
12331236
gen a := SUB1(a, b|d|h:rhs)
12341237
{ E_sub($rhs); }
12351238

1239+
gen a := SUB1(a, DEREF1(hl))
1240+
{ R_flush(REG_A); E("\tsub a,(hl)\n"); }
1241+
12361242
gen a|b|d|h := SUB1($$, CONSTANT(value==1))
12371243
{ E_dec($$); }
12381244

@@ -1254,18 +1260,27 @@ gen a := NEG1(b|d|h:lhs)
12541260
gen a := OR1(a, b|d|h:lhs)
12551261
{ E_or($lhs); }
12561262

1263+
gen a := OR1(a, DEREF1(hl))
1264+
{ R_flush(REG_A); E("\tor a,(hl)\n"); }
1265+
12571266
gen a := OR1(a, CONSTANT():c)
12581267
{ E_ori($c.value as uint8); }
12591268

12601269
gen a := AND1(a, b|d|h:lhs)
12611270
{ E_and($lhs); }
12621271

1272+
gen a := AND1(a, DEREF1(hl))
1273+
{ R_flush(REG_A); E("\tand a,(hl)\n"); }
1274+
12631275
gen a := AND1(a, CONSTANT():c)
12641276
{ E_andi($c.value as uint8); }
12651277

12661278
gen a := EOR1(a, b|d|h:lhs)
12671279
{ E_xor($lhs); }
12681280

1281+
gen a := EOR1(a, DEREF1(hl))
1282+
{ R_flush(REG_A); E("\txor a,(hl)\n"); }
1283+
12691284
gen a := EOR1(a, CONSTANT():c)
12701285
{ E_xori($c.value as uint8); }
12711286

0 commit comments

Comments
 (0)