Language…
13 users online:  Atari2.0, DanMario24YT, Dennsen86, derv82, drkrdnk, eltiolavara9, Fozymandias, Maw, Nayfal, prisvag, Red2010, Serena, steelsburg - Guests: 289 - Bots: 253
Users: 64,795 (2,375 active)
Latest user: mathew

16 bit branch

Just a quick question that I've kinda been assuming the answer to but not actually sure if it's true. Say I have something like this:

Code
REP #$20	;16 bit A
LDA $D3		;Y pos within level
CMP #$004F
BCS something

...


Can switch back to 8 bit between compare and the branch? Although it seems to work, I wouldn't want to be doing this and introducing some unknown side effects.

Thanks


Yep, you can. REP/SEP only modify the specific processor bits you specify; nothing else is changed. In fact, with BCS/BCC, you can actually even load a new value to A between the comparison and branch too (since LDA/etc. don't affect the carry bit).

This page might help for future reference, by the way; it indicates which flags are modified by each opcode.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Thanks for the response and the reference, i'll make sure to keep it in mind.