|
|
Framework for an Assembly Program
You may want to copy the following lines into a generic file that you will use as a starting point for all assembly files you put together. When we start working with modules, we will only need to add a line or two before we can add these files to a library. As you read through the text book you may see references to .CODE, .DATA, .STACK, and .model. If you want to work with these, you may for the first project only. These are just built in short cuts to the assembler. .DATA is equal to _DATA SEGMENT... Unfortunately, you cannot add modules that are written in this format to a library. So I would recommend you start using the explicit segments example I have shown below. I think this will save you a headache in the long run. I will discuss how you can add support for higher processor instruction sets (i.e. 286, 386, 486, pentium, etc) and math co-processor instructions later. You do not need any of these for the first project.
TITLE myProg.ASM
;=======================================================================
; brief description of what this program does
;=======================================================================
_DATA SEGMENT USE16 BYTE PUBLIC 'DATA'
; put data in here
_DATA ENDS
_TEXT SEGMENT USE16 WORD PUBLIC 'CODE'
ASSUME cs:_TEXT, ds:_DATA
Start:
mov ax, _DATA ; set DS to point to our data segment
mov ds, ax
; add your code here (main)
mov ax, 4C00h ; function: exit program and return to DOS
int 21h
; add procedures here
_TEXT ENDS
_STACK SEGMENT USE16 STACK 'STACK'
DW 100 dup(?)
_STACK ENDS
END Start
Last Modified: January 26, 1999
-
Barry E. Mapen
|