Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Oberon/M 1.2 (OMF output) ... die, REGINT, die! (Developers)

posted by Rugxulo Homepage, Usono, 19.02.2012, 00:54

> If you patch a single byte at offset CB1Fh from 70h to 88h in OC.EXE, you
> will no longer need your external patcher.

Good to know, but ....

> For anyone unfamiliar with topic. What we are doing here is changing the
> OMF REGINT (70h) to a COMENT (88h) record. The REGINT record takes this
> form:
> 70h,
> 00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h
>
> where 00h,00h is a word for the size of the record and the
> bytes following are the initial register values (6 * word). Fortunately
> the COMENT record also has a word for record length following the record
> type byte. So all that happens is the REGINT record becomes a COMENT
> record:
> 88h, 00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h
>
> Real world example, this REGINT record:
> 70 0D 00 01 04 01 01 41 04 05 05 81 04 02 02
>
> becomes a COMENT record:
> 88 0D 00 01 04 01 01 41 04 05 05 81 04 02 02
>
> This is what Rugxulo utility does after the OBJ file has been created by
> the compiler, obviously what the patch above does is allow the compiler to
> be updated so that Rugxulo's external utility isn't required for new OBJ
> files.

Actually, the real problem is that the COMENT record is how MS and Borland had previously extended the format. So there are many subrecords of the 88h form, so I we have to be really careful not to confuse the linker. And I'm afraid just changing 70h to 88h has the potential to do that. Hence why I just put a bunch of blanks (20h) in there. Perhaps I should've used a different method (e.g. there is a subrecord for copyright, I think, which is just plain text). Yes, comment class 0xDA ("random comment") might've been better, but I don't know (without testing) if it would make things work better (heavily doubt it).

(quoting OMF.PDF from OpenWatcom's FTP server, aka TIS 1.1):

"Note: The presence of any unrecognized subtype causes the linker to generate a fatal error."

"A COMENT record cannot be the first or last record in an object module. (The first record must always be THEADR or LHEADR and the last must always be MODEND.)"

"(Appendix 3, Obsolete Records) When linkers encounter these records, they are free to process them, ignore them, or generate an error."

"(Obsolete Records) 70h REGINT Register Initialization Record This record provides information about the 8086 register/register-pairs: CS and IP, SS and SP, DS and ES. The purpose of this information is for a loader to set the necessary registers for initiation of execution."

> An alternative to patching for OBJ files which removes the redundant record
> completely via an external tool is to code such a util to do the
> following:

What I really should've done was go record by record (sequentially from the top) and remove unnecessary ones, but that was much more complicated and slower, so I didn't bother.

> Personally I prefer the OC.EXE patch or Rugxulo method.

Well, none of it is perfectly ideal.

P.S. ALINK 1.6 works (with a warning), but it's ALINK 1.7 that errors out, sadly. (And yes, you still need HACKOMF there.) Since the default .EXE is RSX bloatware, I just recompiled with DJGPP and used UPX (though I had to delete a spurious line in ALINK.H that said "#define strdup _strdup").

 

Complete thread:

Back to the forum
Board view  Mix view
22761 Postings in 2121 Threads, 402 registered users (3 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum