Language…
13 users online: 1337doom, AbuseFreakHacker,  BeeKaay, ben15420, Gorry, Green, LadiesMan217, OrangeBronzeDaisy, playagmes169, Rykon-V73, ShoopDaWhoop, signature_steve,  YouFailMe - Guests: 274 - Bots: 581
Users: 64,795 (2,369 active)
Latest user: mathew

ASM Hacking Related - GPS and Asar

Sometimes, I saw some patches in asar that have "if... then".
Wait, what? Isn't that NOT ASM?
And the second question is about the STA $XXXX|!addr, x...
I think I need some help!

(English is not my native language)
What exactly is it you need help with? Assembly, even if a low level language still has branching script code with if and then statements.
Originally posted by TheReborn
Sometimes, I saw some patches in asar that have "if... then".
Wait, what? Isn't that NOT ASM?

You're right - those are not ASM, they're commands for Asar. (Like a preprocessor, if you will.) They're not inserted into the ROM (just like "header", "org", defines and labels aren't) - Asar checks them to find out what code to insert.

Originally posted by TheReborn
And the second question is about the STA $XXXX|!addr, x...
I think I need some help!

The | operator is also a command for Asar. The same goes for +, - * and others: you can use them in your code to do calculations, and Asar will calculate the result and generate ASM code from it. For example, if you said LDA $0DBF+$6000, the actual code inserted into the ROM would be LDA $6DBF. (Of course, this only works with constant values.)

The | operator does a bitwise OR operation on the two numbers - in this case, you can think of it as "add the numbers if the second is less than the first". !addr is most likely defined in the .asm file to be something like $6000.

In total, the line STA $XXXX|!addr means "STA $XXXX, but add !addr to $XXXX if necessary". This is useful for SA-1 ROMs, because they need different adresses in their patches.


 
Thank you so much WYE!