flat assembler
Message board for the users of flat assembler.
Index
> DOS > DOS MZ Exe header is not correct |
Author |
|
LowLevelMahn 17 Aug 2018, 18:22
maybe i got it:
image_start = header_paragraphs * 16 so the 4 extra bytes are just padding |
|||
17 Aug 2018, 18:22 |
|
Tomasz Grysztar 17 Aug 2018, 19:58
Yes, this is padding to the nearest paragraph boundary.
If you need more control over the contents of the headers, please try fasmg with its MZ formatting macros. In the basic form they are fully compatible with fasm 1, but because they are simply macros, you can easily alter anything. |
|||
17 Aug 2018, 19:58 |
|
LowLevelMahn 18 Aug 2018, 05:18
thanks
other question: is there a real need that i can't have an exe with zero size stack? |
|||
18 Aug 2018, 05:18 |
|
Tomasz Grysztar 18 Aug 2018, 05:28
LowLevelMahn wrote: other question: is there a real need that i can't have an exe with zero size stack? You can, however, set up the stack completely manually with the other syntax: Code: stack segment:offset |
|||
18 Aug 2018, 05:28 |
|
LowLevelMahn 25 Sep 2019, 10:23
unearthing this thread
Quote:
i've found that some linkers do not always fill with 4 bytes example for a small dos exe with bytes between header and relocation table Code: optlink.exe: 00 00 link.exe: 01 00 wlink.exe: 00 00 00 00 fasm.exe: 00 00 00 00 ulink.exe: 00000000 55 6E 69 4C 69 6E 6B 00 00 00 00 00 00 00 00 00 UniLink......... 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000020 00 00 00 00 .... does that mean the padding is not necessary or do the linker not produce standard conform executables? |
|||
25 Sep 2019, 10:23 |
|
Tomasz Grysztar 25 Sep 2019, 10:40
The way fasm's syntax works, you define segment where your code/data resides (and then you use the address of that segment, like "main" in the example in this thread) - and that code/data starts at the beginning of that segment. You can, for example, rely that "start:" after "segment main" is going to have an address 0 within that segment.
But with a bit different semantics it could also be possible to set things up differently. You can even use negative segment numbers - like, for example, fasm does when converting .COM program to PE stub (the segment -10h points to PSP, which is 100h bytes before the contents of loaded program - this simulates the segments settings for .COM file). This is why I mentioned fasmg's MZ implementation, as something you can easily tweak to allow a different syntax and/or semantics, fitting to your needs. |
|||
25 Sep 2019, 10:40 |
|
guignol 25 Sep 2019, 10:41
unearthing means bringing up to the surface (obviously from soil)
|
|||
25 Sep 2019, 10:41 |
|
LowLevelMahn 25 Sep 2019, 10:45
i don't want to tweak - i just want to understand if the padding between the header and the relocation table is needed, you said 4 byte for paragraph padding - but the microsoft linker 5.6x (latest 16bit able) added only 2 bytes, also optlink
|
|||
25 Sep 2019, 10:45 |
|
Tomasz Grysztar 25 Sep 2019, 10:51
LowLevelMahn wrote: i don't want to tweak - i just want to understand if the padding between the header and the relocation table is needed, you said 4 byte for paragraph padding - but the microsoft linker 5.6x (latest 16bit able) added only 2 bytes, also optlink PS. I also recommend taking a look at another thread on the topic. |
|||
25 Sep 2019, 10:51 |
|
LowLevelMahn 25 Sep 2019, 11:42
thanks for the help
|
|||
25 Sep 2019, 11:42 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.