0% found this document useful (0 votes)
275 views1 page

05 Activity 1

The document provides two simple programs that utilize jump instructions. The first program moves -2 into the AL register, compares it to 5, and uses a JLE (jump if less than or equal) instruction to print either "AL > 5" or "AL <= 5" depending on the result. The second program moves 2 into the AL register, compares it to 3, and uses a JNE (jump if not equal) instruction to print either "AL = 3" or "AL <> 3" depending on the result. The document then asks questions about the output, jump instructions used, and how the output would change if values were modified.

Uploaded by

playah hate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
275 views1 page

05 Activity 1

The document provides two simple programs that utilize jump instructions. The first program moves -2 into the AL register, compares it to 5, and uses a JLE (jump if less than or equal) instruction to print either "AL > 5" or "AL <= 5" depending on the result. The second program moves 2 into the AL register, compares it to 3, and uses a JNE (jump if not equal) instruction to print either "AL = 3" or "AL <> 3" depending on the result. The document then asks questions about the output, jump instructions used, and how the output would change if values were modified.

Uploaded by

playah hate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

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 ; subtracts the value in AL with 5 (if AL<5, then ZF=0)
JLE label1 ; Jumps to label one if the value of AL is lessthan or equal to 5
PRINT 'AL > 5'
JMP exit label1:
PRINT 'AL <= 5' ; Prints the statement AL<=5
exit:
RET

Questions: (3 items x 2 points)


a. What is the output of the program?
PRINT '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?
PRINT 'AL <= 5'
Program 2: (3 items x 3 points)
include 'emu8086.inc' ORG
100h
MOV AL, 2 ; instruction copies a byte-sized 2 into register AL
CMP AL, 3
JNE label2 ; if false then it goes to label2 of JNE
PRINT 'AL = 3'
JMP exit ; Exit the JMP
Label2:
PRINT 'AL <> 3'
exit:
RET
Questions: (3 items x 2 points)
a. What is the output of the program?
 program will be AL<>3. Because It will first move 2 into AL, then compare AL (i.e., 2) with 3, then it is false then it
goes to label2 because of JNE(Jump If Not Equals).
b. Will the value of the O, P, and A flag be changed upon running the program?
 Overflow Flag(O) - This flag will be set(1) if the result of a signed operation is too large to fit in the number of bits
available to represent it, otherwise reset(0). Eg: MOV AL,32 ( 32 is 00110010 which is positive). In the above example,
MOV AL,2 (2 is 000010 which is positive)
 Parity Flag(P) - If any arithmetic or logical operation the result has even parity, an even number of 1 bits, the parity
register becomes set(1) otherwise it becomes reset(0).
 Auxiliary Flag(A) - When there is an unsigned overflow for 4 bits, then it is set to 1 otherwise it sets to 0.
c. Enumerate the jump instructions that were used in the program.
 JMP instruction performs an unconditional jump. Such an instruction transfers the flow of execution by changing the
program counter. In the above example, If the condition is met, then it prints and it exits.

05 Activity 1 *Property of STI


Page 1 of 1

You might also like