
Branch Coding |
|
Jump instructions are simpler than branches
since they contain the target address, rather than an offset.
Again, the actual target is not stored, but one fourth of
the target, since the low two bits are always zero.
Consider the instruction
jal fred
Assume that fred is located at address 0x004007E8.
- Shift the target address right two bits (divide it by four).
This gives 0x1001FA.
- Look up the instruction to find its type and format.
(You'll find it on p. A-65.)
Plug the numbers into the format. Pad the target to 26 bits.
For once, no registers.
| 000011 | 00000100000000000111111010 | |
- Regroup the bits.
| 0000 | 1100 | 0001 | 0000 | 0000 | 0001 | 1111 | 1010 | |
- Represent as a hex number: 0C1001FA
Branch Coding |
|