Difference between revisions of "CSC231 Homework 7 Fall 2017"
(→Requirements) |
|||
Line 56: | Line 56: | ||
==Requirements== | ==Requirements== | ||
<br /> | <br /> | ||
− | * <font color="magenta">Your program should NOT | + | * <font color="magenta">Your program should NOT any '''loop''' instructions. Use the '''cmp''' instruction and conditional jumps to control the different loops.</font> |
<br /> | <br /> | ||
+ | |||
==Additional Information== | ==Additional Information== | ||
<br /> | <br /> |
Revision as of 14:31, 9 November 2017
--D. Thiebaut (talk) 14:24, 9 November 2017 (EST)
This assignment is due on 7/20/17 at 11:55 p.m.
Contents
Problem 1: Life on a new level
For this problem you have to implement a more interesting game of life. Take a look at a demo of the solution program. You will understand right away what your program will have to do:
cs231a@aurora ~/handout $ ./hw7a > 0 > @@ cs231a@aurora ~/handout $ ./hw7a > 1 > @ @ @ @ @ @ cs231a@aurora ~/handout $ ./hw7a > 2 > @ @ @ @ @ @ @ @ @ @ cs231a@aurora ~/handout $ ./hw7a > 10 > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @@ @ @ @@@@ @ @@ @
Explanations
- The program prompts for 2 pieces of information: an integer, which can be 0 or positive, and a string of spaces and '@' characters.
- The integer represents the number of generations we want to have our dish of cells go through. 0 means nothing gets printed. 1 means the original generation entered by the user is shown. 2 or more indicates that the program goes through a loop and evolves the cells in the dish.
- The string can be as long as what _getString allows, which is 1000 characters. However, for this assignment, we will assume that the string of live and dead cells entered by the user will never be more than 100 characters. It also means that your program will be tested only with strings of no more than 100 cells.
Requirements
- Your program should NOT any loop instructions. Use the cmp instruction and conditional jumps to control the different loops.
Additional Information
Getting an int from the keyboard
Use _getInput, which is part of the 231Lib.asm library.
call _getInput mov dword[numGen], eax
Getting a string from the keyboard
We've used it before: _getString. It returns the address of the string in ecx, and the number of chars entered in edx. _getString has its own buffer of 1000 characters in which is saves the string. It will return the address of this buffer in ecx.
Submission
- Save your program in a file called hw7a.asm and submit it to Moodle.
- Document your code well!