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

Computer Architecture Lab file

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

Computer Architecture Lab file

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

COMPUTER ARCHITECTURE AND

ASSEMBLY LANGUAGE
CSIT131
LAB FILE

Department of Computer Science and Engineering


AMITY SCHOOL OF ENGINEERING AND TECHNOLOGY
AMITY UNIVERSITY DUBAI

Batch (2022-2025) (Semester 3)


Bachelor of Science in Information Technology

Under the guidance of:


Faculty: Dr. Jeyalatha
Lab Instructor: Mrs. Shari
Submitted by: -
Name: Josue MAnamou
 AUD19954
University Email Address josueM @amitydubai.ae
TABLE OF CONTENTS
TASK NO. PROGRAM NAME DATE
1 Store values and 04/09/2023
implement
operations in
SIM8085
2 Implement RRC, 11/09/2023
RLC, STA and
arithmetic
operations in
SIM8085
3 8 bit swapping and 18/09/2023
10 bit swapping
5 Implement the 02/10/23
following functions
6 Exhanging memory 09/10/23
locations
7 Multiplication by 23/10/23
logic gates
8 Program to find 06/11/23
largest and
smallest number in
array
9 To arrange the 13/11/23
array in ascending
order
10 To arrange the 20/11/23
array in descending
order
LAB 1:- Introduction to SIM8085 Date: 04/09/2023
Aim: To store values in registers and perform operations in SIM8085
Software used: SIM8085
1) Feed the following values in the registers
A =3AH
B =50H
C =60H
D =20H
E =FCH
H =BCH
L =E4H
CODE:
MVI A,3AH ;MOVING 3AH TO A
MVI B,50H ;MOVING 50H TO B
MVI C,60H ;MOVING 60H TO C
MVI D,2DH ;MOVING 2DH TO D
MVI E,FCH ;MOVING FCH TO E
MVI H,BCH ;MOVING BCH TO H
MVI L,E4H ;MOVING E4H TO L
HLT
2) Complement the value in accumulator by using CMA
CODE:
MVI A,3AH ;MOVING 3AH TO A
CMA ;COMPLEMENTING THE VALUE
HLT ;HALTING THE PROGRAM

3) Implement OR function in accumulator by using ORA


CODE:
MVI A,3AH ;MOVING 3AH TO A
MVI B,48H ;MOVING 48H TO B
ORA B ;PERFORMING OR OPERATION
HLT ;HALTING THE PROGRAM
4) Implement AND function in accumulator by using ANA
CODE:
MVI A,3AH ;MOVING 3AH TO A
MVI B,48H ;MOVING 48H TO B
ANA B ;PERFORMING AND OPERATION
HLT ;HALTING THE PROGRAM

5) Implement XOR function in accumulator using XRA


CODE:
MVI A,3AH ;MOVING 3AH TO A
MVI B,48H ;MOVING 48H TO B
XRA B ;PERFORMING XOR OPERATION
HLT ;HALTING THE PROGRAM
LAB 2:- Introduction to SIM8085 Date: 11/09/2023
Aim: To store values in registers and perform operations in SIM8085
Software used: SIM8085
1) Use STA to store the value of accumulator in memory

CODE:
MVI A,45H ;MOVING 45H TO A
MVI B,51H ;MOVING 51H TO B
ANA B ;PERFORMING AND OPERATION
STA 2100H ;STORING ACCUMULATOR IN MEMORY LOCATION
2100H
HLT ;HALTING THE PROGRAM

2) Use STA to store the value of accumulator in memory for ORA B.


CODE:
MVI A,45H ;MOVING 45H TO A
MVI B,51H ;MOVING 51H TO B
ORA B ;PERFORMING OR OPERATION
STA 2100H ;STORING ACCUMULATOR IN MEMORY LOCATION
2100H
HLT ;HALTING THE PROGRAM
3) Use STA to store the value of accumulator in memory for XRA B.
CODE:
MVI A,45H ;MOVING 45H TO A
MVI B,51H ;MOVING 51H TO B
XRA B ;PERFORMING XOR OPERATION
STA 2100H ;STORING ACCUMULATOR IN MEMORY LOCATION
2100H
HLT ;HALTING THE PROGRAM

4) Use STA to store the value of accumulator in memory for CMA.


CODE:
MVI A,45H ;MOVING 45H TO A
MVI B,51H ;MOVING 51H TO B
CMA ;COMPLEMENTNG CONTENT OF ACCUMULATOR
STA 2100H ;STORING ACCUMULATOR IN MEMORY LOCATION
2100H
HLT ;HALTING THE PROGRAM
5) Use RRC to right rotate the value of 3fh in accumulator.
CODE:
MVI A,3FH ;MOVING 3FH TO A
RRC ;PERFORMING RIGHT CIRCULAR ROTATION
STA 2100H ;STORE ACCUMULATOR IN MEMORY LOCATION
2100H
HLT ;HALTING THE PROGRAM

6) Use RLC to rotate the value of 3FH in accumulator


CODE:
MVI A,3FH ;MOVING 3FH TO A
RLC ;PERFORMING LEFT CIRUCLAR ROTATION
STA 2120H ;STORING ACCUMULATOR IN MEMORY LOCATION
2120H
HLT ;HALTING THE PROGRAM
7) Apply arithmetic operation by using ADD B and store it in the
accumulator.
CODE:
MVI A,64H ;MOVING 64H TO A
MVI B,46H ;MOVING 46H TO B
ADD B ;PERFORMING ARITHMETIC ADDITION
STA 2160H ;STORING ACCUMULATOR IN MEMORY LOCATION
2160H
HLT ;HALTING THE PROGRAM

8) Perform arithmetic subtraction by using SUB B and store it in the


accumulator and memory location.
CODE:
MVI A,64H ;MOVING 64H TO A
MVI B,64H ;MOVING 64H TO B
SUB B ;PERFORMING ARITHMETIC SUBTRACTION
STA 2100H ;STORING ACCUMULATOR IN MEMORY LOCATION
2100H
HLT ;HALTING THE PROGRAM

Q9) PERFORM ARITHMETIC ADDITION BY USING A= C8, D =3A.


CODE:-
MVI A,3AH ;MOVING 3AH TO A
MVI D,C8H ;MOVING C8H TO D
ADD D ;PERFORMING ARITHMETIC ADDITION
STA 2120H ;STORING ACCUMULATOR IN MEMORY 2120H
HLT ;HALTING THE PROGRAM
LAB 3:- 8 bit swapping in SIM8085 Date: 18/09/2023
Aim: Perform 8 bit swapping in registers usin8085.
Software used: SIM8085
QUESTIONS:-
Q1) Perform arithmetic subtraction where A=15H, B=98H
respectively and store it in 2520H.
CODE:-
MVI A,15H ;MOVING 15H TO A
MVI B,98H ;MOVING 98H TO B
SUB B ;PERFORMING ARITHMETIC SUBTRACTION
STA 2520H ;STORING ACCUMULATOR IN MEMORY
HLT ;HALTING THE PROGRAM

Q2) Perform arithmetic subtraction where A=64H and B=46H and


store it in 2550H.
CODE:-
MVI A,64H ;MOVING 64H TO A
MVI B,46H ;MOVING 46H TO B
SUB B ;PERFORM ARITHMETIC SUBTRACTION
MOV B,A ;MOVE THE CONTENT OF B TO A
STA 2550H ;STORE ACCUMULATOR IN MEMORY LOCATION 255OH
HLT ;HALTING THE PROGRAM
Q3) Perform 8 bit swapping for two register H and D where
H=58H and D=48H and use XCHG respectively.
CODE:-
MVI H,58H ;MOVING 58H TO H
MVI D,48H ;MOVING 48H TO D
XCHG ;EXCHANGING 8 BITS
HLT ;HALTING THE PROGRAM

Q4) Perform 10 bit swapping HL and DE where


H=ABH,L=CDH,D=67H,E= 89H respectively.
CODE:-
MVI H,ABH ;MOVING ABH TO H
MVI L,CDH ;MOVING CDH TO L
MVI D,67H ;MOVING 67H TO D
MVI E,89H ;MOVING 89H TO E
XCHG ;PERFORMING 10 BIT EXCHANGE
HLT ;HALTING THE PROGRAM
LAB 4:- Implement the functions in SIM8085 Date:
25/09/2023
Aim: Perform the following functions.
Software used: SIM8085
1) Store 6DH in A , and complement it while storing it in 2300H.
CODE:
MVI A,6DH ;MOVING 6DH TO A
CMA ;COMPLEMENTING THE CONTENT OF A
STA 2300H ;STORE ACCUMULATOR IN MEMORY LOCATION
2300H
HLT ;HALTING THE PROGRAM

2) Store A=6DH, B=BCH and perform logical AND operation and


store it in 2350H.
CODE:
MVI A,6DH ;MOVING 6DH TO A
MVI B,BCH ;MOVING BCH TO B
ANA B ;PERFORMING AND OPERATION
STA 2350H ;STORE ACCUMULATOR IN MEMORY LOCATION
2350H
HLT ;HALTING THE PROGRAM

3) Store A=6DH, B=BCH and perform logical OR operation and store


it in 2355H.
CODE:
MVI A,6DH ;MOVING 6DH TO A
MVI B,BCH ;MOVING BCH TO B
ORA B ;PERFORMING OR OPERATION
STA 2355H ;STORING ACCUMULATOR IN MEMORY LOCATION
2355H
HLT ;HALTING THE PROGRAM

4) Store A=6DH , B=BCH and perform logical XOR operation and


store it in 2360H.
CODE:
MVI A,6DH ;MOVING 6DH TA A
MVI B,BCH ;MOVING BCH TO B
XRA B ;PERFORMING XOR OPERATION
STA 2360H ;STORING ACCUMULATOR IN MEMORY LOCATION
2360H
HLT ;HALTING THE PROGRAM

5) Store A=6DH, B=BCH and perform arithmetic addition and store it


in 2370H.
CODE:
MVI A,6DH ;MOVING 6DH TO A
MVI B,BCH ;MOVING BCH TO B
ADD B ;PERFORMING ARITHMETIC ADDITION
STA 2370H ;STORING ACCUMULATOR IN MEMORY LOCATION
2370H
HLT ;HALTING THE PROGRAM
6) Store A=6DH, B=BCH and perform arithmetic subtraction and
store it in 2380H.
CODE:
MVI A,6DH ;MOVING 6DH TO A
MVI B,BCH ;MOVING BCH TO B
SUB B ;PERFORMING ARITHMETIC SUBTRACTION
STA 2380H ;STORING ACUMULATOR IN MEMORY LOCATION
2380H
HLT ;HALTING THE PROGRAM

7) Store H=6DH , D=BCH and perform 8 bit swapping.


CODE:
MVI H,6DH ;MOVING 6DH TO H
MVI D,BCH ;MOVING BCH TO D
XCHG ;EXCHANGING 8 BITS
HLT ;HALTING THE PROGRAM
8) Store H=6DH,L=05H,D=8CH,E=FFH and perform 10 bit
swapping.
CODE:
MVI H,6DH ;MOVING 6DH TO H
MVI L,05H ;MOVING 05H TO L
MVI D,8CH ;MOVING 8CH TO D
MVI E,FFH ;MOVING FFH TO E
XCHG ;EXCHANGING 10 BITS
HLT ;HALTING THE PROGRAM

9) Store A=6DH and perform left circular shift operation.


CODE:
MVI A,6DH ;MOVING 6DH TO A
RLC ;PERFORMING LEFT CIRUCLAR SHIFT
HLT ;HALTING THE PROGRAM
10) Store A=6DH and perform right circular shift.
CODE:
MVI A,6DH ;MOVING 6DH TO A
RRC ;PERFORMING RIGHT CIRUCLAR SHIFT
HLT ;HALTING THE PROGRAM

LAB 5:- Implement the functions in SIM8085 Date:


02/10/2023
Aim: Perform the following functions.
Software used: SIM8085
QUESTIONS:-
FIRST PROGRAM – Store A=64H ,B=46H and perform arithmetic
subtraction and store it in 2310H.
CODE:-
MVI A,64H ;MOVING 64H TO A
MVI B,46H ;MOVING 46H TO B
SUB B ;PERFORMING ARITHMETIC SUBTRACTION
STA 2310H ;STORING ACCUMULATOR IN MEMORY LOCATION
2310H
HLT ;HALTING THE PROGRAM

SECOND PROGRAM – Store A=64H, B=46H and perform arithmetic


addition and store it in 2350H.
CODE:-
MVI A,64H ;MOVING 64H TO A
MVI B,46H ;MOVING 46H TO B
ADD B ;PERFORMING ARITHMETIC ADDITION
STA 2350H ;STORING ACCUMULATOR IN MEMORY LOCATION
2350H
HLT ;HALTING THE PROGRAM

THIRD PROGRAM – Store A=54H, B=48H and perform arithmetic


addition and store it in 2200H.
CODE:-
MVI A,54H ;MOVING 54H TO A
MVI B,48H ;MOVING 48H TO B
ADD B ;PERORMING ARITHMETIC ADDITION
STA 2200H ;STORING ACCUMULATOR IN MEMORY LOCATION
2200H
HLT ;HALTING THE PROGRAM

FOURTH PROGRAM- Store D=3AH, A=C8H and perform arithmetic


addition and store it in 2600H.
CODE:-
MVI D,3AH ;MOVING 3AH TO D
MVI A,C8H ;MOVING C8H TO A
ADD D ;PERFORMING ARITHMETIC ADDITION
STA 2600H ;STORING ACCUMULATOR IN MEMORY LOCATION 2600H
HLT ;HALTING THE PROGRAM

FIFTH PROGRAM – Store A=64H, B=64H perform arithmetic


subtraction .
CODE:-
MVI A,64H ;MOVING 64H TO A
MVI B,64H ;MOVING 64H TO B
SUB B ;PERFORMING ARITHMETIC SUBTRACTION
HLT ;HALTING THE PROGRAM

SIXTH PROGRAM – Store A=3AH, add immediately 48H and store in


2150H.
CODE:-
MVI A,3AH ;MOVING 3AH TO A
ADI 48H ;ADDING 48H IN ACCUMULATOR
STA 2150H ;STORING ACCUMULATOR IN MEMORY LOCATION
2150H
HLT ;HALTING THE PROGRAM

SEVENTH PROGRAM – Store A=3AH, subtract immediately 48H and


store in 2200 H.
CODE:-
MVI A,3AH ;MOVING 3AH TO A
SUI 48H ;ADDING 48H IN ACCUMULATOR
STA 2200H ;STORING ACCUMULATOR IN MEMORY LOCATION
2200H
HLT ;HALTING THE PROGRAM
LAB 6:- Exchanging the memory locations in SIM8085
Date: 09/10/2023
Aim: Performing memory exchange
Software used: SIM8085
QUESTIONS:-
Perform exchange/swap in memory location such that A=34H and
B=45H in 2500H and 2502H.
CODE:-
MVI A,34H ;MOVING 34H TO A
STA 2500H ;2500H=34H

MVI B,45H ;MOVING 45H TO B


MOV A,B ;MOVING CONTENT OF B INTO A
STA 2502H ;2502H=45H

LDA 2500H ;A=34H


MOV B,A ;B=34H
LDA 2502H ;A=45H
STA 2500H ;2500H = 45H

MOV A,B ;A=34H


STA 2502H ;2502H = 34H
LAB 7:- Multiplication by logic gates in SIM8085 Date:
23/10/2023
Aim: Performing multiplication by using RLC commands.
Software used: SIM8085
QUESTIONS:-
Q1) Perform multiplication by logic gates where B = 05H , A =
04H and STA = 2500H.
CODE:-
MVI B,05H
MVI C,04H
MOV A,B
RLC
RLC
STA 2500H
HLT
Q2) Perform multiplication of 5X2 by storing B =05H and
STA=2100H and use RLC once.
CODE:-
MVI B,05H
MOV A,B
RLC
STA 2100H
HLT

Q3)Perform multiplication of 5x4 by storing B=05H and


STA=2120H and use RLC twice.
CODE:-
MVI B,05H
MOV A,B
RLC
RLC
STA 2120H
HLT

Q4) Perform multiplication of 5x8 by storing B=05H and


STA=2130H and use RLC thrice.
CODE:-
MVI B,05H
MOV A,B
RLC
RLC
RLC
STA 2130H
HLT

LAB 8:- Program to find smallest and largest number in array


Date: 06/11/2023
Aim: Program to find smallest and largest number in array
Software used: SIM8085
QUESTIONS:-
Q1) PROGRAM TO FIND THE LARGEST NUMBER IN ARRAY
CODE:-
LXI H,4200H ;LOAD INTO HL,VALUE FROM
MOV B,M ;MOVE INTO B, M
INX H ;INCREMENT HL TOGETHER
MOV A,M ;MOVE INTO A,M
DCR B ;DECREMENT B
LOOP: INX H ;LOOP, KEEP INCREMENTING H
CMP M ;COMPARE M WITH A
JNC AHEAD ; JUMP IF NO CARRY TO AHEAD
MOV A,M ; MOVE INTO A,M
AHEAD: DCR B ;AHEAD=DECREMENT B
JNZ LOOP ;JUMP IF NOT ZERO TO LOOP
STA 4230H ;STORE INTO 4230H
HLT

OUTPUT:-

Q2) PROGRAM TO FIND THE SMALLEST NUMBER IN ARRAY

CODE:-
LXI H,4200H ;LOAD INTO HL,VALUE FROM
MOV B,M ;MOVE INTO B, M
INX H ;INCREMENT HL TOGETHER
MOV A,M ;MOVE INTO A,M
DCR B ;DECREMENT B
LOOP: INX H ;LOOP, KEEP INCREMENTING H
CMP M ;COMPARE M WITH A
JC AHEAD ; JUMP IF CARRY TO AHEAD
MOV A,M ; MOVE INTO A,M
AHEAD: DCR B ;AHEAD=DECREMENT B
JNZ LOOP ;JUMP IF NOT ZERO TO LOOP
STA 4230H ;STORE INTO 4230H
HLT

OUTPUT:-

LAB 9:- Program to arrange the array in ascending order


Date: 13/11/2023
Aim: Program to write input and arrange the given array in ascending
order
Software used: SIM8085
QUESTIONS:-
QUESTION – CONVERT THE NUMBERS WRITTEN IN ARRAY IN
ASCENDING ORDER
CODE:-
LXI H, 0000H ;LOAD INTO HL, VALUE FROM 0000H
MOV C,M ;MOVE INTO C,A
DCR C ;DECREMENT C
REPEAT: MOV D,C ;REPEATEDLY MOVE
LXI H, 0001H ;LOAD INTO HL, VALUE FROM 0001H
LOOP: MOV A,M ;LOOP MOVE INTO A,M
INX H ;INCREMENT HL
CMP M ;COMPARE M WITH A
JC SKIP ;IF CARRY FLAG THEN SKIP
MOV B,M ;MOVE CONTENT OF MEMORY TO B
MOV M,A ;MOVE INTO M,A
DCX H ;DECREMENT HL
MOV M,B ;MOVE INTO M,B
INX H ;INCREMENT H
SKIP: DCR D ;SKIP = DECREMENT H
JNZ LOOP ;JUMP IF NO ZERO LOOP
DCR C ;DECREMENT C
JNZ REPEAT ;JUMP OF NO ZERO REPEAT
HLT ;HALTING THE PROGRAM

OUTPUT :-
LAB 10: DESCENDING ORDER

LAB : 11/20/2023

Aim: Perfoming the Descending order ( Bubble Sort)

Code :
lxi h, 0000h
mov c, m
dcr c
repeat: mov d, c
lxi h, 0001h
loop: mov a, m
inx h
cmp m
jnc skip
mov b, m
mov m, a
dcx h
mov m, b
inx h
skip: dcr d
jnz loop
dcr c
jnz repeat

hlt

Let’s take as an example a combination of codes: 05-75-10-35-08

For finding the descending order, we use a loop that will verify also which number is less
than and then put it on le right side.
Every time we compare two numbers, then we compare from the first to the next entity.

Let4s see the code using www.sim8085.com :


In here, we have already performed the Instruction.
As we can see, the numbers are in descending order starting by 75-35-18-08

You might also like