Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.
That is basically it. Remember you can use a branch instruction rather than a JMP if you know a flag will always be in a known state. Also, if you change the flow of code in your true block, you don't need to have the else. Example:
Actually it would be if #$10 >= ScrollY. Remember the carry flag is set after a subtraction unless the second number (which in this case is ScrollY) is greater, then it will be clear for borrow.
doppelganger wrote:Actually it would be if #$10 >= ScrollY. Remember the carry flag is set after a subtraction unless the second number (which in this case is ScrollY) is greater, then it will be clear for borrow.
My bad. I'm still getting used to assembly and the 6502.
Yes. I find that method interesting. One could code both ldx instructions inside an if-else-endif structure, but it's more efficient to load a default that may be 'wrong'.
doppelganger wrote:Actually it would be if #$10 >= ScrollY. Remember the carry flag is set after a subtraction unless the second number (which in this case is ScrollY) is greater, then it will be clear for borrow.
My bad. I'm still getting used to assembly and the 6502.
You can use macros to create aliases for opcodes with easier to remember names, such as:
In 65816 mode, the assembler automatically includes macros that define blt (branch less than) and bge (branch greater or equal) as synonyms for bcc and bcs.
If you're using ca65, use .macpack generic, which provides add, sub, bge, blt, bgt, and ble. I like including .macpack longbranch, too: it provides jeq, jne, jmi, jpl, jcs, jcc, jvs, and jvc.