The use of assembly language compiler (MASM.EXE) of the source file to compile the source code to produce an object file
Connecting the target file linker (LINK.EXE), an executable file can be run directly in the operating system.
The executable file contains two parts:
Program (translated from the source over the assembly instruction opcode) and data (data defined in the source program)
Related descriptive information
An assembler is composed of a plurality of segments, these segments are used to store code data of the living space for use as a stack.
The program returns: return should add a program segment at the end of the program
mov ax,4c00H
int 21H
These instructions implemented feature is the routine returns.
After loading the program, stored in the memory segment DS to the address where the program, to the memory offset address is 0, the address of the memory area where the program is: ds: 0;
The first 256 bytes of this memory area is stored in psp, dos and procedures for communication.
256 rearwardly from the byte is stored in the program space.
So we can get from the segment address SA psp in ds, psp offset address is 0, the physical address SA * 16 + 0
Because the PSP accounted for 256 (100H) bytes, so the physical address of the program are:
at * 16 + 0 + 256 = 16 + 16 * to 16 * = (a + 16) * 16 + 0
assume cs:codesg
codesg segment
mov ax,0123h
mov bx,0456h
add ax,bx
add ax,ax
mov ax,4c00h
int 21h
codesg ends
end
The masm.exe and link.exe together into the folder:
Reproduced in: https: //my.oschina.net/u/204616/blog/545278