Skip to content

Commit

Permalink
Fix some 8080 and Z80 code generation issues where DIV and REM weren'…
Browse files Browse the repository at this point in the history
…t marking

HL as being in use, resulting in occasional register corruption.
  • Loading branch information
davidgiven committed Mar 24, 2024
1 parent 14b4287 commit a4e1444
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/cowbe/arch8080.cow.ng
Original file line number Diff line number Diff line change
Expand Up @@ -1085,16 +1085,16 @@ gen bc|de|hl := SUB2(bc|de|hl:lhs, CONSTANT():c) uses a
aluop2i($lhs, $c.value as uint16, $$, "sui", "sbi");
}

gen de := DIVU2(de, bc) uses a
gen de := DIVU2(de, bc) uses a|hl
{ dvrmu2(); }

gen hl := REMU2(de, bc) uses a
{ dvrmu2(); }

gen de := DIVS2(de, bc) uses a
gen de := DIVS2(de, bc) uses a|hl
{ dvrms2(); }

gen hl := REMS2(de, bc) uses a
gen hl := REMS2(de, bc) uses a|hl
{ dvrms2(); }

gen hl := MUL2(hl, de) uses a|bc
Expand Down
8 changes: 4 additions & 4 deletions src/cowbe/archz80.cow.ng
Original file line number Diff line number Diff line change
Expand Up @@ -1423,16 +1423,16 @@ gen hl := SUB2(hl:lhs, bc|de:rhs)

%}

gen bc := DIVU2(bc, de) uses a
gen bc := DIVU2(bc, de) uses a|hl
{ E_dvrmu2(); }

gen hl := REMU2(bc, de) uses a
{ E_dvrmu2(); }

gen bc := DIVS2(bc, de) uses a
gen bc := DIVS2(bc, de) uses a|hl
{ E_dvrms2(); }

gen de := REMS2(bc, de) uses a
gen de := REMS2(bc, de) uses a|hl
{ E_dvrms2(); }

gen hl := MUL2(de, bc) uses a
Expand Down Expand Up @@ -1550,7 +1550,7 @@ gen hlhl := REMU4(bcbc, dede) uses a
gen bcbc := DIVS4(bcbc, dede) uses a|hlhl
{ E_callhelper("_dvrms4"); }

gen dede := REMS4(bcbc, dede) uses a
gen dede := REMS4(bcbc, dede) uses a|hlhl
{ E_callhelper("_dvrms4"); }

gen hlhl := AND4(dede, hlhl) uses a
Expand Down

0 comments on commit a4e1444

Please sign in to comment.