Ah, well you are basically facing the very same limits in machine code, just later, because machine code programs are generally smaller than high-level language ones. Most machine code programs are written in position-independent (PC-relative) code. This has, however, limits in that it can't address further away than +-32k. Once you reach that limit (which is admittedly pretty high considering the average size of a machine code program), you are faced with the same problem, because now you either need to insert jump islands, some sort of runtime relocation, or register-based addressing (which is also some sort of runtime relocation).bwinkel67 wrote:...perspective is important, and from a machine code perspective you aren't forced into boundaries that higher level languages put in purposefully.
Especially PE programs and programs for high-color machines can easily exceed these limits, even in machine code because the high amount of space occupied by bitmap graphics.
I have reached this limit already several times and what I typically do is reverting to machine code macros along the lines of
Code: Select all
* This macro jumps (in a "PC-relative" way) to a
* subroutine which would normally be not reachable
* by a bsr. Use in large programs you dont want to
* make 'impure'.
FARJSR MACRO target,register
EXPAND
lea .lab[.L],[register]
add.l ([register]),[register]
jsr ([register])
bra.s .across[.L]
.lab[.L] dc.l [target]-*
.across[.L]
ENDM