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

Faculty of Information Science & Technology

1. The document describes an assignment for a computer architecture and organization course. It lists the group members and their work distribution for 5 questions. It then provides the assembly language code and flowcharts to solve each question. 2. The questions involve tasks like finding the factorial of a number, counting negative numbers in a block of data, separating even and odd numbers, multiplying numbers using addition, and finding the largest number in a block. 3. For each question, the document provides the input and output, assembly code, and a flowchart describing the program logic.

Uploaded by

TAN SOO CHIN
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views

Faculty of Information Science & Technology

1. The document describes an assignment for a computer architecture and organization course. It lists the group members and their work distribution for 5 questions. It then provides the assembly language code and flowcharts to solve each question. 2. The questions involve tasks like finding the factorial of a number, counting negative numbers in a block of data, separating even and odd numbers, multiplying numbers using addition, and finding the largest number in a block. 3. For each question, the document provides the input and output, assembly code, and a flowchart describing the program logic.

Uploaded by

TAN SOO CHIN
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

COMPUTER ARCHITECTURE AND ORGANIZATION TAO1121

FACULTY OF INFORMATION SCIENCE & TECHNOLOGY

TAO1221 - COMPUTER ARCHITECTURE AND ORGANISATION


Trimester 2, 2019/2020
Assignment

Group Members:
No. Student ID Student name

1 1181101768 LOONG JIEHYI

2 1171103353 LOH MIN YI

3 1171103570 TAN SOO CHIN


COMPUTER ARCHITECTURE AND ORGANIZATION TAO1121

Work Distribution

Question Member
1 LOH MIN YI
2 TAN SOO CHIN
3 LOONG JIEHYI
4 TAN SOO CHIN
5 LOONG JIEHYI

1
COMPUTER ARCHITECTURE AND ORGANIZATION TAO1121

1. Write a program that finds the factorial of a number stored in memory address 1000H and
stores the result in memory location 1001H.
Input:
1000H = 04H
Output:
1001H = 18H

Assembly Program:

LDA 1000H
MOV C,A
MOV B,A
DCR C
BACK: XRA A
MOV E,C
CALL MULTI
MOV B,A
DCR C
JNZ BACK
STA 1001H
HLT

MULTI: NOP
LOOP: ADD B
DCR E
JNZ LOOP
RET

2
COMPUTER ARCHITECTURE AND ORGANIZATION TAO1121

Flowchart:

3
COMPUTER ARCHITECTURE AND ORGANIZATION TAO1121

2. Find the number of negative elements (most significant bit 1) in a block of data. The length of
the block is in memory location 1001H and the block itself begins in memory location 1002H.
Store the number of negative elements in memory location 1000H.
Input:
1001H = 03H
1002H = 13H
1003H = 9AH
1004H = C4H
Output:
1000H = 02H

Assembly Program:

LDA 1001H
MOV C, A
MVI B, 00
LXI H, 1002H
BACK: MOV A, M
ANI 80H
JZ SKIP
INR B
SKIP: INX H
DCR C
JNZ BACK
MOV A, B
STA 1000H
HLT

4
COMPUTER ARCHITECTURE AND ORGANIZATION TAO1121

Flowchart:

5
COMPUTER ARCHITECTURE AND ORGANIZATION TAO1121

3. Write an assembly language program to separate even numbers from the given list of 50
numbers and store them in another list starting from 2300H. Assume starting address of 50
number list is 2200H.

Assembly Program:

LXI H, 2200H
LXI D, 2300H
MVI C, 32H
BACK: MOV A, M
ANI 01H
JNZ SKIP
MOV A, M
STAX D
INX D
SKIP: INX H
DCR C
JNZ BACK
HLT

6
COMPUTER ARCHITECTURE AND ORGANIZATION TAO1121

Flowchart:

7
COMPUTER ARCHITECTURE AND ORGANIZATION TAO1121

4. Write a program to multiply two numbers stored in memory locations 1000H and 1001H and
store the result in memory location 1002H. the multiplication should be performed using
multiple addition, e.g. 7*3 = 7+7+7, 6*5 = 6+6+6+6+6.
Input:
1000H = 07H
1001H = 03H
Output:
1002H = 15H

Assembly Program:

LDA 1001H
MOV C, A
LDA 1000H
MOV B, A
MVI A, 00H
LOOP: ADD B
DCR C
JNZ LOOP
STA 1002H
HLT

8
COMPUTER ARCHITECTURE AND ORGANIZATION TAO1121

Flowchart:

Start

Load the content of memory location


1001H into Accumulator

Move the content of Accumulator to


Register C as counter

Load the content of memory location


1000H into Accumulator

Move the content of Accumulator to


Register B

Initialize Accumulator to 00H

Add the content of Register B to


Accumulator

Decrement the counter by 1

NO
Is counter = 0 ?

YES

Store the result in Accumulator into


memory location 1002H

End

9
COMPUTER ARCHITECTURE AND ORGANIZATION TAO1121

5. Write a program to find the largest number in a block of memory and store it in memory
location 1000H. The size of the block is stored in memory location 1001H and the block starts
at memory address 1002H.
Input:
1001H = 05H
1002H = 16H
1003H = 3AH
1004H = A5H
1005H = FAH
1006H = 99H
Output:
1000H = FAH

Assembly Program:

LDA 1001H
MOV C, A
LXI H, 1002H
MOV B, M
DCR C
LOOP: INX H
MOV A, M
CMP B
JC SKIP
MOV B, A
SKIP: DCR C
JNZ LOOP
MOV A, B
STA 1000H
HLT

Flowchart:

10

You might also like