Assembly Language Syntax - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Assembly Language Syntax

Description:

such as a formula or rhyme used as an aid in remembering. ... The American Heritage Dictionary. Target: MOV {destination} , {source} ;comment ... – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 10
Provided by: mark105
Category:

less

Transcript and Presenter's Notes

Title: Assembly Language Syntax


1
Assembly Language Syntax
Italicized entries are optional bracketed
entries are required for some instructions
Target
MOV
destination ,
source
comment
a label
provides an operand
A 3-letter mnemonic
receives the result
Assembler Directives
Number Format
8088 Programming Model
2
Labels
Target
MOV
destination ,
source
comment
A label must begin with a letter or number and
end with a colon. A few special characters,
such as _ (underscore) and are allowed. Labels
cannot duplicate assembler directives or assembly
language mnemonics. Instructions may reference
locations using their label, such as JMP Target
Labels must be unique, and the A86 assembler is
NOT case sensitive. The exception is local
labels, which consist of a single alphabetic
character followed by a number. Local labels may
be repeated within a program, and the default is
to go to the previous label. A forward jump may
be forced with the gt operator such as JMP gt L1
3
Operation Mnemonic
Target
MOV
destination ,
source
comment
A mnemonic operation is required and will be
either a three-letter mnemonic (MOV) or
four-letter (IMUL)
Labels and variable names cannot be the same as
the mnemonic used for any operation
mnemon ic (n?-m?n??k) adj. Relating to,
assisting, or intended to assist the memory.
mnemonic n. A device, such as a formula or rhyme
used as an aid in remembering. Greek mnemonikos,
ffrom mnemon, menmon-, mindful. .. The
American Heritage Dictionary
4
Destination, Source
Target
MOV
destination ,
source
comment
The destination and source can be a register, a
variable, a constant, or a memory location. For
transfer, arithmetic, and logical operations, the
destination and source length must be the
same ADD AL, BL MOV DX,CX but not MOV DX, AL
Memory-to-memory transfers also are not allowed.
square brackets indicate indirect addressing.
That is, the register does not hold the operand,
but holds the address of the operand. MOV AX, SI
AX?contents of SI MOV AX, SI
AX?contents of memory address DSSI
5
Comments
Target
MOV
destination ,
source
comment
A semicolon indicates a comment. Comments can
follow operations, or a comment may take up an
entire line. The following section converts
from Fahrenheit to Celsius MOV AL, temp
temperature in Fahrenheit SUB AL, 32 adjust 0
degree mark
EE 485 programs must be commented to receive
full credit! Comments should be meaningful, and
not simply repeat the instruction. For good
comments, see the example above. A meaningless
comment would be MOV AL, temp store
temp in AL
6
Assembler Directives
Assembler Directives are instructions to the
assembler instead of instructions to be executed
at run-time. Assembler directives follow a
different syntax than assembly language
instructions. The most common used directives
are the DB and DW commands to reserve memory.
Cont dB Press any key to continue
assembler directive
variable name
ASCII string
7
Variables
dB Press any key to continue
Cont
variable name
Variables are names of data or arrays. In this
case MOV AL, Cont would result in the ASCII code
for P being stored in AL MOV AL,
Cont1 would result in the ASCII code
for r being stored in AL LEA DX,
Cont DX?address of the string in memory MOV AX,
Cont is illegal, since Cont is defined as a byte
8
Assembler Directives
Data1 dB 100 (?) reserves 100 bytes Data2 dW
100 (?) reserves 100 words or 200 bytes
Word 16 bits Byte 8 bits The 8088 stores
words as Mem Location ? lowbyte Mem Location 1
? lowbyte db 1,2 dw 1,2
01
00
02
00
01
02
9
Number Format
  • The default radix for numbers in A86 is decimal
  • Hexadecimal numbers are indicated by adding the
    suffix h for example, MOV AL, 3Ah
  • All numbers must begin with a number. It is
    sometimes necessary to precede a number with a
    zero for example, MOV AL, 0ffh
  • Other suffixes
  • Q for octal
  • xB for binary
Write a Comment
User Comments (0)
About PowerShow.com