Assembly: Code Template

Contributor Icon Contributed by William_Wilson Date Icon March 5, 2006  
Tag Icon Tagged: Computer programming

The general template for designing an Assembly code program



TITLE
COMMENT |

|
.MODEL SMALL
.STACK 100H
.DATA

.CODE
.486
INCLUDE io.mac
main PROC
.STARTUP

done:
.EXIT

main ENDP
END main

-after title commonly listed is the name of the current file possibly including the path

-placed between the | | are comments describing the program

-model type SMALL describes code which only points within it’s own scope, or uses extern with path names.

-under .DATA goes your pre-defined terms, such as global variables and strings to be output

-under .CODE goes the actual code of your program

-.486 describes the type of program, if you wish to include ONLY 8086 type you may also choose .386

-the include here allows for read and write of IO properties from the keyboard (standard IO)

-main is only a standard name, it can be any name .STARTUP is a label to denote the beginning of the program code

-done: is a label showing a method beginning. Assembly works top down ignoring labels, but is a relative term to be used in jmp statements.

-.EXIT exits the program

-end PROC denotes the end of a process or program

Questions/Comments: william_a_wilson@hotmail.com
-William. ยง (marvin_gohan)

Previous recipe | Next recipe |
 
blog comments powered by Disqus