Final Fantasy IV Research & Development / Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« on: January 04, 2015, 06:08:36 PM »Just curious, does anyone know why they didn't use the stack for temporary variables?... Isn't that the primary purpose of pushing and pulling the registers and the accumulator?
Absolutely, with PHA, PLA. But they only do that to save them momentarily, and all the other temporary storage is from some other memory. They use a lot of temporary global variables. Though granted it's hard to tell which of the global uses are truly temporaries. I was more referring to instructions with stack-relative addressing, like "AND $#04,S", so you wouldn't need the global memory, and would probably make our deciphering easier since we know a stack-relative address like that is certainly a local variable which is only used inside that very routine, rather than wondering how many other routines might modify it before we can tell what it might be. Same thing with memory used for parameters. There is limited stack space though, so that could be part of it. I also wonder if those instructions were not actually available on the SNES, but that's just speculation.
We have EVEN MORE themes now, but some old ones are gone...
I will say it's kind of a double-edged sword. Sometimes I'm a little too logical and having bashed out so many calculations in C over the years really spoiled me. I have to remember now that to multiply two numbers I need to transfer them to the appropriate registers (in the proper order) and then wait. I compare it to sticking two things in a microwave and waiting for the ding! 
