Documente Academic
Documente Profesional
Documente Cultură
Haibo Wang
ECE Department
Southern Illinois University
Carbondale, IL 62901
7-1
Disadvantages:
Need to know detail hardware implementation
Not portable
Slow to development and difficult to debug
7-2
Comments
.MODEL SMALL
.STACK
Assembly directive
.CODE
.STARTUP
MOV
AX,40H
;set AX to 0040H
D1: MOV
DS,AX
MOV
SI,17H
AND
.EXIT
END
Instructions
Assembly directive
Label
7-3
Instruction Format
General Format of Instructions
Label: Opcode
Operands
; Comment
Label: It is optional. It provides a symbolic address that can be used in branch instructions
Opcode: It specifies the type of instructions
Operands: Instructions of 80x86 family can have one, two, or zero operand
Comments: Only for programmers reference
MOV AL, BL
Mode
Operand1 Operand2
1000100011000011
MOV
Register
mode
7-4
Assembler Directives
List File
Source File
DATA SEGMENT PARA 'DATA
ORG
7000H
POINTS DB
SUM
0000
DB
16 DUP(?)
?
7000H
POINTS DB
7010
SUM
00
DB
16 DUP(?)
?
DATA ENDS
7011
DATA ENDS
0000
ORG
8000H
MOV
AX,7000H
MOV
DS,AX
MOV
AL,0
CODE ENDS
DS,AX
8005 B0 00 MOV
AL,0
8000H
AX,7000H
END TOTAL
7-5
Assembler Directives
SEGMENT directive
ENDS directive
END directive
ORG directive
DB: Define Byte; DW, .
ASSUME directive
Specifies the segment register (segment Register) that will be used to calculate the eff
addresses for all labels and variables defined under a given segment or group name (
7-6
Assembler Directives
Simplified Segment Directives
.MODEL SMALL
DATA
SEGMENT
CODE
SEGMENT
TINY
one
one
SMALL
one
one
MEDIUM
one
multiple
COMPACT
multiple
one
LARGE
multiple
multiple
.DATA
ORG
POINTS DB
SUM
DB
7000H
16 DUP(?)
?
.CODE
TOTAL:
ORG
8000H
MOV
AX,7000H
HUGE
multiple
multiple
MOV
DS,AX
FLAT*
one
one
MOV
AL,0
RET
END
TOTAL
7-7
Linker
Assembler
Syntax check
Translate source
files into
OBJ
files
machine code
OBJ
files
Executable
files
7-8
Syntax check;
Translate assembly instructions into machine codes
Link numoff
7-9
7-10
List File
0000
0200 12
0000
0000 B8 0000
0003 8E D8
0005 A0 0100
0008 EB FB
.model small
.data
org 0200H
Var1 DB 12H
.code
MOV AX, 0000
MOV DS, AX
label1: MOV AL, DS:[0100H]
JMP label1
end
7-11
Binary file
7-12