0% found this document useful (0 votes)
146 views2 pages

CPSC1050 Lab 4

This document provides instructions for Lab 4, which involves reviewing how a Super Simple CPU works and completing exercises related to low-level languages and assembly programming. Students are asked to trace assembly programs, including providing the values of registers and memory locations after each instruction for different inputs. They also trace and transform pseudocode to assembly language programs for the Super Simple CPU. The lab aims to develop an understanding of low-level programming concepts.

Uploaded by

Danny Jirdan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views2 pages

CPSC1050 Lab 4

This document provides instructions for Lab 4, which involves reviewing how a Super Simple CPU works and completing exercises related to low-level languages and assembly programming. Students are asked to trace assembly programs, including providing the values of registers and memory locations after each instruction for different inputs. They also trace and transform pseudocode to assembly language programs for the Super Simple CPU. The lab aims to develop an understanding of low-level programming concepts.

Uploaded by

Danny Jirdan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CPSC 1050: Lab 4

Lab 4: Low-level Languages

Lab Instructions

1. Open "Lab 7 Computer Cycling" (Lab7_Manual.pdf), "Lab 7 Computer Cycling"


(Lab7_Manual.pdf) "Lab 11 Low-Level Languages" (Lab11_Manual.pdf) and the related
Applet (Super Simple CPU).
2. Review the Activity part of the lab and learn how Super Simple CPU works.
3. Write your complete work to answer the following Lab Questions in a text editor (e.g.,
Microsoft Word). If there is a screenshot, it must be copied to your document.

Lab Questions

1. Lab 7 Computer Cycling (Lab7_Manual.pdf)


a. [2 points] Exercise 5
b. [2 points] Exercise 6

2. Lab 11 Low-Level Languages (Lab11_Manual.pdf)


a. [4 points] Exercise 1
b. [4 points] Exercise 3

3. [8 points] Given the following assembly program, consider three different values for
INPUT (1, 2, or 3). For each input value, trace the code by writing the values of
Accumulator, Memory (ONE), Memory (TWO), and OUTPUT in a table (shown below)
and recording their changes after each instruction. You should have 3 trace tables for 3
different values of input.

INP ; consider three different values for input (1,2,3)


SUB ONE
JZR ZERO
SUB TWO
JNG NEG
ADD TWO
OUT
STP
NEG ADD TWO
OUT
STP
ZERO OUT
STP
ONE DAT 1 ; A data value, the number 1
TWO DAT 2 ; A data value, the number 2

Instruction ACC ONE TWO Output


INP 1 1 2 -
… … … … …

1
CPSC 1050: Lab 4

4. Given the following "Super Simple CPU" program:


a. [4 points] Trace the code by writing the values of Accumulator, Memory (ONE),
and OUTPUT in a table (shown below) and recording their changes after each
instruction.
b. [1 points] Explain the function of the program in one sentence (Hint: For the
function of the program, you can explain the output of the program).

LDI 6
COUNT JZR DONE
OUT
SUB ONE
JMP COUNT
DONE STP
ONE DAT 1

Instruction ACC ONE Output


LDI 6 6 1 -
… … … …

5. Given the following pseudocode:


a. [4 points] Trace the program by writing the values of variables, conditions, and
printout in a table (shown below).
b. [4 points] Transform the pseudocode to a program in Super Simple CPU
Assembly language.
c. [1 point] Explain the function of the program in one sentence. (Hint: For the
function of the program, you can explain the printout of the program).

Set num to 10
WHILE (num is greater than 0)
Print num
Set num to num – 2
END WHILE

num num > 0 Print out


10 true 10
… … …

Lab Submission

You must only submit one pdf file. Save your file as yourName_Lab4.pdf and submit to
Brightspace.

You might also like