Documente Academic
Documente Profesional
Documente Cultură
ASSIGNMENT - 3
Submitted to
Sir Azeem
Submitted by
Name: Muhammad Usman
Roll No: 2016-ARID-0261
Class: MCS3 (E)
Chapter # 4
1. Which of the following names are legal in IBM PC assembly language?
a. TWO_WORDS LEGAL
b. ?1 LEGAL
c. TWO WORDS ILLEGAL (Contains illegal character space)
d. .@? LEGAL
e. $145 LEGAL
f. LET’S_GO ILLEGAL (Contains illegal character ‘ )
g. T= . ILLEGAL (Contains illegal character = )
2. Which of the following are legal numbers? If they are legal, tell whether
they are binary, decimal, or hex numbers.
a. 246 LEGAL DECIMAL
b. 246h LEGAL HEXA
c. 1001 LEGAL DECIMAL
d. 1,101 ILLEGAL
e. 2A3h LEGAL HEXA
f. FFFEh ILLEGAL (Must begin with digit)
g. 0Ah LEGAL HEXA
h. Bh ILLEGAL (Must begin with digit)
i. 1110b LEGAL BINARY
5. Using only MOV, ADD, SUB, INC, DEC, and NEG, translate the following
high-level language assignment statements into assembly language. A,
B, and C are word variables.
a. A= B-A
MOV AX, B
SUB AX, A
MOV A, AX
b. A= -(A+1)
MOV AX, A
INC AX
NEG AX
MOV A, AX
c. C= A+B
MOV AX, A
ADD AX, B
MOV C, AX
d. B=3 x B +7
MOV AX, B
ADD AX, B
ADD AX, B
ADD AX, 7
MOV B, AX
e. A= B – A – 1
MOV AX, B
SUB AX, A
DEC AX
MOV A, AX
****** * * *
****** ** ** **
****** *** *** ***
.MODEL SMALL
.STACK 100H
.DATA
MSG DB "*$"
.CODE
MAIN PROC
MOV
AX,@DATA
MOV DS,AX
MOV AH,2
MOV DL,”*”
INT 21H
MOV DL,010
INT 21H
MOV DL,013
INT 21H
MOV DL,"*"
INT 21H
INT 21H
MOV DL,010
INT 21H
MOV DL,013
INT 21H
MOV DL,"*"
INT 21H
INT 21H
INT 21H
END MAIN
MAIN ENDP