Program with exe file
Copy the files of Turbo Assembler to your PC (folder ASM).
Run the Norton Commander.
Enter the ASM folder.
Create a file by pressing Shift + F4, and in the resulting window type a name: HELLO I. ASM
Type the following code in the editor window. Take into account points, spaces, and other characters. Its not necessary to input empty lines.
.MODEL SMALL
.STACK l00h
.CODE
start: mov ax, DGROUP
mov ds,ax
mov dx,OFFSET Message
mov ah,9
int 21h
mov ax,4c00h
int 21h
.DATA
Message DB 'HELLO WORLD !',0dh,0ah,'$'
END
start
;Is indicated, that model memory is used for exe-files.
;Set the stack size - 256 bytes (in hexadecimal system).
;Message (segment address of line) is placed to the DS register.
;Link to the message.
;Place number 9, which is a DOS function number - «line output» in АН register.
;Display a message on the screen.
;Function of DOS completion of the program.
;Complete the program.
;Line with the message.
;End of the program.
;Label indicating the beginning of the program.
In the program are identified three segments:
- stack segment by .STACK directive of 256 bytes size;
- code segment by .CODE directive;
- data segment by .DATA directive.
To make them more visible in the example, they were separated by the empty string. In the message string value 0dh sets the carriage return, value 0ah sets the line feed, $ symbol sets the end of the line.
After input the text of the program, press Esc and on a question about saving the result respond "yes". The text of the program will be saved in the Hello1. asm file.
After the the program text typed it must be converted into an executable file.
In the general case process of program creation involves the following steps:
- At the stage of assembling the program source code is transformed into an intermediate form, which is called an object module;
- At the stage of arrangement - one or more modules are combined into an executable program;
- Assembling and arrangement will be done using the command line.