Mikes360 Posted February 1, 2015 Share Posted February 1, 2015 Hi Guys, I have a situation where forcing a 4 cycle branch without actually crossing a page boundary would really help me out with my main drawing kernel. I know you can do a sta.w to force that extra cycle is there an equivalent for the branch opcodes? Thanks, Mike Quote Link to comment Share on other sites More sharing options...
Rybags Posted February 1, 2015 Share Posted February 1, 2015 Don't think so. Failed branch = 2 cycles, taken = 3, taken with page crossing = 4. There's illegal opcodes that do NOP that takes >2 cycles. There's the trick of branching into the operand of a BIT <abs> instruction that can give variable delay. You might try and squeeze the extra cycle in elsewhere but it can be tricky given it's a conditional thing. Quote Link to comment Share on other sites More sharing options...
Mikes360 Posted February 1, 2015 Author Share Posted February 1, 2015 Ok thanks in my case I will just force the kernel to cross a page boundary to get the 4 cycles. I thought it would be worth asking however. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted March 4, 2015 Share Posted March 4, 2015 If you are only branching over one or two bytes, using a superfluous opcode could work. Example: LDX $80 BNE Non_Zero .byte $2C Non_Zero: LDX $90 Assuming the destination "Non_Zero" isn't crossing a page, that example burns 9 cycles whether or not the branch is taken. Byte $2C is read as BIT $abs (using 4 cycles, misinterpreting LDX $90 as it's 2-byte argument). If you need to preserve status flags, you can use a triple-NOP opcode ($0C). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.