Click to See Complete Forum and Search --> : TASM and Machine Language


Bluefox815
September 5th, 2008, 10:03 PM
Is there a way I can use TASM 5.0 to compile and link a program so that I end up with a .com file (machine language) instead of an executable? Also, I think I'm a little confused. Is a .com file capable of running without Windows/DOS (or any OS), or is that only a .bin file?

iviggers
September 6th, 2008, 10:30 PM
Hi BlueFox815,

Assuming your asm code is in file.asm you do this:
tasm file.asm [Enter]
tlink /t file.obj [Enter]
and if code was OK you'll have file.com

To run a .com program you need DOS (or Windows/DOS, etc.) as long as you call DOS services, say Int 21h and probably others like Int 2fh. But if you're using only BIOS services or port input/output or write directly to memory (like for screen display), then you don't need DOS. This is how boot loaders are coded.

Certainly a .com file is pure binary. It only contains program data and opcodes, no need of file format like EXE files.

When you intend to make a program running on DOS you'll always need the directive "org 100h" because this is required by DOS when loading a program.

Iņaki Viggers