Difference between revisions of "CSC103 Homework 3 2013"

From dftwiki3
Jump to: navigation, search
(Will be available soon... stay tuned!)
Line 9: Line 9:
 
   
 
   
 
<center> <font size="+2">Will be available soon... stay tuned!</font> <br \>[[File:UnderConstruction.jpg|300px]] </center>
 
<center> <font size="+2">Will be available soon... stay tuned!</font> <br \>[[File:UnderConstruction.jpg|300px]] </center>
 +
 +
=Problem 1=
 +
<br />
 +
<center>[[Image:CSC103_hw3_1_2013.jpb]]</center>
 +
<br />
 +
The program above is badly commented.  Your assignment is to add ''comments'' to the program and give names to the
 +
different variables.  A comment is just some documentation following a semi-colon.
 +
 +
Use the program below as an example of what you should emulate.  Do not put my name on your listing, but yours instead.
 +
 +
<source lang="asm">
 +
; sum of 2 integers
 +
; D. Thiebaut  CSC103
 +
; The program takes 2 variables stored in memory at
 +
; Address 10 (and up) computes their sum and stores
 +
; it in a 3rd variable.
 +
 +
@0        ;code section starts at address 0
 +
start: lod var1      ;AC <- 3
 +
add var2            ;AC <- 3+5 = 8
 +
sto sum              ;sum <- 8
 +
hlt
 +
 +
@10                  ;data section starts at Address 1
 +
var1: 3
 +
var2: 5
 +
sum: 0
 +
</source>

Revision as of 14:05, 25 September 2013

--D. Thiebaut (talk) 08:34, 24 September 2013 (EDT)








Will be available soon... stay tuned!
UnderConstruction.jpg

Problem 1


File:CSC103 hw3 1 2013.jpb


The program above is badly commented. Your assignment is to add comments to the program and give names to the different variables. A comment is just some documentation following a semi-colon.

Use the program below as an example of what you should emulate. Do not put my name on your listing, but yours instead.

; sum of 2 integers
; D. Thiebaut   CSC103
; The program takes 2 variables stored in memory at 
; Address 10 (and up) computes their sum and stores
; it in a 3rd variable.	

@0   	  	     ;code section starts at address 0
start: lod var1      ;AC <- 3
add var2             ;AC <- 3+5 = 8
sto sum              ;sum <- 8
hlt

@10                  ;data section starts at Address 1
var1: 3 
var2: 5
sum: 0