I am writing an assembler for a simple RISC processor which has a very small immiediate for jumps (7 bit signed). All jumps are calculated by:
PC = PC + IMMEDIATE + 1
where PC is the program counter which points to the next instruction.
If you need to jump more than 64 lines ahead you need chained jumps as follows:
JMP, 0x3F
//64 lines ahead
JMP, 0x5;
This would effectively jump 70 lines ahead of the current instruction.
My question comes in when we have labels:
JMP, label
//more than 64 lines ahead
label:
How would the assembler generate code for this? would you need two labels or would the assembler put in two jumps for you? If it puts in two jumps how does it know if an instruction is not 64 lines ahead?