Decided to start making good use of my "Propeller Professional Development Board" (PPDB) which has been sitting sadly idle and forlorn on the bench for a while.
Set a goal of making a simple video game with some of the advanced features available on the Propeller and this great dev board.
The first thing I wanted to get working was the bank of six 17-segment LED digits. It would be neat to have the player's score show up in the LEDs as well as any "Insert Coin" or "Game Over" messages.
Due to the Propeller P8X32A chip's eight CPU cores (each running at 20MIPS) I figured upon the following distribution of work between the cores...
Cog 0: low-speed tasks such as user input, LED display, and system watchdog.
Cog 1: VGA video (resolution to be decided, maybe 800x600).
Cog 2: Game logic (snake, tetris,crysis 3).
Cog 3,4,5: Video scheduling
Cog 6: Audio output
Cog 7: Something similar to (but legally distinct from) "ambilight" functionality.
Today I wrote some simple PASM code that displays some arbitrary text on the 6 digits of the PPDB. I used a cascaded chain of three 74HC595 chift register chips to provide signalling to the 595s. Conveniently, the 595's have a neat feature that lets you control this entire multiplexing challenge using only three (count 'em) output pins from the Propeller chip. I used one output to control the "nG" (enable output) line, another pin to provide the "SI" (serial input) to the shift registers and a third output pin to clock RCK and SCK simultaneously.
Three output pins to drive 102 LEDs at high speed. And it looked fantastic too. A little too fantastic really. The Propeller chip is so fast that it can easily generate smooth light patterns on the 6-digit display. I'm going for a retro feel to this game so I felt that it would be cool to make the 6-digit display flicker in some jittery manner that might give the impression of old VFD displays. The smooth pattern seems to be a bit lacking in the "retro" feel I'm looking for.
I contrived to add this retro effect by deliberately introducing some pseudo-random interruptions to the 6-digit display code. By using the Propeller's 32-bit clock counter register, shifted, truncated and masked (all arbitrarily) and mixed with the code that decides which LED is lit at the next cycle, it was possible to generate a pattern that causes a nice pulsating effect that gives the impression of a cheap, underpowered display driver on a cheap game system.
Unfortunately, I couldn't capture this pulsing, strobing effect on my crummy Samsung camera because the Propeller's output frame rates are too high to register on the camera's preview.
It does look pretty cool to the naked eye though.
Here's a still of the cool blue LEDs...
http://farm4.staticflickr.com/3810/8989256270_2687b17b62_o_d.jpg
CODE: https://dl.dropboxusercontent.com/u/24469109/randomblogcrap/ppdb17segmentspasm/17-segments.spin
Craply rendered schematic: https://dl.dropboxusercontent.com/u/24469109/randomblogcrap/ppdb17segmentspasm/schematic_17-seg.png
Set a goal of making a simple video game with some of the advanced features available on the Propeller and this great dev board.
The first thing I wanted to get working was the bank of six 17-segment LED digits. It would be neat to have the player's score show up in the LEDs as well as any "Insert Coin" or "Game Over" messages.
Due to the Propeller P8X32A chip's eight CPU cores (each running at 20MIPS) I figured upon the following distribution of work between the cores...
Cog 0: low-speed tasks such as user input, LED display, and system watchdog.
Cog 1: VGA video (resolution to be decided, maybe 800x600).
Cog 2: Game logic (snake, tetris,
Cog 3,4,5: Video scheduling
Cog 6: Audio output
Cog 7: Something similar to (but legally distinct from) "ambilight" functionality.
Today I wrote some simple PASM code that displays some arbitrary text on the 6 digits of the PPDB. I used a cascaded chain of three 74HC595 chift register chips to provide signalling to the 595s. Conveniently, the 595's have a neat feature that lets you control this entire multiplexing challenge using only three (count 'em) output pins from the Propeller chip. I used one output to control the "nG" (enable output) line, another pin to provide the "SI" (serial input) to the shift registers and a third output pin to clock RCK and SCK simultaneously.
Three output pins to drive 102 LEDs at high speed. And it looked fantastic too. A little too fantastic really. The Propeller chip is so fast that it can easily generate smooth light patterns on the 6-digit display. I'm going for a retro feel to this game so I felt that it would be cool to make the 6-digit display flicker in some jittery manner that might give the impression of old VFD displays. The smooth pattern seems to be a bit lacking in the "retro" feel I'm looking for.
I contrived to add this retro effect by deliberately introducing some pseudo-random interruptions to the 6-digit display code. By using the Propeller's 32-bit clock counter register, shifted, truncated and masked (all arbitrarily) and mixed with the code that decides which LED is lit at the next cycle, it was possible to generate a pattern that causes a nice pulsating effect that gives the impression of a cheap, underpowered display driver on a cheap game system.
Unfortunately, I couldn't capture this pulsing, strobing effect on my crummy Samsung camera because the Propeller's output frame rates are too high to register on the camera's preview.
It does look pretty cool to the naked eye though.
Here's a still of the cool blue LEDs...
http://farm4.staticflickr.com/3810/8989256270_2687b17b62_o_d.jpg
CODE: https://dl.dropboxusercontent.com/u/24469109/randomblogcrap/ppdb17segmentspasm/17-segments.spin
Craply rendered schematic: https://dl.dropboxusercontent.com/u/24469109/randomblogcrap/ppdb17segmentspasm/schematic_17-seg.png