;generate negativ offset
ldis r7, 0xFF00
- add r6, r3, r7
+ ;r6 is now the 'real' negativ number
+ or r6, r6, r7
+ ;multiply by to get the offset
+ lls r6, r6, 2
+ ;generate address in table
+ add r6, r3, r6
;r0 now has the target address
ldw r0, 0(r6)
;we calc the offset
- sub r8, r8, r0
+ sub r8, r0, r2
+ ;we shift 2 bits out, because rel. br takes instr.
+ ;count and not address amount ...
+ lrs r8, r8, 2
;set the upper 16 bit 0
andx r8, 0xFFFF
;shift to the position of imm in br