You may look into Wikipedia or short summary for students. Everybody says that there are two instructions for the same thing. But nobody tells why?
Branches ( b ) use a PC-relative displacement while jumps ( j ) use absolute addresses. The distinction is important for position-independent code.
Unconditional Jump Instructions Conditional Jump Instructions. Unconditional Jump Instructions: Transfers the program sequence to the described memory address. Conditional Jump Instructions Transfers the program sequence to the described memory address only if the condition in satisfied.
Branches are used to transmission control, unconditionally or conditionally, to a stated position of the program. Unconditional branches are continually taken. In contrast, conditional branches contain a condition and thus are either taken or not taken, based on either the particular condition is true or false.
The JMP instruction permits a jump to any location within the 68000's address space. A BRA instruction is preferred to a JMP, because it makes it easier to write position independent code(i.e., relative branch addresses do not have to be modified if a program is relocated in memory).
Branches allow for conditions. But allowing for conditions takes up more bits in the instruction. Therefore, a branch's address is only 2^16 bits and only allows you to branch 2^15 - 1 instructions backward or 2^15 instructions forward.
A jump is unconditional and the bits saved by leaving out the condition can be used for the address. A jump allows for a 26 bit address and so can jump much further in the code than a branch. At the expense of not being conditional.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With