Author Topic: OMF format question  (Read 16177 times)

Offline JnZn558

  • Jr. Member
  • *
  • Posts: 7
OMF format question
« on: October 04, 2012, 02:26:41 PM »
I do not know if this is the right area to post my question, if not I apologize for my mistake and please forum admin to move it to according place. So nasm is supporting OMF format, 16 bit => obj, 32 bit => win32, alright? I have downloaded the nasm source code and TIS (Tool Interface Standard) v1.1 Relocatable Object Module Format (OMF) Specification, this pdf briefly described most records type of OMF. but it not very fully and my question are as following.

1. does every object file created by nasm contains only single record? or more records?
2. I look these object file with hex editor and it display 0x80 => THEADR—Translator Header Record
    When does it show 0xF0 Library Header Record?
3. Some type of OMF record can not found in nasm source code, does it mean nasm do not support them? ( f.e 0xCC => OMF Version Record)

THX VERY MUCH 4 HELP

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: OMF format question
« Reply #1 on: October 06, 2012, 07:24:44 PM »
Although I was a "dos guy" for a while, I mostly did .com files, and rarely used "-f obj" for 16-bit and even more rarely for 32-bit. I really don't understand the OMF format very well. I've looked at the TIS spec, but I haven't "digested" it. Nonetheless, fools rush in, so let me attempt answers to your questions...

Quote
1. does every object file created by nasm contains only single record? or more records?

Should be more than one. You may or may not have found "omfdump.c" in the "misc" directory of the Nasm source. It may help in interpreting what Nasm is emitting.

It is pretty well known that Borland tools don't much like Nasm's OMF files. In the "32-bit extensions", in particular, Nasm is using some 16-bit constants, although 32-bit equivalents exist. This "seems to work" with some linkers... MS's old segmented linker, Alink (written for Nasm, pretty much), Val, I think... but not Borland's tools. Borland is "dead", of course, but I read somewhere that Delphi is "making a comeback".

The easiest way to deal with this is probably to assemble to "-f win32" and convert to OMF using Agner Fog's "objconv(.exe)" - http://www.agner.org - if that's what you need to do.

Quote
2. I look these object file with hex editor and it display 0x80 => THEADR—Translator Header Record

Yeah... and what I'm seeing as the contents of this record is the name of the .asm file from whence it came. This is followed by a COMENT, "The Netwide Assembler" and a version number... and a bunch more records... Try that "omfdump" and/or Agner Fog's "objconv".

Quote
When does it show 0xF0 Library Header Record?

I would guess (and it's just a guess) that this would be created by a "librarian" tool... MS's "lib.exe" (which I understand runs "link.exe") or David Lindauer's "libx.exe" or such. I don't think you'd expect to see it from Nasm.

Quote
3. Some type of OMF record can not found in nasm source code, does it mean nasm do not support them? ( f.e 0xCC => OMF Version Record)

It's a good bet that if you don't see it in the source code, Nasm doesn't support it. The TIS doc describes 0xCC as a "new" record type. Apparently Nasm didn't get the memo. :) Do you need it?

I consider OMF to be an "obsolete" format. Nasm could do better, but fixing it at this late date seems like a very low priority to me. Feel free to express a contrary opinion if you have need of better OMF support from Nasm!

Best,
Frank


Offline JnZn558

  • Jr. Member
  • *
  • Posts: 7
Re: OMF format question
« Reply #2 on: October 08, 2012, 04:34:09 PM »
hello frank, thx for your post. it is very helpfull information. do you have any instant messenger? can I add you?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: OMF format question
« Reply #3 on: October 08, 2012, 05:59:57 PM »
No, I really don't do "chat" - too slow a typist. Email is "instant" enough for me. fbkotler (pig's tail) myfairpoint (decimal point) net.

Best,
Frank