Fix bug causing wrong code generation for single-byte indirect local stores beyond the first 256 bytes of the stack frame.

This fixes the compca19.c test case.
This commit is contained in:
Stephen Heumann 2015-12-21 11:37:30 -06:00
parent be91f1d1cc
commit 6bd0bef8c5

14
Gen.pas
View File

@ -3409,10 +3409,9 @@ case optype of
GenImplied(m_pha);
end; {if}
GetPointer(op^.left);
if short then
if simple then
GenNative(m_sep, immediate, 32, nil, 0);
if gLong.where = inPointer then begin
if short and simple then
GenNative(m_sep, immediate, 32, nil, 0);
if zero then
GenNative(m_lda_imm, immediate, 0, nil, 0)
else
@ -3423,7 +3422,9 @@ case optype of
GenNative(m_sta_indlY, direct, gLong.disp, nil, 0);
end {if}
else if gLong.where = localAddress then begin
if gLong.fixedDisp then
if gLong.fixedDisp then begin
if short and simple then
GenNative(m_sep, immediate, 32, nil, 0);
if (gLong.disp & $FF00) = 0 then
if zero then
GenNative(m_stz_dir, direct, gLong.disp, nil, 0)
@ -3442,6 +3443,7 @@ case optype of
GenNative(m_sta_dirX, direct, 0, nil, 0);
end; {else}
end {else}
end {if}
else begin
if (gLong.disp & $FF00) <> 0 then begin
GenImplied(m_txa);
@ -3450,6 +3452,8 @@ case optype of
GenImplied(m_tax);
gLong.disp := 0;
end; {if}
if short and simple then
GenNative(m_sep, immediate, 32, nil, 0);
if zero then
GenNative(m_stz_dirX, direct, gLong.disp, nil, 0)
else begin
@ -3459,6 +3463,8 @@ case optype of
end; {else}
end {else if}
else {if gLong.where = globalLabel then} begin
if short and simple then
GenNative(m_sep, immediate, 32, nil, 0);
if zero then begin
if not smallMemoryModel then
GenNative(m_lda_imm, immediate, 0, nil, 0);