Address issues

This commit is contained in:
Colin Leroy-Mira
2025-07-20 16:29:00 +02:00
parent 095ee0b27c
commit fa1b6ed4f7

View File

@@ -569,14 +569,13 @@ unsigned OptAXLoad2 (CodeSeg* S)
signed Val; signed Val;
CodeEntry* E[3]; CodeEntry* E[3];
CodeEntry* X; CodeEntry* X;
char *End;
/* Get the next entry */ /* Get the next entry */
E[0] = CS_GetEntry (S, I); E[0] = CS_GetEntry (S, I);
/* Check for ldy followed by incaxy followed by jsr/jmp ldaxi */ /* Check for ldy followed by incaxy followed by jsr/jmp ldaxi */
if (E[0]->OPC == OP65_LDY && if (E[0]->OPC == OP65_LDY &&
E[0]->AM == AM65_IMM && CE_IsConstImm (E[0]) &&
CS_GetEntries (S, E+1, I+1, 2) && CS_GetEntries (S, E+1, I+1, 2) &&
E[1]->OPC == OP65_JSR && E[1]->OPC == OP65_JSR &&
strcmp (E[1]->Arg, "incaxy") == 0 && strcmp (E[1]->Arg, "incaxy") == 0 &&
@@ -585,8 +584,7 @@ unsigned OptAXLoad2 (CodeSeg* S)
!CS_RangeHasLabel (S, I, 3)) { !CS_RangeHasLabel (S, I, 3)) {
/* Replace with ldy (y+1) / jsr ldaxidx */ /* Replace with ldy (y+1) / jsr ldaxidx */
Val = strtoul(E[0]->Arg + 1, &End, 16); Val = E[0]->Num + 1;
Val++;
X = NewCodeEntry (OP65_LDY, AM65_IMM, MakeHexArg (Val), 0, E[0]->LI); X = NewCodeEntry (OP65_LDY, AM65_IMM, MakeHexArg (Val), 0, E[0]->LI);
CS_InsertEntry (S, X, I+3); CS_InsertEntry (S, X, I+3);