Coal Lab Manual
Coal Lab Manual
LAB MANUAL
1
Computer Organization &
Assembly Language LAB MANUAL
Table of Contents
LAB # 01 ...................................................................................................................................................................... 1
TASK # 01 ................................................................................................................................................................ 1-5
TASK # 02 ............................................................................................................................................................ 5-7
LAB # 02 ...................................................................................................................................................................... 8
TASK #03 ................................................................................................................................................................. 8-9
TASK # 04 ............................................................................................................................................................ 10-13
LAB # 03 ...................................................................................................................................................................... 14
TASK # 05 ................................................................................................................................................................ 14-17
TASK # 06 ............................................................................................................................................................ 18-21
LAB # 04 ...................................................................................................................................................................... 21
TASK #07 ................................................................................................................................................................. 21-24
TASK # 08 ............................................................................................................................................................ 23-25
2
Computer Organization &
Assembly Language LAB MANUAL
COMPUTER ORGANIZATION
ASSEMBLY LANGUAGE
An assembly language is a low-level programming language
designed for a specific type of processor. It may be produced by
compiling source code from a high-level programming language
(such as C/C++) but can also be written from scratch.
Assembly code can be converted to machine code using
an assembler.
DOWNLOADING PCSPIM
After this the screen appears as: and click the next tab for installing setup.
4
Computer Organization &
Assembly Language LAB MANUAL
After this downloading and installing process for the software started.
Task # 2
RUNNING PCSPIM
At the bottom, under “Trap file:” or “Execution file:”, change the drive
from “C” TO “D”.
Leave “allow pseudocode instructions” checked. Hit OK. You can return
tosettings at any time from the PCSPIM window by selecting
Simulator->Settings.
5
Computer Organization &
Assembly Language LAB MANUAL
Four windows appear in the PCSPIM frame: Registers, Text Segment, Data
Segment, and Messages Window.
Register Window: The value of all register in the MIPS CPU and FPU.
Text Segment window: instruction both from your program and the
system code that is loaded automatically when PCSPIM is running.
Data Segment: The data loaded into your program’s memory and the data
of the program’s stack.
Messages Window: for PCSPIM messages. This is where error message
appears.
Use the Notepad and write the code right-click and use “Save target
as” to save it somewhere. And save the file name with double quotation
sign and extensions.
To open the first file: File -> Open.
Open “Task1.s” from wherever you saved it above. In the Message window, you should
see a message “Task1.s” has successfully loaded First try running the program:
You will be asked for the starting address of the program. Use the address of the first
instruction in the Text Segment window. (This is most likely set already)
6
Computer Organization &
Assembly Language LAB MANUAL
Next, try single stepping through the program one step at a time.
To stop the execution at any time, you can use Simulation -> Break.
You will be prompted whether to continue or end execution. (Click on Yes to end)
When you make changes to the file you are running Simulation -> Reload
<filename>
to have the updated file loaded into PCSPIM. Quitting PCSPIM->File -> Exit
7
Computer Organization &
Assembly Language LAB MANUAL
Here, I am going to show you how to convert hexa-decimal into decimal and
decimal into hexa-decimal in PCSPIM.
First, open your PCSPIM and the Click on the option stimulator.
8
Computer Organization &
Assembly Language LAB MANUAL
Now, Click OK….
And if you want to again convert into decimal then again go to simulator, click
setting and the again cluck the option (general register in hexa-decimal) and turn it
of……
9
Computer Organization &
Assembly Language LAB MANUAL
Task # 4
After writing code on notepad save file with lab task 4 with. s extension in double
quotation.
Click save……….
10
Computer Organization &
Assembly Language LAB MANUAL
After that, Click the option File and then click the option open.
Choose Your Code that u Write on NOTEPAD.
Now, open it.
11
Computer Organization &
Assembly Language LAB MANUAL
After that, run the program and give address like this.
Click OK
12
Computer Organization &
Assembly Language LAB MANUAL
13
Computer Organization &
Assembly Language LAB MANUAL
14
Computer Organization &
Assembly Language LAB MANUAL
Now, go to the PSSPIM and click his FILE option and open the code in the PCSPIM.
Now, CLICK the HAND sign button (Breakpoints) and take your address.
15
Computer Organization &
Assembly Language LAB MANUAL
Click OK….
Now, enter number 1 and number 2 and u will find the ADD of 2 numbers.
16
Computer Organization &
Assembly Language LAB MANUAL
Task # 6
What will the program be to Subtract of 2 numbers in
the assembly language? Also run the program on PCSPIM.
17
Computer Organization &
Assembly Language LAB MANUAL
Now, go to the PSSPIM and click his FILE option and open the code in the
PCSPIM.
Now, CLICK the HAND sign button (Breakpoints) and take your address.
Click OK….
18
Computer Organization &
Assembly Language LAB MANUAL
Now, enter number 1 and number 2 and u will find the SUBTRACT of 2
numbers.
19
Computer Organization &
Assembly Language LAB MANUAL
20
Computer Organization &
Assembly Language LAB MANUAL
Now, go to the PSSPIM and click his FILE option and open the code in the
PCSPIM.
Now, CLICK the HAND sign button (Breakpoints) and take your address.
21
Computer Organization &
Assembly Language LAB MANUAL
Click OK….
Now, enter number 1 and number 2 and u will find the SUBTRACT of 2
numbers.
22
Computer Organization &
Assembly Language LAB MANUAL
Task # 8
Now, go to the PSSPIM and click his FILE option and open the code in the
PCSPIM.
23
Computer Organization &
Assembly Language LAB MANUAL
Now, CLICK the HAND sign button (Breakpoints) and take your address.
Click OK….
24
Computer Organization &
Assembly Language LAB MANUAL
Now, Dividend and Divisor and u will find the Division of 2 numbers.
25
Computer Organization &
Assembly Language LAB MANUAL
26