TASK
SUBMITTED TO:
MR MUHAMMAD AZEEM
SUBMITTED BY:
NAME: __________________________
REG # ___________________________
CLASS & SEC: ___________________
SUBMISSION DATE:
__________ JUNE 2025
1 a. If ASCII codes of ‘0’, ‘A’, dot, ‘a’, colon, space, ‘#’, hyphen, and comma are 30H, 41H, 2EH, 61H, 3AH, 20H, 23H,
2DH and 2CH respectively. What would be displayed if you output the following sequence of ASCII codes to a
computer's screen?
49H, 64H, 23H, 3AH, 20H, 20H, 37H, 38H, 36H, 2DH, 30H
Id#: 786-0
b. Keeping in view the following declarations:
XVAL DW 1010101001010B
YVAL DW 0FEDCH
ZVAL DW 234H
RVAL DW ?
Use sequence of assembly language instructions to evaluate the expression:
RVAL = -XVAL + (YVAL – ZVAL)
MOV AX, XVAL
NEG AX
MOV BX, YVAL
SUB BX, ZVAL
ADD AX, BX
MOV RVAL, AX
.
2 a. Write sequence of instructions to perform each of the following tasks:
Compare two numbers (5 and 7). If they are equal, jump to the label `EQUAL`. Otherwise, it proceeds with moving
AX into CX.
MOV AL, 5
CMP AL, 7
JE EQUAL
MOV CX, AX
Calculate and store the 1’s complement of the number stored in AX.
NOT AX
Set the even numbered bits of register CX.
OR CX, 0101010101010101B
or
OR CX, 05555H
b. For each instruction below, assume the before values before the instruction is executed. Give the requested after
values & the status of the flags after the instruction are executed:
Before Instruction After CF, SF, ZF
BX = 0FF75H, CX = 01A2H ADD BX, CX BX = 0117H, CX = 01A2H CF=1, SF=0, ZF=0
BX = 0FF75H, CX = 01A2H SUB BX, CX BX = 0FDD3H, CX = 01A2H CF=0, SF=1, ZF=0
CX = 01A2H CMP CH, CL CX = 01A2H CF=1, SF=0, ZF=0
.
3 Write a program that asks a user to enter any character and convert CAPITAL alphabet into small and SMALL alphabet
into capital by using logical instruction. The program should use a loop that repeats till the user wants to repeat.
Sample:
Enter a Character: A Enter a Character: 2
It is capital in small it is: a Invalid try again
Do you want to repeat(Y/N): Y Enter a Character:
.MODEL SMALL MOV AH, 2
.STACK 100H MOV DL, BL
.DATA INT 21H
MS1 DB 0AH, 0DH, "Enter a Character: $"
MS2 DB 0AH, 0DH, " It is capital in small it is: $" JMP OPTION
MS3 DB 0AH, 0DH, " It is small in capital it is: $" INVALID:
MS4 DB 0AH, 0DH, "Invalid try again$" MOV AH, 9
MS5 DB 0AH, 0DH, " Do you want to repeat(Y/N): $" LEA DX, MS4
.CODE INT 21H
MAIN PROC
MOV AX, @DATA JMP BEGIN
MOV DS, AX
OPTION:
BEGIN: MOV AH, 9
MOV AH, 9 LEA DX, MS5
LEA DX, MS1 INT 21H
INT 21H
MOV AH, 1
MOV AH, 1 INT 21H
INT 21H
MOV BL, AL CMP AL, 'Y'
JE BEGIN
CMP BL, 'A'
JL INVALID MOV AH, 4CH
CMP BL, 'Z' INT 21H
JG SMALL MAIN ENDP
END MAIN
OR BL, 20H
MOV AH, 9
LEA DX, MS2
INT 21H
MOV AH, 2
MOV DL, BL
INT 21H
JMP OPTION
SMALL:
CMP BL, 'a'
JL INVALID
CMP BL, 'z'
JG INVALID
AND BL, 0DFH
MOV AH, 9
LEA DX, MS3
INT 21H
4 After execution of each of the following sequence of instructions:
a) what will be the contents of AX and c) How many times the loop will be repeated?
BX. MOV CX,16
MOV AX, 0A0AH UP:
MOV BX, 0505H MOV AH, 4Ch
AND AX, BX INT 21H
OR BX, AX LOOP UP
AX = 0000H ONE TIME
BX = 0505H
d) what will be the contents of CX and DX
MOV CX, 1
b) To which label control will be XCHG CL, CH
transferred? MOV DX,0
XOR AX, AX UP:
JP L1 INC DX
JZ L2 LOOP UP
JC L3
JMP L4 CX = 0000H
DX = 0100H
L1
.
.