0% found this document useful (0 votes)
24 views

PASILAN Lab Activity 4 Basic Logic Instructions

Uploaded by

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

PASILAN Lab Activity 4 Basic Logic Instructions

Uploaded by

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

CPEN 100A Lab

Name: Course and Section


Pasilan, Maria Socorro F. BSEE3-1
Date Performed April 1, 2024
Student No.:
202102949 Date Submitted April 3, 2024 Grade

Lab Activity 4
Basic Logical Instructions

Objectives:

At the end of this activity, the student should be able to:

1. familiarize with the logical instructions


2. understand the meaning of the register status flag
3. write assembly language programs using logical instructions

Materials/Equipment:

Laptop with EMU8086 IDE

Theory/Concepts:

Logical instructions typically work on a bit by bit basis, although some


processors use the entire contents of the operands as whole flags (zero or not zero input, zero
or negative one output). Typical logical operations include:

a.) NOT – Invert each bit of a byte or word.


b.) AND – AND each bit in a byte or word with the corresponding bit in
another byte or word.
c.) OR – OR each bit in a byte or word with the corresponding bit in
another byte or word.
d.) XOR – Exclusive OR each bit in a byte or word with the corresponding
bit in another byte or word.
e.) TEST –compares the contents of a register or memory location (8, 16, or 32
bits) with an immediate value or the contents of a register; sets or clears flags

Procedure:

Part 4.1

Write a program in memory location to perform AND operation with the two numbers (1234
and 4321) to be stored in registers BX and AX. Record the status of the flag registers in
Table 4.1.
EVIDENCE 1

PASTE THE IMAGE OF YOUR CODE HERE

EVIDENCE 2

PASTE THE IMAGE OF YOUR EMULATION OUTPUT HERE

Table 4.1

Overflow Auxiliary
Sign Flag Zero Flag Parity Flag Carry Flag
Flag Flag
0 0 0 0 0 0
Observations:
In this laboratory activity part 1, we can observe that when we perform the logical
operation AND (each bit in a byte or word with the corresponding bit in another byte or word)
with the two number given, the result will show in the register, specifically in the AH & AL
registers. The output flags shown has neither 1output in all flags.

Part 4.2

Write a program in memory location to perform OR operation with the two numbers (5678
and 90AB) to be stored in registers CX and DX. Record the status of the flag registers in
Table 4.2.
EVIDENCE 1

Paste the image of your code here.

EVIDENCE 2

Paste the image of your emulation output here.


Table 4.2
Overflow Auxiliary
Sign Flag Zero Flag Parity Flag Carry Flag
Flag Flag
0 1 0 0 0 0
Observations:
In this part, we utilized the logical operation OR (each bit in a byte or word with the
corresponding bit in another byte or word). The given values such as CS and DX are stored
and the result in this output can be shown in the register, specifically, in CX register. The
flags are can be observe mostly as ZERO, except in Signed Flag (SF) which is 1.

Part 4.3

Write a program in memory location to perform XOR operation with the two numbers
(CDEF and 0123) to be stored in registers CX and AX. Record the status of the flag
registers in Table 4.3.

EVIDENCE 1

Paste the image of your code here.

EVIDENCE 2

Paste the image of your emulation output here.


Table 4.3

Overflow Auxiliary
Sign Flag Zero Flag Parity Flag Carry Flag
Flag Flag
0 1 0 0 1 0

Observations:
In this last activity, the logical operations XOR (Exclusive OR each bit in a byte or
word with the corresponding bit in another byte or word) is used to perform the given values
in CX and AX. We can observe the result output in the AH & AL register. Where H is the
higher order byte and L is the lower order byte.

V. Conclusions
At the end of this activity, I learned the theory or concepts of logical
instructions such as NOT (inverts), AND (AND each bit), OR (OR each bit),
XOR (exclusive OR each bit in a byte) and TEST (compares the contents of a
register). Additional to that I gained in depth knowledge about the meaning of
register status flags and practicing an assembly languge using this laboratory
activity with logical instruction as a center of focus.

VI. Viva Questions


Write V if it is a valid logic operation, otherwise write I if it is an invalid logic
operation. Explain your answer.

Logic Operations Answer Explanation


1. AND BL, 0F I The instruction and the variable
is NOT appropriate, it will be IF
when we add “h” in latter part.
2. AND DX, CX V The register has both 16 bits and
the operand are appropriate.
3. AND [AX], 01 I First operand cannot be a
memory address.
4. OR 2527, AX I First operand cannot be an
immediate.
5. OR DL, AX I They don’t have the same bits
(DL-8bits, AX-16 bits)
6. TEST CX, 1234 V Interpreted as linking the CX
with the value 1234.
7. TEST CX, CX V It links the test CX with itself.
8. XOR CL, CA I Variable CA does not exist.
9. XOR BP, DI V Performs a bitwise operation
between the two values.
10. NOT AX V Reverse each bit of operand

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy