Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Computer Organization and Assembly Language

Lab 8
Task #1

Give Logic instruction to do the each of the following (3X4 = 12 marks)

1- Clear the even number bits of AX, leaving the other bits unchanged
AND AX,0AAAAH
2- Set the most and least significant bits of BL, leaving the other bits unchanged
OR BL,81H

3- Complement the msb (most significant bit) of DX, leaving the other bits unchanged
XOR DX,8000H
4- Replace the value of word variable WORD1 by its one’s compliment
NOT WORD1

Task #2

Use the Test instruction to do the following (3X4 = 12 marks)

1- Set ZF if the contents of AX is zero


TEST FX,0FFFFh
2- Clear ZF if BX contains an odd number
TEST BX,0001h
3- Set SF if DX contains a negative number
TEST DX,8000H
4- Set ZF if DX contains a positive number
TEST DX,8000H

Task #3

Write an assembly code which uses a logic instruction to convert an upper-case letter to lower case.
(10 marks)
.MODEL SMALL
.STACK 100H

.DATA

.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX

MOV AH,4CH
INT 21H

MAIN ENDP
END MAIN
Task #4

Write an assembly code which uses a logic instruction to convert decimal digit to its ASCII code. (10
marks)
.MODEL SMALL
.STACK 100H

.DATA

.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX

MOV AH,4CH
INT 21H

MAIN ENDP
END MAIN

You might also like