Assembly If/Else statement
Mag748
Posts: 266
Hello,
I was trying to think of how to do an If/Then statement in assembly and came up with the seemingly crude way of doing it. Although it does work fine, I wanted to know if there is a better way.
Any thoughts?
Thanks,
Marcus
I was trying to think of how to do an If/Then statement in assembly and came up with the seemingly crude way of doing it. Although it does work fine, I wanted to know if there is a better way.
mov t0, mode shr t0, #1 wc ' If Mode & $01 == $01 if_nc jmp #skip shl tPat, #1 wc ' Then shift tPat right 1, if_nc xor outa, pinMask ' and Toggle Output if tPat & $01 == zero. skip ' Else do nothing.
Any thoughts?
Thanks,
Marcus
Comments
Ah ha, I though the test instruction might be needed somewhere. And I'm still wrapping my head around all the if_x conditions. That worked perfectly.
Thanks!
-Marcus