I am trying to create a code that increments the selected unit's speed by 1. Basically "speed resetting" without the resetting, so if I get a speed up, fine, if I don't, I can use this.
Here's what I have, I'll try to comment it.
The base address for the selected unit is 21D5020.
// If the unit's speed is less than 150 (cap is 149). I manually added 1C to the base address
// here because when I tried loading it, then doing an if on 1C it didn't work.
// Activate when SELECT is pressed
// Load the base address into the offset register
// Load the current speed into the stored register
// Increment the value in the stored register
// Write the updated value from the stored register to the address
// Close conditional and and clear registers
When I try this, the results are erroneous, with speed being incremented by 50-60 or so.
If I replace the bold line above with the line below, I get speed changed to 16, or 0xF+1, which is what should happen, so it looks like increment works.
// Write the value F to the stored register
If I remove the underlined line above, speed doesn't change, which is what I think should happen because it should be reading the current value, then just putting it back. So it looks like that part works.
But apparently when I put them together it goes nuts.
Can someone please help me with this?