Difference between revisions of "CSC231 Homework 6 2017"

From dftwiki3
Jump to: navigation, search
Line 12: Line 12:
 
Write an assembly language program called '''hw6.asm''' similar to the one with work out in class, but with a few important differences, listed below.  You can find the program we wrote in class [[CSC231_Developing_the_Game_of_Life_in_Assembly | here]].
 
Write an assembly language program called '''hw6.asm''' similar to the one with work out in class, but with a few important differences, listed below.  You can find the program we wrote in class [[CSC231_Developing_the_Game_of_Life_in_Assembly | here]].
 
<br />
 
<br />
* Your program will use an ''include'' file to get the array dish, which contains the initial 1-line generation of cells.   
+
:# Your program will use an ''include'' file to get the array dish, which contains the initial 1-line generation of cells.   
* Your program will not use a single '''loop''' instruction, and will implement all the loops using '''cmp''' and '''jump''' instructions (conditionals and unconditional jumps will be used).
+
:# Your program will not use a single '''loop''' instruction, and will implement all the loops using '''cmp''' and '''jump''' instructions (conditionals and unconditional jumps will be used).
 +
:# Your program will not necessarily set the first and last cells of newGen to 0, as the program we wrote in class did.  The first and last cells of dish are different from the others in that they only have 1 neighbor.  The first cell, at Index 0, has a neighbor in the cell at Index 1.  The last cell, at Index N-1, has one neighbor, at Index N-2.  While our program automatically decided that the first and last cells would die in the next generation, your program won't.  Instead it will see if these boundary cells have 1 live neighbor or not, and if they do have a live neighbor in dish, will make them live in newGen.
 
<br />
 
<br />
 
==Using an Include File==
 
==Using an Include File==
Line 134: Line 135:
 
* '''N''' is a nasm constant that is equal to the number of bytes (or cells) in '''dish'''.
 
* '''N''' is a nasm constant that is equal to the number of bytes (or cells) in '''dish'''.
 
* '''maxGen''' is the maximum number of generations your program should output.  Since the program prints the initial generation of cells plus '''maxGen''' generations, the total number of lines your program will output should be equal to '''maxGen + 1'''.
 
* '''maxGen''' is the maximum number of generations your program should output.  Since the program prints the initial generation of cells plus '''maxGen''' generations, the total number of lines your program will output should be equal to '''maxGen + 1'''.
<font color="magenta">Note that in the Game of Life program we generated in class together, we used 20 as the number of generations.  In your new version, you shouldn't use a constant, but rather whatever number is in the int variable '''maxGen'''.
+
<font color="magenta">Note that in the Game of Life program we generated in class together, we used 20 as the number of generations.  In your new version, you shouldn't use a constant, but rather whatever number is in the int variable '''maxGen'''.</font>
 
<br />
 
<br />
 
==Running the Demo Program==
 
==Running the Demo Program==
Line 148: Line 149:
 
* Similarly, change the number stored in '''maxGen''', in ''dishArray.inc'', re-assemble, link, and execute, and see how your change affects the output.
 
* Similarly, change the number stored in '''maxGen''', in ''dishArray.inc'', re-assemble, link, and execute, and see how your change affects the output.
 
<br />
 
<br />
 
+
==Testing Your Program==
 +
<br />
 +
I have created a program called '''evaluateHw6.sh''' to test your '''hw6.asm''' program.  It will give you some information relative to whether your program is output the correct generations or not.
 
</onlydft>
 
</onlydft>
 
<br />
 
<br />

Revision as of 20:25, 1 April 2017

--D. Thiebaut (talk) 18:56, 1 April 2017 (EDT)


Game Of Life Without Loop Instructions


For this assignment, you need to write a game of life program in assembly, and the challenge is to implement it without using the loop instruction, using only the cmp instruction and conditional jumps.



...