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

CSA Practical File

This document contains 10 assembly language programs that simulate various computer architecture components and instructions. Each program contains 1-2 assembly language routines that demonstrate logical operations, memory instructions, register operations, and shifting. The programs take user input, perform the relevant operations, and display output to demonstrate the instructions work as expected.

Uploaded by

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

CSA Practical File

This document contains 10 assembly language programs that simulate various computer architecture components and instructions. Each program contains 1-2 assembly language routines that demonstrate logical operations, memory instructions, register operations, and shifting. The programs take user input, perform the relevant operations, and display output to demonstrate the instructions work as expected.

Uploaded by

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

INDRAPRASTHA COLLEGE FOR WOMEN,

DELHI UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE

CSA PRACTICAL (SEM 1)


COMPUTER SYSTEM ARCHITECTURE
SUBMITTED TO- Dr. SARABJEET KAUR
SUBMITTED BY- KANCHAN SAGAR
ROLL NO.- 20\CS\21

INDEX
S NO. OBJECTIVE
DATE SIGN.
1. Write an assembly language program to simulate
the following 23\02\2021
Logical operations on two user entered
numbers: OR, NOT,
XOR, NOR, NAND.
2. Write an assembly program for simulating
following memory- 25\02\2021
Reference instructions: ADD, LDA, STA, BUN, ISZ.
3. Write an assembly language program to simulate
the machine 18\02\2021
For following register reference instructions and
determine the
Contents of AC, E, PC, AR and IR registers in
decimal after the
Execution: CLA, CMA, CME, HLT.
4. Write an assembly language program to simulate
the machine 18\02\2021
For following register reference instructions and
determine the
Contents of AC, E, PC, AR and IR registers in
decimal after the
Execution: INC, SPA, SNA, SZE.
5. Write an assembly language program to simulate
the machine 18\02\2021
For following register reference instructions and
determine the
Contents of AC, E, PC, AR and IR registers in
decimal after the
Execution: CIR, CIL.
5. WRITE AN ASSEMBLY PROGRAM TO SIMULATE THE
FOLLOWING LOGICAL OPERATION ON TWO – USER
ENTERED NUMBERS.
.OR
.NOT
.XOR
.NOR
.NAND
OR:
;this program adds two numbers

start: read ;read->ac

STA a ;store the new a

read ;read b->ac

STA b ;store the new a

LDA a ;load a to ac

OR b ;using nor gate

write ;write

hlt

a: .data 2 0
b: .data 2 0

OUTPUT:

NOT:
;this program adds two numbers
start: read ;read->ac

STA a ;store the new a

LDA a ;load a to ac

NOT a ;using nor gate

write ;write

hlt
a: .data 2 0

b: .data 2 0

OUTPUT:

XOR:
;this program add two number

start: read;read->ac

STA a;store a in ac

read ;readb->ac

STA b

LDA a ;load a to ac

XOR b ; using xor gate


write ;write

hlt

a: .data 2 0

b: .data 2 0

OUTPUT:

NOR:
;this program add two number

start: read ;read->ac

STA a ;store a in ac
read ;readb->ac

STA b

LDA a ;load a to ac

NOR b ; using xor gate

write ;write

hlt

a: .data 2 0

b: .data 2 0

OUTPUT:
NAND:
;this program add two number

start: read ;read->ac

STA a ;store a in ac

read ;readb->ac

STA b

LDA a ;load a to ac

NAND b ; using nor gate

write ;write

hlt

a: .data 2 0

b: .data 2 0

OUTPUT:
b: .data 2 0

7. WRITE AN ASSEMBLY PROGRAM FOR SIMULATING


FOLLOWING MEMORY – REFRENCE INSTRUCTIONS.
.ADD
.LDA
.STA
.BUN
.ISZ
ADD:
;this program adds two numbers
start: read ;read->ac
ADD a ;add a to ac
STA a ;store the new a
read ;read b->ac
STA b ;store the new a
ADD b ;add b to ac
write ;write
hlt

a: .data 2 0
b: .data 2 0

OUTPUT:

LDA AND STA:


;this program load band store number

start: read ;read->ac

STA a ;store a in ac

LDA a ;load a to ac

write ;write

hlt

a: .data 2 0

OUTPUT:
Enter an integer 5

Output 5

BUN:
;this program branch unconditionally number

start: read ;read->ac

STA a ;store a in ac

LDA a ;load a to ac

BUN 5

XOR a

write ;write

hlt

a: .data 2 0

OUTPUT:
Enter an integer 5

Output 5
ISZ:
;this program increment and skip number

start: read ;read->ac

STA a ;store a in ac

LDA a ;load a to ac

inc ;increment ac

ISZ a ;increment and skip if dr register is 0

inc ;increment ac if isz doesn't execute

write ;write

hlt

a: .data 2 0

b: .data 2 0

OUTPUT:

Enter an integer -1
Output 0

8. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO


STIMULATE THE MACHINE FOR FOLLOWING REGISTER
REFERENCE INSTRUCTIONS AND DETERMINE THE
CONTENTS OF AC, E, PC, AR, AND IR REGISTERS IN
DECIMAL AFTER THE EXECUTION:
.CLA
.CMA
.CME
.HALT
CLA AND CMA:
;this program clear and complement ac

start: read ;read->ac

STA a ;store from ac

LDA a ;load a to ac

cla ;clear ac to 0

write ;write

cma ;complement ac

write
OUTPUT:

Enter an integer 2

Output 0

Output -1

CLE AND HALT:


;this program add two numbers

Start: cme ;clear e to 0

Hlt
9. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO
SIMULATE THE MACHINE FOR THE FOLLOWING
REGISTER REFERENCE INSTRUCTIONS AND DETERMINE
THE CONTENTS IF AC, E, PC, AR, AND IR REGISTER IN
DECIMAL AFTER THE EXECUTION.
.INC
.SPA
.SNA
.SZE
;this program increment ac

;this program skip if ac is positive

;this program skip if ac is negative

;this program skip if e is 0

Start: read
STA a ;store a to ac

LDA a ;load a to ac

inc ;increment ac

write ;output

spa ;check if ac is positive then skip

inc ;increment if ac is not positive

sna ;check if ac is negative then skip

inc ;increment if ac is not negative

write ;output

hlt

a: .data 2 0
10. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO
SIMULATE THE MACHINE FOR THE FOLLOWING
REGISTER REFERENCE INSTRUCTIONS AND DETERMINE
THE CONTENTS OF AC, AR, PC, E, AND IR REGISTER IN
DECIMAL AFTER EXECUTION.
.CIR
.CIL
;this program circulate left

;this program circulate right

Start: read

STA a ;store a to ac

LDA a ;load a to ac

cir ;circular right shift of ac

write ;output ahter circular right shift

cil ;circular left shift of ac

write ;output circular left shift

hlt ;stop

a: .data 2 0
THANK YOU!

You might also like