pong game for C3
ersmith
Posts: 6,099
In honor of the new PropGCC alpha release, here's a simple version of "pong". It's rather trivial -- you just have to hook buttons up to pins 4, 5, 6, 7 (selectable in the code). Pin 7 controls left paddle up, pin 6 is left paddle down, similarly pins 5 and 4 control the right paddle. Output is to a VGA at 640x480 (the bitmap is 160x120 and scaled up). The source code is currently set up for the C3 board, but it should be easy to adapt to other boards.
The game itself isn't much, but it only takes up one COG (all game logic and video output code fit in the same COG's internal memory). I do admit to having "cheated" a bit by putting 64 bytes of character data (for the score digits) in hub memory, and of course the frame buffer is in hub memory too.
Oh, and it's all written in C. There's a Makefile, but you really don't need it. To compile just do:
There's now an alternative to PASM for writing COG drivers.
Eric
The game itself isn't much, but it only takes up one COG (all game logic and video output code fit in the same COG's internal memory). I do admit to having "cheated" a bit by putting 64 bytes of character data (for the score digits) in hub memory, and of course the frame buffer is in hub memory too.
Oh, and it's all written in C. There's a Makefile, but you really don't need it. To compile just do:
propeller-elf-gcc -mcog -Os -o pong.elf pong.cwith the most recent PropGCC alpha release.
There's now an alternative to PASM for writing COG drivers.
Eric
Comments
Awesome!
Looks like I'm having Pong with my coffee tomorrow morning!
I know what I'll be playing with this weekend.
OBC
Thanks, Kye, but I owe much of the game to your PIX demo video driver. It was very nicely written, and easy to port from PASM to C. Once I had C code it was pretty straightforward to add in more features (like pong :-)).
Eric
Since VGA was declared impossible and was achieved within just
a few days, maybe we should declare some other things impossible.
TV anyone?