Today I needed to translate some 16-bit DOS assembly to machine code, and I was unable to find an instruction reference that included the binary representation of the commands. Therefore, I did some fiddling around with a DOS version of TASM, which I happened to have laying around.
To assemble a set of instructions, first put it into this structure:
cseg segment 'code'
org 100h
start:
YOUR ASSEMBLER HERE
cseg ends
end start
Save that as a text file, test.asm for instance. Open up your DOS emulator and run this:
tasm test.asm
It produces an object file, which must be linked into a real executable file. For that, there's a different TASM utility:
tlink /t test.obj
You'll then have a COM file which you can open with a hex editor to get your machine code.
I used TASM 3.1 and TLINK 5.1, which are probably available online somewhere.
No comments:
Post a Comment