Download EE314 – Microprocessor Systems

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
EE314 – Microprocessor Systems
Laboratory Project 1, Fall 1998
Introduction to MASM Tool Sets
Introduction
The purpose of this project is to study the structure of a typical assembly language program, and to
practice using the MASM assembler software. Before coming to your laboratory session, read
Experiment #5 of the Laboratory Manual, and type the assembly language program of Example 5-1
into a file on a 3.5 disk. Be sure that you use a text only format when you do this so that the
assembler is not confused by any formatting characters. (When you save your file use the long
method. Point to File, point to Save As, in the save as file type:, at the bottom of the window, set
to text only. You will find a summary of 80x86 instructions in section 2.6 of your text. You will also
find some information about the assembler and codeview in Appendices G and H.
Laboratory Procedure
During the laboratory period, complete the following steps, and write down the answers as you go.
Your laboratory report for this week will consist of your typed answers to the questions, together
with a printed version of the listing file of the assembled program that you worked with.
Step 1: Perform steps 1 through 6 of Experiment 5 in the Laboratory Manual. Activate the
assembler from dosshell by double clicking on the masm 61 or from dos by typing pwb at the dos
prompt. Note that all the options you have set will be remembered in the following work sessions in
a normal exit. Please note since there are more than one section of lab, this statement may not
hold. The last people to use the computer may have set the program to their own requirements. In
the step 4 instruction that says "go to Language Options", you will also have to go then to Masm
options. Now continue with instructions in step 4.
What is the result of executing the program in Example 5-2 with inputs: (a) a number 6, and
(b) a letter D? Describe the purpose of this program.
Step 2: Perform steps 7 and 8 from the Manual. Set up codeview screen with three main windows:
source, memory, and register. Experiment with them from the OPTIONS menu. Also:
Describe the difference between pressing the F10 key and the F8 key.
Describe how you re-execute a program before it is terminated during single stepping.
The Data->Add watch command, or control w, allows one to monitor the content of a variable
without looking at the memory window.
Describe how to set a watch for the register AX. Is it identical to the register window?
Explain.
The following is an example of a short assembly language program.
;File: example.asm
;By:
;Lab Partner:
;Date:
;Purpose:
;set instruction set(could be 286, 386, …etc.)
.286
;define code segment
CODE
SEGMENT ‘code’
ASSUME
; start a new segment labeled as CODE
cs:CODE
.NOLIST
INCLUDE
; turn off the listing of the following lines
ee314.inc
.LIST
; include a macro definition file if any
; turn on the listing of the following lines
;declare data inside the code segment
MESSAGE
13,10,’Hello world!’,13,10,’$’
db
;
;define a procedure
MAIN
PROC FAR
; start of a procedure named as MAIN
mov
ax,cs
; copy the cs register to ds so that both the instruction
mov
ds,ax
; and data use the same segment
;display the message to the screen using int 21h with function number 9
mov
ah,9
; load the function number
mov
dx,OFFSET MESSAGE ;
int
21h
; activate the DOS function int 21h
;exit to DOS
mov
ax,4c00h
int
21h
; load the function number
MAIN
ENDP
; end of MAIN procedure
CODE
ENDS
; end of CODE segment
END
MAIN