Difference between revisions of "CSC103 Homework3 Solutions, 2012"

From dftwiki3
Jump to: navigation, search
(Assembly Language)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
--[[User:Thiebaut|D. Thiebaut]] 14:11, 28 February 2012 (EST)
 
--[[User:Thiebaut|D. Thiebaut]] 14:11, 28 February 2012 (EST)
 
----
 
----
 +
<onlydft>
 
=Wiki Page=
 
=Wiki Page=
  
Line 13: Line 14:
 
* There were several ways to write the program.  Here's one below that uses different instructions.
 
* There were several ways to write the program.  Here's one below that uses different instructions.
 
* Importantly, you have to make sure that the address you specify for the data with the '''@''' symbol is '''above''' the address of the last instruction, which is a '''hlt''' instruction.  If you do not, then your program overwrites the instructions at the end of your program and you have a program with a '''major''' bug on your hands!
 
* Importantly, you have to make sure that the address you specify for the data with the '''@''' symbol is '''above''' the address of the last instruction, which is a '''hlt''' instruction.  If you do not, then your program overwrites the instructions at the end of your program and you have a program with a '''major''' bug on your hands!
 
+
* Note: in the program below, whatever follows a semicolon is a comment, something that the processor will not execute!
 +
<br />
 
<code><pre>
 
<code><pre>
 
; Assembly language program that initializes 10 variables with
 
; Assembly language program that initializes 10 variables with
Line 43: Line 45:
  
 
@30
 
@30
var1:  data
+
var1:  0
var2:  data
+
var2:  0
var3:  data
+
var3:  0
var4:  data
+
var4:  0
var5:  data
+
var5:  0
var6:  data
+
var6:  0
var7:  data
+
var7:  0
var8:  data
+
var8:  0
var9:  data
+
var9:  0
var10:  data
+
var10:  0
  
 
</pre></code>
 
</pre></code>
Line 64: Line 66:
  
 
<br />
 
<br />
 
+
</onlydft>
 
<br />
 
<br />
  

Latest revision as of 16:04, 1 June 2012

--D. Thiebaut 14:11, 28 February 2012 (EST)



...