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

UNIVERSITY OF OKARA

DEPARTMENT OF
COMPUTER SCIENCE

ASSIGNMENT WORK :
COMPUTER ORGNIZATION & ASSEMBLY LANGUAG
NAME :
MUHAMMAD USAMA
ROLL NO :
F20-BSCS-5035
CLASS :
BSCS {Evening} A
SEMESTER :
3rd
_________________________________________________________________________________
QUESTION NO. 01

Write a program to read one character of the Hex digits


(A_F)and dlisplay it on the next line.
Example
EnterA hex Digit:A
In decimal it is : 10

ANSWER:
.model

.Data

MSG DB 0AH,0DH,' ENTER A HEX DIGIT:A'

MSG2 DB 0AH,0DH,'IN DECIMAL IT IS 10'

DB ?,'A'

.stack

.code

Main proc

MOV AX,@DATA

MOV DS,AX

MOV AH,9

LEA DX,MSG

INT 21H

MOV AH,1

INT 21H
SUB AL,11H

MOV AH,9

LEA DX,MSG2

INT 21H

MOV AH,4AH

INT 21H

MAIN ENDP

END MAIN
QUESTION NO 02:

Write a program to (a) display a "?", (b) read two decimal


digits
whose sum "is less than 10, (c) display them and their sum on
the next line, with an appropriate message.
Sample execution:
?27
The sum of 7 and 2 is 9
ANSWER

.Model small

.Data

MSG DB 0AH,0DH,' THE SUM OF'

C1 DB ?, 'AND'

C2 DB ?, 'IS'

SUM DB ?,'S'

.stack

.code

Main proc

MOV AX,@DATA

MOV DS,AX

MOV AH,2

MOV DL,'?',

INT 21H
MOV AH,1

INT 21H

MOV C1,AL

INT 21H

MOV C2,AL

ADD AL,C1

SUB AL,30H

MOV SUM,AL

LEA DX,MSG

MOV AH,9

INT 21H

MOV AH,4AH

INT 21H

MAIN ENDP

END MAIN

You might also like