Optimize multiple incax* and incax*/ldaxi

- Group multiple calls to incax* and decax* into a single one
- Replace incaxN/jsr ldaxi with ldy #N+1/jsr ldaxidx

Fixes #2055
This commit is contained in:
Colin Leroy-Mira
2025-07-06 18:40:04 +02:00
parent facf7b2a0c
commit 20a9db757d
4 changed files with 121 additions and 17 deletions

20
test/val/bug2205.c Normal file
View File

@@ -0,0 +1,20 @@
#include "unittest.h"
struct Object
{
int a;
int data[10];
};
struct Object object_data = { 0x0102, {0x0304, 0x0506,
0x0708, 0x090A, 0x0B0C,
0x0D0E, 0x0F10, 0x1112,
0x1314, 0x1516}};
TEST
{
struct Object *o = &object_data;
ASSERT_IsTrue(o->a == 0x0102, "Wrong value for a");
ASSERT_IsTrue(o->data[2] == 0x0708, "Wrong value for data[2]");
}
ENDTEST