Professional Documents
Culture Documents
ASSEMBLY LANGUAGE
PROGRAMMING
PPT - 8
ASSEMBLY LANGUAGE PROGRAMMING
• 1’s Complement of a 16-bit number
• Mask off the lower byte of a 16-bit number
• Addition of two, 16-bit numbers
• Multiplication of two 16-bit numbers
• Division of two 16-bit numbers
• 32 bit Division
• Sum of ‘n’ numbers
• To move a byte string of length FF from source to a
Destination
• To fill the locations 1100H to 11FFH in memory with the
byte 54H
• Scanning a byte string
1’s Complement of a 16-bit number
MOV AX,[1234H]
AND AX,FF00H
MOV [5000H],AX
HLT
Addition of two, 16-bit numbers
MOV CX,0000H
MOV AX,[1100H]
MOV BX,[1102H]
ADD AX,BX
JNC GO
INC CX
GO MOV [1110H],AX
MOV [1112H],CX
HLT
Multiplication of two 16-bit numbers
MOV AX,[1234H]
MOV BX,[1100H]
MUL BX
MOV [1120H],AX (Q)
MOV [1122H],DX (R)
HLT
32- bit Division
MOV DX,[1000H]
MOV AX,[1002H]
MOV BX, [1004H]
DIV BX
MOV [1120H],AX (Q)
MOV [1122H],DX (R)
HLT
Sum of ‘n’ numbers
MOV CX,0005H
MOV SI,1200H
MOV AX,0000H
GO ADD AX,[SI]
ADD SI,02H
LOOP GO
MOV [1200H], AX
HLT
To move a byte string of length FF from source
to a Destination
MOV CX,0100H
MOV DI,1100H
MOV AL, 54H
CLD
REP STOSB
HLT
Scanning a string byte
MOV DI,1200H
MOV SI,1300H
MOV CX,0008H
CLD
MOV AL,05H
REPNE SCASB
DEC DI
MOV BL,[DI]
MOV [SI],BL
HLT