You are on page 1of 5

Computer Organization and Assembly Language

Bahria University, Lahore Campus


Department of Computer Science
Lab Journal 06
(spring 24)

Computer Organization and Assembly Language-


Course: Lab Date: _______________
Course Code: CEL 325 Max Marks: 10
Faculty’s Name: Munaza Sher

Name: _____________________ Enroll No: ___________________ Class: ______________

Objective(s):
Upon completion of this lab session, learners will be able to:
 Addition With Carry, Subtraction with borrow, Flag Registers, AND OR NOT, XOR, NEG
etc.
 Students will learn various arithmetic and logic operations.
 Students will be able to perform arithmetic operations and logic operations on n-bit
numbers.
 Conditional and unconditional jumps (If -Elses)
Computer Organization and Assembly Language-Lab Instructor: Munaza Sher

Practice
Exercise

Task-1

Write a program that stores the two numbers and perform the operations of ADC and SUBB on
those numbers and also give practical code example of the all above instruction in table-1.

Task-2

Write a program to implement the following equation.

X = ~0xFF12 ^ {0xABFF & (0x2113 | 0x2340)}

~ Invert all bits


^ Bitwise XOR
& Bitwise AND
| Bitwise OR

Task-3

a) Perform any ALU operation that sets CF


b) Perform any ALU operation that sets OF

Task 4: Write the assembly code for each of the following decision structures:
1. IF AX < 0
THEN
PUT -1 IN BX
END_IF

2. IF AL < 0
THEN
PUT FFh IN AH
ELSE
PUT 0 IN AH
END_IF

3. Suppose DL contains a character which is input by user:


IF (DL >= “A”) AND (DL <= “Z”)

2
Computer Organization and Assembly Language-Lab Instructor: Munaza Sher

THEN
DISPLAY DL
END_IF

4. IF ( AX < BX) OR (BX < CX)


THEN
PUT 0 IN DX
ELSE
PUT 1 IN DX
END_IF

5. IF (AX < BX)


THEN
IF ( BX < CX )
THEN
PUT 0 IN AX
ELSE
PUT 0 IN BX
END_IF
END_IF

6. IF (AX < BX)


THEN
PUT O IN AX
ELSE
IF ( BX < CX )
THEN
PUT 0 IN BX
ELSE
PUT 0 IN CX
END_IF
END_IF

Task 5:

Use a case structure to code the following:


a) Read a character
b) If it’s “A”, then execute carriage return and display string Carriage Return.
c) If it’s “B”, then execute line feed and display string Line Feed.
d) If any other character, then return to DOS.

Lab Grading Sheet :

3
Computer Organization and Assembly Language-Lab Instructor: Munaza Sher

Max Obtained
Task Comments(if any)
Marks Marks

1. 02

2. 02

3. 02

4. 02

5. 02

Total 10 Signature

Note : Attempt all tasks and get them checked by your Lab Instruct

4
Computer Organization and Assembly Language-Lab Instructor: Munaza Sher

You might also like