Difference between revisions of "CSC103 Homework3 Solutions, 2012"
(→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: | + | var1: 0 |
− | var2: | + | var2: 0 |
− | var3: | + | var3: 0 |
− | var4: | + | var4: 0 |
− | var5: | + | var5: 0 |
− | var6: | + | var6: 0 |
− | var7: | + | var7: 0 |
− | var8: | + | var8: 0 |
− | var9: | + | var9: 0 |
− | var10: | + | var10: 0 |
</pre></code> | </pre></code> | ||
Line 64: | Line 66: | ||
<br /> | <br /> | ||
− | + | </onlydft> | |
<br /> | <br /> | ||