I'm looking for the equivalent of the following assembly program with TASM, i.e. creating a 32-bit binary file with nonzero org. Here is how it works with NASM:
; $ nasm -O0 -f bin -o id.bin id.nasm
bits 32
cpu 386
org 432100h
mov eax, foo
push eax
foo:
; $ ndisasm -b 32 id.bin
; 00000000 B806214300 mov eax,0x432106
; 00000005 50 push eax
Is it possible to do the same with a combination of TASM and TLINK? How would the .asm file look like? What are the compilation command lines?
Please note:
The output file must be 6 bytes long (see hex dump above), without any headers.
It's really TASM+TLINK. In this question I'm not looking for alternatives. (NASM can obviously do it, see above.)
The
orgmust be 432100h. It's not OK to useorg 0andmov eax, foo+432100h.
Some context: I have a moderately complex x86 32-bit assembly program with binary file output, and I'm curious if it would be possible to port it to TASM.
I managed to make it work with TASM+WLINK (rather than TASM+TLINK), using TASM 4.1 and the WLINK from OpenWatcom v2.
Here is my id.asm file:
Here is how I compile it:
Output:
Here is an alternative id.asm file, using TASM ideal mode:
Unfortunately most early versions of WLINK (such as in Watcom C/C++ 11.0B, the last release before OpenWatcom) don't support
format raw.