Mask of Destiny wrote:Any pointer used to access a hardware register should be declared with the volatile keyword (like Sik suggested above).
Yep, though one has to be careful because it's easy to get the declaration wrong (since you have both the type of the pointed data and the type of the pointer iself, you need to ensure volatile applies to the former). Also it's important to declare it static or the pointer will end up being stored in RAM, though this also means every file needs to declare it (easiest way is to just cram it inside a header).
Mask of Destiny wrote:Given that it's the assembler doing this, it seems unlikely that volatile will help in this case.
Depends if the compiler passes the assembler a hint if the variable is volatile.
powerofrecall wrote:Plus using a modern GCC to build Genesis stuff felt not unlike using a shotgun to swat a fly, you know?
Is it? I know Sega used GCC for the Saturn, I wouldn't be surprised if GCC was also an option with the Mega Drive. Really the only difference is that you'd be using a newer version of the tool in question.
Sik is pronounced as "seek", not as "sick".