MP Presentation
MP Presentation
MP Presentation
Assembly language
An easier-to-use symbolic representation of machine
language
Uses mnemonics for operations
ADD, MUL, MOV, CMP, PUSH, etc.
Also includes calls to operating system service routines
An assembly language program is translated into
machine language by a program called an
assembler
Basic components in assembly Language:
Instruction, Directive, Label, and Comment
1
Example of Assembly Language Program
.STARTUP
MOV AX,40H ;set AX to 0040H
D1: MOV DS,AX ;load data segment with 0040H
Instructions
MOV SI,17H ;load SI with 0017H
AND BYTE PTR [SI],0DFH ;clear NUM-LOCK bit
.EXIT
END Assembly directive
Label
7-2
Microsoft MASM and Debug
Microsoft MASM and Link Programs
Syntax check;
ML numoff.asm Translate assembly instructions into machine codes
C:\> debug
-a
0BDF:0100 MOV AX, 40
0BDF:0103
-t
AX = 0040 BX = 0000 CX = 0000 DX = 0000 SP = …………….
…………………………………………..
-q
7-3
The 8088 instruction set
There are various groups of instructions ,which I
studied in my previous LABS:
Data transfer
Arithmetic
Logical
Shift and rotate
Test and bit flag
Looping
Repetitive string operations
Jump and call
4
Overview of Assembly Language
Advantages:
Disadvantages:
´ Need to know detail hardware implementation
´ Not portable
´ Slow to development and difficult to debug
7-5
Debugging
There are four debugging routines named
dump regs,
dump mem,
dump stack,
and dump math;
Assembly language
An assembly language program is stored as text
(just as a higher level language program). Each
assembly instruction represents exactly one
machine instruction.
The general form of an assembly instruction is:
mnemonic operand(s)
An assembler is a program that reads a text file with
assembly instructions and converts the assembly
into machine code. Compilers are programs that do
similar conversions for high-level programming
languages.