You can also use any assembler (e.g. MASM or TASM) that uses standard Intel mnemonics and operand syntax.
asm asg2;If it assembles without errors you can "link" it into an executable MS-DOS "COM" (.com) file using the command:
val /co asg2;(the /co option is required). Then you can run the program by typing
asg2
code segment public ; (1) assume cs:code,ds:code ; (2) start: org 100h ; (3)and the following 2 lines at the end of your code:
code ends ; (1) end start ; (3)These assembler directives: (1) tell the linker that the object file contains executable code, (2) tell the assembler how the segment registers will be set up when the program is loaded, and (3) make sure the executable code is assembled to run at the appropriate location (100H) within the code segment.
When DOS executes (runs) a .COM file, it loads the code into memory, sets the DS and CS segment registers to the start of the segment, sets SS to the top of the 64k segment and calls the code at location CS:100H.
Your code should terminate using the instruction
int 20hto return control to DOS