Relocate

These features are still under development and subject to change/improvement. If you are interested in this topic, please let me know, as I am not a user of the thing at all, I will only make changes based on your suggestions or requests!

RELOCATION, ENDRELOCATION

Declare the beginning of a relocatable code area. RASM will assemble the code twice internally, shifting the assembly by #102 in order to detect changes due to high weights and those due to low weights. There are several constraints inherent in this method:
- you must not change modules in the relocatable code area.
- the relocatable area will end with the loss of the current module (i can enhance RASM to restore this).
- you must not change the current ORG. If you have several functions, etc. you can always make several relocatable sections.
- if you use variables AND you modify them inside the code to relocate, you must make sure that they are initialized inside the section to relocate. Otherwise, the output information will be at least wrong.
- you cannot use relocatable sections inside dynamically compressed segments.

Typical usage example:

org #100
relocate
maroutine ld hl,mytable : ld a,hi(mytable2)
call #8000
ld a,lo(mytable2) : add 4 : ld l,a
ld h,hi(mytable2) : ld a,(hl)
ret
mytable defw 300,400,mytable2
mytable2 defw 400,300,2
endrelocate

Will output a .rel assembly file:

relocation0:
.reloc16 defw #0101,#0115
.reloc8h defw #0104,#010E
.reloc8l defw #0109

The global label defines the section, followed by a number because the source program may contain multiple sections of relocatable code.
The three proximity labels define the 16-bit offsets to be modified as well as the 8-bit offsets corresponding to the high or low weight.

Sauf mention contraire, le contenu de cette page est protégé par la licence Creative Commons Attribution-ShareAlike 3.0 License