Code: Select all
3000 .backward
3000 60 RTS
3001 60 RTS
3002 60 RTS
3003 80 FB BRA backward
3005 80 03 BRA forward
3007 60 RTS
3008 60 RTS
3009 60 RTS
300A .forward
300A 60 RTS
3005 has BRA forward, which is 80 03. The next instruction is at location 3007.
forward is at 300A, which is 3007+3
Backward branches are counted from the point of the branch distance:
3003 has BRA backward, which is 80 FB.
FB xor FF = 4
or
FF - FB = 4
The value of FB is at location 3004, so 3004 - 4 = 3000 which is where backward is.
Or, is it:
100 - FB = 5
Next instuction is at 3005, and 3005 - 5 = 3000?
Would I be correct in my assumptions?