flat assembler
Message board for the users of flat assembler.
Index
> Main > 16bit code doesn't assemble at high addresses |
Author |
|
pfranz 21 Nov 2023, 00:09
I can't get calls and jumps to compile here:
Code: org 100000h
use16
jmp $ |
|||
21 Nov 2023, 00:09 |
|
pfranz 21 Nov 2023, 20:02
No, I need to write position independent code that for other reasons has a high org, but can be in the low memory too.
I just need the assembler to calculate the relative offset byte (FE in this case) regardless of the org. |
|||
21 Nov 2023, 20:02 |
|
Tomasz Grysztar 21 Nov 2023, 20:42
A 16-bit jump is no longer position-independent if you put it at a high address, because it then truncates the target address (zeroing the upper half of EIP). If you want a code for a low memory, use an ORG setting in a low range. You can switch the ORG settings back and forth if needed (see another thread about the same issue, and there is more in some ancient ones).
|
|||
21 Nov 2023, 20:42 |
|
pfranz 22 Nov 2023, 18:49
Tomasz Grysztar wrote: A 16-bit jump is no longer position-independent if you put it at a high address, because it then truncates the target address (zeroing the upper half of EIP). Switching org back and forth is complicated, I ended up redefining jumps and calls with a macro similarly to what is done in the recent thread. |
|||
22 Nov 2023, 18:49 |
|
Tomasz Grysztar 22 Nov 2023, 18:58
pfranz wrote:
But that's about real mode. If you make a 16-bit code segment in protected mode and give it a high limit, you should be able to run 16-bit code above 10000h just fine, but keep your 66h prefixes in place. |
|||
22 Nov 2023, 18:58 |
|
pfranz 22 Nov 2023, 19:18
I don't have these problems, because my code is in a hybrid block that needs high org just for shared data, but then is copied and executed in the first 64k.
But this is not the issue: if you yourself say that in 16bit protected mode, addresses can be over 10000h, why don't you allow assembling of relative jumps and calls at high addresses? |
|||
22 Nov 2023, 19:18 |
|
Tomasz Grysztar 22 Nov 2023, 19:24
pfranz wrote: I don't have these problems, because my code is in a hybrid block that needs high org just for shared data, but then is copied and executed in the first 64k. |
|||
22 Nov 2023, 19:24 |
|
pfranz 24 Nov 2023, 02:43
My bad, sorry, you had replied to my question but I hadn't understood the meaning of the prefix, because "dword" looked like "far" just as "pword" in 32bit jumps, and the "and" made me think of an absolute jump (because $ and 0xFFFF is in the first 64K page). I thought they were not relative jumps.
I looked at the generated code: the second is what I wanted, but looks counterintuitive. The first is the same, just adds the 66h prefix. |
|||
24 Nov 2023, 02:43 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.