Difference between revisions of "CSC103: DT's Notes 1"
Line 1,242: | Line 1,242: | ||
<br /> | <br /> | ||
− | + | ; Solution for Problem 5 | |
− | ; Solution for Problem 5 | + | ; D. Thiebaut |
− | ; D. Thiebaut | + | ; First initialize both variables with 55 |
− | ; First initialize both variables with 55 | + | start: lod-c 55 |
− | start: lod-c 55 | + | sto var1 |
− | + | sto var2 | |
− | + | ||
+ | ; now loop and increment Location 15 and decrement Location 16 | ||
+ | ; the loop is endless. | ||
+ | loop: lod 15 | ||
+ | add-c 1 | ||
+ | sto 15 | ||
+ | lod 16 | ||
+ | dec | ||
+ | sto 16 | ||
+ | jmp loop | ||
+ | hlt | ||
+ | @15 | ||
+ | 0 | ||
+ | 0 | ||
− | + | <br /> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
First, the lines starting with semi colons are comments, and not part of the actual program. They allow the programmers | First, the lines starting with semi colons are comments, and not part of the actual program. They allow the programmers | ||
to add extra information for other programmers who may read the code. | to add extra information for other programmers who may read the code. |
Revision as of 11:44, 22 September 2013
--© D. Thiebaut 08:10, 30 January 2012 (EST)