CodeEntry* P;
/* Track the insertion point */
- unsigned IP = I;
+ unsigned IP = I+9;
/* sta ptr1 */
X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[2]->LI);
}
CS_InsertEntry (S, X, IP++);
- /* clc is now in the right place */
- ++IP;
+ /* clc */
+ X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[0]->LI);
+ CS_InsertEntry (S, X, IP++);
/* adc yyy */
X = NewCodeEntry (OP65_ADC, L[4]->AM, L[4]->Arg, 0, L[4]->LI);
CS_InsertEntry (S, X, IP++);
/* Remove the old instructions */
- CS_DelEntries (S, IP, 8);
+ CS_DelEntries (S, I, 9);
/* Remember, we had changes */
++Changes;
* tay
* ldx #$00
* lda (ptr1),y
- * ldy #$00
*/
{
unsigned Changes = 0;
L[5]->OPC == OP65_LDY &&
CE_IsKnownImm (L[5], 0) &&
CE_IsCallTo (L[6], "ldauidx") &&
- !CS_RangeHasLabel (S, I+1, 6)) {
+ !CS_RangeHasLabel (S, I+1, 6) &&
+ !RegYUsed (S, I+7)) {
CodeEntry* X;
const char* Arg;
X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[6]->LI);
CS_InsertEntry (S, X, I+13);
- /* ldy #$00 (will eventually get removed later) */
- X = NewCodeEntry (OP65_LDY, AM65_IMM, "$00", 0, L[5]->LI);
- CS_InsertEntry (S, X, I+14);
-
/* Remove the old code */
CS_DelEntries (S, I, 7);