1 |
2 |
sinclairrf |
<html>
|
2 |
|
|
<title>
|
3 |
|
|
Game of Life
|
4 |
|
|
</title>
|
5 |
|
|
<body>
|
6 |
|
|
<tt>Game of Life example program</tt><br/>
|
7 |
|
|
<tt>Copyright 2012-2013, Sinclair R.F., Inc.</tt><br/>
|
8 |
|
|
<h1>Introduction</h1>
|
9 |
|
|
<i>Conway's Game of Life</i>, see
|
10 |
|
|
<a href="http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Wikipedia</a>,
|
11 |
|
|
is used as an example of a more complicated SSBCC.9x8 application.<br/><br/>
|
12 |
|
|
The processor is used to propagate the machine state on a periodic basis as
|
13 |
|
|
controlled by user input, the FPGA fabric is used to generate the output
|
14 |
|
|
video, and several external SRAM are used as a ping pong buffer for the video
|
15 |
|
|
display.<br/><br/>
|
16 |
|
|
Scripts to build the game for various development boards are listed by FPGA
|
17 |
|
|
vendor name.<br/><br/>
|
18 |
|
|
<h1>Theory of Operation</h1>
|
19 |
|
|
The bit pattern for the game of life is stored in a 256x256 memory as 256x32
|
20 |
|
|
8-bit values. I.e., in 8 kB of RAM. Two copies of this memory are used,
|
21 |
|
|
one for the image being displayed and one for the image being
|
22 |
|
|
computed.<br/><br/>
|
23 |
|
|
The processor reads three lines of the image into buffers and computes the new
|
24 |
|
|
line of output based on those. This architecture allows the processor to do
|
25 |
|
|
an in-place update for the maximum update rate.<br/><br/>
|
26 |
|
|
<h1>Serial Protocol</h1>
|
27 |
|
|
This section lists the commands to configure and operate the game.<br/><br/>
|
28 |
|
|
<table>
|
29 |
|
|
<tr>
|
30 |
|
|
<th valign="top" align="left">Command</th>
|
31 |
|
|
<th valign="top" align="left">Description</th>
|
32 |
|
|
</tr>
|
33 |
|
|
<tr>
|
34 |
|
|
<td valign="top" align="left">c</td>
|
35 |
|
|
<td valign="top" align="left">clear the game and turn off wrapping</td>
|
36 |
|
|
</tr>
|
37 |
|
|
<tr>
|
38 |
|
|
<td valign="top" align="left">h</td>
|
39 |
|
|
<td valign="top" align="left">halt the game</td>
|
40 |
|
|
</tr>
|
41 |
|
|
<tr>
|
42 |
|
|
<td valign="top" align="left">i I</td>
|
43 |
|
|
<td valign="top" align="left">set the update interval to I<br/>
|
44 |
|
|
Note: I must be between 0 and 255 inclusive
|
45 |
|
|
</td>
|
46 |
|
|
</tr>
|
47 |
|
|
<tr>
|
48 |
|
|
<td valign="top" align="left">r</td>
|
49 |
|
|
<td valign="top" align="left">run the game indefinitely</td>
|
50 |
|
|
</tr>
|
51 |
|
|
<tr>
|
52 |
|
|
<td valign="top" align="left">s</td>
|
53 |
|
|
<td valign="top" align="left">step the game (do one iteration of the game)</td>
|
54 |
|
|
</tr>
|
55 |
|
|
<tr>
|
56 |
|
|
<td valign="top" align="left">w</td>
|
57 |
|
|
<td valign="top" align="left">toggle wrapping</td>
|
58 |
|
|
</tr>
|
59 |
|
|
<tr>
|
60 |
|
|
<td valign="top" align="left">+ N M</td>
|
61 |
|
|
<td valign="top" align="left">set the pixel on the N'th column and M'th row<br/>
|
62 |
|
|
Note: N and M must be within the size constraints for the game (nominally
|
63 |
|
|
|
64 |
|
|
</td>
|
65 |
|
|
</tr>
|
66 |
|
|
<tr>
|
67 |
|
|
<td valign="top" align="left">- N M</td>
|
68 |
|
|
<td valign="top" align="left">clear the pixel on the N'th column and M'th row</td>
|
69 |
|
|
</tr>
|
70 |
|
|
</table>
|
71 |
|
|
<h1>Digital to NTSC Converter</h1>
|
72 |
|
|
<ul>
|
73 |
|
|
<li>See <a href="http://naturetm.com/?p=47">MSP430 project</a>.<br/><br/>
|
74 |
|
|
</li>
|
75 |
|
|
<li>See
|
76 |
|
|
<a href="http://www.batsocks.co.uk/readme/video_timing.htm">timing and sync</a>
|
77 |
|
|
for source information for the above.<br/><br/>
|
78 |
|
|
</li>
|
79 |
|
|
</ul>
|
80 |
|
|
</body>
|
81 |
|
|
</html>
|