Organization of The IBM PC Assembly Language

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

Organization Of The IBM PC

Assembly Language

Lecture#09
Few Basic Instruction

MOV INSTRUCTION
The instruction used to move an operand from one
location to another one is MOV. It can be used to
address general purpose register or to address
memory locations. Its format is:
Mov D, S
Mov ax,15 ;put 15 into ax
Mov ax, bx ;put the content of bx into ax
XCHG Instruction
The XCHG (exchange) operation is used to
exchange the contents of two registers, or a register
& a memory location. The syntax is

XCHG destination, source


XCHG AH,BL
XCHG AX, WORD1
ADD Instruction
This instruction is used to add the contents of two
registers. The syntax is
ADD destination, source
ADD WORD1, AX

SUB Instruction
This instruction is used to subtract the contents of two
registers. The syntax is
SUB AX,BX
INC, DEC Instruction
Increment is used to add 1 to the contents of a
register or memory location & DEC subtract 1 from
a register or memory location. The syntax is:
INC destination
DEC destination

Example:
INC WORD1 ;add 1 to the contents of WORD1

DEC BYTE1 ;subtract 1 from variable BYTE1


NEG Instruction
NEG is used to negate the contents of the destination.
NEG does this by replacing the contents by its two’s
complement. The syntax is
NEG destination

NEG BX ;Negates the contents of BX


INT instruction
The INT instruction executes a software interrupt, for
e.g. change video mode, open a file etc. The syntax is:
INT interrupt number
Example
Int 21h ;calls DOS service
int 10h  ;calls the Video BIOS interrupt 
Common Interrupts
INT 10h Video Services
INT 16h Keyboard Services
INT 17h Printer Services
INT 1Ah Time of Day
INT 1Ch User Timer Interrupt
INT 21h MS-DOS Services
LEA Instruction
INT 21H, function 9, expects the offset address of
the character string to be in DX. The syntax is
LEA destination, source

Example:
LEA DX, MSG
;Put the offset address of the variable MSG into
DX
.MODEL SMALL
.STACK 300
.DATA
MESSAGE DB "HELLO WORLD!","$"
.CODE
MAIN PROC
MOV AX, @DATA
MOV DS,AX
MOV AH,09
LEA DX,MESSAGE
INT 21H
MAIN ENDP
END MAIN

You might also like