You are on page 1of 2

IT2104

Instructions: Analyze the following simple programs below that utilize jump instructions. Fill the blanks with the
correct comments that would describe the process of the corresponding line of code. Then, answer the following
questions in each program.

Program 1: (3 items x 3 points)


include 'emu8086.inc'
ORG 100h
MOV AL, -2
CMP AL, 5 ; compare the AL value with 5
JLE label1 ; if AL is less than or equal to 5, jump to label1
PRINT 'AL > 5'
JMP exit
label1:
PRINT 'AL <= 5' ; prints AL<=5
exit:
RET

Questions: (3 items x 2 points)


a. What is the output of the program?
 AL <=5
b. Enumerate the jump instructions that were used in the program.
 JLE, JMP
c. What would be the output if MOV AL, -2 will be modified to MOV AL, 7?
 AL > 5

Program 2: (3 items x 3 points)


include 'emu8086.inc'
ORG 100h
MOV AL, 2 ; put 2 in register AL
CMP AL, 3
JNE label2 ; if AL is not equal to 3, jump to label2
PRINT 'AL = 3'
JMP exit ; jumps to label exit
Label2:
PRINT 'AL <> 3'
exit:
RET

Questions: (3 items x 2 points)


a. What is the output of the program?
 AL <> 3
b. Will the value of the O, P, and A flag be changed upon running the program?
 No
c. Enumerate the jump instructions that were used in the program.
 JNE, JMP
05 Activity 1 *Property of STI
Page 1 of 1

You might also like