Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Oberon 1.2 OC (compiler) patch (Developers)

posted by Arjay(R), 18.02.2012, 23:37

> Unfortunately, it uses at least one problematic ("obsolete") OMF .OBJ
> record in its output: REGINT. This chokes most linkers.

If you patch a single byte at offset CB1Fh from 70h to 88h in OC.EXE, you will no longer need your external patcher. The compilers code changes from:
mov ax,0070h (B80070)

mov ax,0088h (B80088)

Searching OC.EXE for the sequence B80070 in any hex editor will also easily find the required patch point as the sequence only appears once in the file.

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.

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:

1)Get filesize of OBJ file to patch
2)Open the OBJ file for writing
3)Read/temporarily store the last 5 bytes of a Oberon generated OBJ file
4)Seeking offset filesize-21 bytes
5)Writing the 5 saved bytes from offset
6)Updating the filesize to be 17 bytes less
7)Closing file

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


Complete thread:

Back to the forum
Board view  Mix view
14974 Postings in 1335 Threads, 236 registered users, 18 users online (0 registered, 18 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum