You are on page 1of 9

Makeup Lab Task no: - 3

Name: -

Waqar Ghafoor
Roll No: -

BCSM-F18-079
Class: -

BSCS-5A
Subject: -

Assembly Language
Submitted To: -

Sir Usman Malik


Lab Tasks
Task 1: Write the assembly code for each of the following decision structures:
Task 1: Write the assembly code for each of the following decision structures:
1. IF AX < 0
THEN
PUT -1 IN BX
END_IF
2. IF AL < 0
THEN
PUT FFh IN AH
ELSE
PUT 0 IN AH
END_IF
3. Suppose DL contains a character which is input by user:
IF (DL >= “A”) AND (DL <= “Z”)
THEN
DISPLAY DL
END_IF
4. IF ( AX < BX) OR (BX < CX)
THEN
PUT 0 IN DX
ELSE
PUT 1 IN DX
END_IF
5. IF (AX < BX)
THEN
IF ( BX < CX )
THEN
PUT 0 IN AX
ELSE
PUT 0 IN BX
END_IF
END_IF
6. IF (AX < BX)
THEN
PUT O IN AX
ELSE
IF ( BX < CX )
THEN
PUT 0 IN BX
ELSE
PUT 0 IN CX
END_IF
END_IF
Task 2:
Use a case structure to code the following:
a) Read a character
b) If it’s “A”, then execute carriage return and display string Carriage Return.
c) If it’s “B”, then execute line feed and display string Line Feed.
d) If any other character, then return to dos.

Solution: -
MOV AH, 1

INT 21h

MOV BL,AL

CMP Bl, 'A'

JE carriage

CMP Bl,'B'

JE line

JMP exit

carriage:

MOV AH,2

MOV DL, 0Dh

INT 21h

MOV DL,BL

INT 21h

JMP exit

Line:

MOV AH,2

MOV DL,0Ah

INT 21h

MOV DL, BL

INT 21h

Exit:

MOV AH, 4ch

INT 21h

Output: -

You might also like