1

I am a little confused, with the PUBDEF record in the OMF object format. My assembler has generated a result which states the record is 4000 bytes, when it clearly is not so why would it do this?

Image of Hex view of OMF

The 0xa0 and 0x0f is the record length in little endian format,

please view the specificaiton: http://pierrelib.pagesperso-orange.fr/exec_formats/OMF_v1.1.pdf

It also appears to state that the strings are zero bytes in length and at one point even has just a zero string length with no string provided. Maybe I am reading the file wrong? I have spent hours now and am struggling.

If anyone can help me with my issue as I am writing a linker and cannot continue without understanding this.

Thanks

btlog
  • 4,760
  • 2
  • 29
  • 38
NibbleBits
  • 124
  • 7
  • I have figured out that the 0x0f is the offset until the end of the string, but this makes no sense as the spec clearly shows both 0x0a and 0x0f as a little endian short that represents the size of the record. – NibbleBits Dec 08 '16 at 12:00
  • You asked me in [this question](http://stackoverflow.com/q/41418521/968261) to take a look here. Taking. I'm not very familiar with OMF. However, given the context in which it's being asked (for a custom compiler), I may offer to look at ELF instead. In my [Smaller C compiler](https://github.com/alexfru/SmallerC) I assemble both 32-bit and 16-bit into ELF object files. From them I can generate executables for DOS (tiny model .COM, small and huge models .EXEs, DPMI and unreal mode EXEs), Windows (PE), Linux (ELF) and flat binaries. I do have a custom linker for this, though. – Alexey Frunze Jan 02 '17 at 05:41
  • Ad LNAMES you are not wrong, the first string indeed has intentionally zero size. Segments with empty classname refer to it, for instance. – vitsoft Jan 02 '17 at 09:05

1 Answers1

1

There is no PUBDEF record in the file. You seem to have miscalculated the previous record size:

0000:80 THEADR
000e:88 CoMENT
0032:96 LNAMES
0041:98 SEGDEF
004B:98 SEGDEF
0055:88 COMENT
005C:a0 LEDATA
006E:a0 LEDATA
007b:8a MODEND

Learn to use more sofisticated tools for OMF inspection, such as Tdump.exe or ODU.exe.

vitsoft
  • 5,515
  • 1
  • 18
  • 31
  • Do you have any links, the example executables you provided don't appear to run on Windows 10. I assume its for Win 98 and below. Could you provide me with some links please :) – NibbleBits Jan 02 '17 at 15:59
  • 1
    @NibbleBits I'm using Object File Dumper, Public Domain by Sven B. Schreiber, similar product is available at https://sourceforge.net/projects/jwasm.hx-dos.p/files/DumpOmf16.zip/download Tdump is Borland commercial sw, shipped with Turbo products, perhaps available as abandonware, described at http://docwiki.embarcadero.com/RADStudio/Seattle/en/TDUMP.EXE,_the_File_Dumping_Utility – vitsoft Jan 02 '17 at 17:06
  • 1
    Btw, most DOS stuff (not just games) works under DOSBox quite well. That's one of the ways I'm testing my compiler. – Alexey Frunze Jan 03 '17 at 07:59