eee410_lecture6 - EEE 410 Microprocessors I Fall 05/06...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Fall 05/06 – Lecture Notes # 6 Outline of the Lecture Directives and sample programs Assemble, link and run a program D IRECTIVES AND SAMPLE PROGRAMS ¾ Directives are statements that give directions to the assembler about how it should translate the assembly language instructions into machine code. ¾ An assembly language instruction consists of four fields, [ label: ] mnemonic [ operands ] [;comments ] Brackets indicate that the field is optional. Brackets are not typed. 1. The label field allows the program to refer to a line of code by name. 2. In a line of assembly language program there can be mnemonic (instruction) and operand(s). Ex: ADD AL,BL MOV AX,6764H 3. Alternatively, instead of these two fields there can be directives. Directives are used by the assembler to organize the program as well as other output files. The following program adds two bytes to calculate their sum. IN this program SEGMENT, DB, ENDS, ASSUME, END, and ENDP are examples of directives. 4. The comment field begins with a “;” ;A Sample Assembly Language Program using FULL SEGMENT DEFINITION STSEG SEGMENT DB 64 DUP (?) STSEG ENDS ;-------------------------------------------------- DTSEG SEGMENT DATA1 DB 52H DATA2 DB 29H SUM DB ? DTSEG ENDS ;-------------------------------------------------- CDSEG SEGMENT MAIN PROC FAR ;This is the program entry point ASSUME CS:CDSEG,DS:DTSEG,SS:STSEG MOV AX,DTSEG ;load the data segment address MOV DS,AX ;assign value to DS MOV AL,DATA1 ;get the first operand MOV BL,DATA2 ;get the second operand ADD AL,BL ;add the operands MOV SUM,AL ;store result in location SUM MOV AH,4CH ;set up to
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 4

eee410_lecture6 - EEE 410 Microprocessors I Fall 05/06...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online