I finally got it to work, but in an odd way lol. Since the game replaces my first line of code with some other random instruction, i started experimenting with it. Depending on the instruction you put as the first line, the “replacement” will change as well (e.g. li r0, 0 turns into subi rtoc, rtoc... but if i were to write subi r2,r1, 9, this will be replaced with subi r4, r4, 1707 in game)
So I changed the first instruction to subi r2,r1, 9, THEN i put the li r0,0 instruction after. As expected: the subi instruction was replaced and my li r0, 0 instruction now loads. It works fine now!
Of course, I realize this is obviously not the best solution since the game is still inserting a random instruction (in this case, subi r4,r4, 1707) which might affect the game and break something later, but i’ll keep seeing what’ll happen. After a few battles testing this out, nothing seems wrong at all
Thanks for your help, I will definitely look into setting a flag and replacing the subi rtoc instruction, JoshuaMK. I’m still very much a beginner in ASM so i’ll be needing the practice
Edit; This doesn’t seem to be an issue with the CT-code engine. I looked at the generated file using a hex editor and my li r0 instruction was indeed there, at the correct address. The instruction is replaced once the game loads I assume. Most likely could be my own inexperience in using the engine properly
So I changed the first instruction to subi r2,r1, 9, THEN i put the li r0,0 instruction after. As expected: the subi instruction was replaced and my li r0, 0 instruction now loads. It works fine now!
Of course, I realize this is obviously not the best solution since the game is still inserting a random instruction (in this case, subi r4,r4, 1707) which might affect the game and break something later, but i’ll keep seeing what’ll happen. After a few battles testing this out, nothing seems wrong at all
Thanks for your help, I will definitely look into setting a flag and replacing the subi rtoc instruction, JoshuaMK. I’m still very much a beginner in ASM so i’ll be needing the practice
Edit; This doesn’t seem to be an issue with the CT-code engine. I looked at the generated file using a hex editor and my li r0 instruction was indeed there, at the correct address. The instruction is replaced once the game loads I assume. Most likely could be my own inexperience in using the engine properly