For building 16bit executables with Microsoft tools, you will need an older linker version, since 16bit support was removed in more recent versions.

At the time of this writing (2nd Jan 2007), a version of MS link.exe supporting 16bit programs can be found here, straight from Microsoft. If that link doesn't work, you might try the Downloads section of http://win32asm.cjb.net/ instead.

Recent MASM versions (at least up to and including Microsoft (R) Macro Assembler Version 8.00.50727.42) still support assembling 16bit code though, so you probably won't need to use an old version of ml.exe.

When assembling your 16bit assembly source code, you should use "/omf" switch instead of "/coff".

Here's a really simple piece of code that you can test to see if everything's up and working properly:


.model tiny
.code

start:
push cs
pop ds

mov dx, offset sHelloWorld
mov ah, 9
int 21h

mov ax, 4c00h
int 21h

ret

sHelloWorld BYTE "Hello, World :)", 13, 10, '$'

end start


Build it with the following commands:

ml /c /omf 16bit.asm
link 16.obj,,,,,


All the commas are necessary, they simply tell the linker to use default values for various output files.

If you want to write .com files, you will need to find a com2exe tool, or alternatively use an assembler that more suitable output formats, like FASM or NASM.
Posted on 2007-01-02 04:31:00 by f0dder
no F0dder, I do it all the time with masm and 16bit linker with right switches easily builds .com files
Posted on 2007-01-27 01:00:47 by daydreamer
For a .com file, use
link /tiny 16bit,,,,,
Posted on 2007-01-27 18:01:22 by sinsi