PROP2 Invaders - 1 Cog (Now with sound effects!)
ozpropdev
Posts: 2,792
Hi Guys
Here is my demo program for the Propeller 2.
It is a implementation of the old Space Invaders game.
It was developed on a DE0-Nano FPGA board so it uses only 1 Cog!
It uses the multitasking feature to generate video, game byte-code interpreter and a full duplex(115200 baud) diagnostic terminal.
The terminal displays live game data as well as supporting some simple diagnostic functions.
Video is VGA 800x600
Sound effects are generated using a 4 bit resistor ladder. (P5-P8) P5 is LSB
Diagnostic monitor now runs @ 1M baud
Enjoy!
Cheers
Brian
Update: 31st October 2013 (Obsolete 27th Nov 2013 - New FPGA release)
Version 1.61 - Single game variants for DE0 and DE2
Version 1.62 for DE2 - 4 game variant
Update: 20th Jan 2014
See latest post #88
Here is my demo program for the Propeller 2.
It is a implementation of the old Space Invaders game.
It was developed on a DE0-Nano FPGA board so it uses only 1 Cog!
It uses the multitasking feature to generate video, game byte-code interpreter and a full duplex(115200 baud) diagnostic terminal.
The terminal displays live game data as well as supporting some simple diagnostic functions.
Video is VGA 800x600
Sound effects are generated using a 4 bit resistor ladder. (P5-P8) P5 is LSB
Diagnostic monitor now runs @ 1M baud
Enjoy!
Cheers
Brian
Update: 31st October 2013 (Obsolete 27th Nov 2013 - New FPGA release)
Version 1.61 - Single game variants for DE0 and DE2
Version 1.62 for DE2 - 4 game variant
Update: 20th Jan 2014
See latest post #88
Comments
C.W.
That VGA driver looks suspiciously short... and all in 1 cog... I want a prop 2...
Very nice use of the hardware threads.
Did you max out the cog RAM? What's the total footprint in hub RAM? No need to respond. I will see these things when I run it.
(Don't have a Nano... *Sigh* )
Do you have sound, also?
Thanks for all the feedback.
I had planned in having sound as well but I was overloading Hub access already.
The idea was to stream data to 1 of the Dac's.
As I was experiencing a bit of pipeline stall I had to scrap sound.
The question on the game controller, I am using the 3 buttons on the add-on board at the moment.
I'm working on some additional notes on how it all works today. I'll post it ASAP.
Chip,I'm going over the final resource usage today so all will be revealed soon.
I suspect some of my pipeline issues will disappear on a real chip at full speed.
I could go to a higher VGA resolution without using any more cogs.
As I only have 1 cog in my emulator and 32k hub ram not 128k, I held back to allow for a larger program.
I believe the real chip could do it easily on 1 Cog as well !
Looks like I might have to do a version 2.0 later, but this will have to wait a while because I'm still
seeing ALIENS in my sleep!
Cheers
Very Impressive.
I added an updated version today with some notes.
Peter, I had a few sleepless nights dealing with 1 Cog!
Having 5 cogs in a DE2 would be great... but 8 in a real device.... AWESOME!
Cheers
Brian
Seriously, write a book. Not a chapter in someone else's book... your own. Make the first couple of chapters an autobiography. Add in all the facts that you think are too basic to consider:)
What you have needs to be shared.
If you got into it, it would take you six weeks and be a best seller... at least on this particular forum:)
You might even get Chip to proof read it... what a hoot!
If you need a ghost writer, I'm guessing you could get some eager help from the writers at Parallax.
Congratulations... quite a remarkable piece of work... not that I understand it (of course:)
Rich
I guess my autobiography would read the same as most of the guys on this forum.
Started in the late 70's, spent long hours hacking code while consuming huge quantities of caffeine and soda.
Load music bouncing of the walls and all flat surfaces covered in paper,books,electronics and junk food!
Good times....
In my case the only 2 differences would be geography (Down Under) and that I have been legally blind for 25 years.
The later hasn't stopped me from hacking code or drinking coffee,load music etc.
It does make debugging code a little more interesting.
At the end of the day a "bug" is the same whoever created it!
As for a book, I had never really thought about that before. If there was enough interest shown I would be open to the idea.
After all it's just more typing!
Thanks for the encouragement.
You've got me thinking
Cheers
Brian
I am retired now, but when I first began practicing ophthalmology, one of my legal duties was to inform patients that they could no longer drive, due to their poor vision.
The first time I did this, the nice old man that I "informed" went home and shot himself. So, I didn't do that anymore.
It would have been much better to tell the nice man to go home and read your book, while he still could.
Rich
Very nice work by the look of it
cheers
Lachlan
You would have to tap into the board to get TX,RX and RESN and GND signals. You would most likely have to cut the RESn signal to the Prop1 as well, to stop it responding to downloads.
To generate the video signals you will have to duplicate the DAC circuitry of the Add-on boards.
Refer to the DE0/DE2 post(sticky) at the top of the forum for more info.
Hope this helps
Cheers
Thanks Potatohead.
Hopefully Chip can run it on a real Prop2 soon.
He mentioned today that they are due back from packaging soon.
All fingers and toes crossed.
Cheers
Brian
I just updated to version 1.42.
Fixed a few bugs and added a demo mode for the DE2 people without buttons on their add-on boards.
Cheers
Brian
I just tried the program on another screen than the 3 I tested on. (2 x LCD, 1 x CRT)
The pixel noise is a lot worse on this LCD screen.
How does it look on your screens?
If you remove the following bytes (there's 7 of them) from the game program at the end of the code it
will improve quality.
This disables Serial Tx but Rx still functions.
Cheers
Brian
I'm off to figure out the buttons and score you a picture of the display on my CRT VGA, which displayed it perfectly.
You did a great job capturing the flavor of the original Invaders. Very nicely done. I particularly like the saucer appearing on screen even as the player is done. Nice touch.
The only real artifact I see is the ship isn't always completely drawn each frame while in motion. Same for the saucer. There isn't any significant pixel noise on my CRT. If there is on other displays, it's highly likely to be timing related, where pixels are falling just inside of our outside of a quantized pixel boundary. That happens a lot on LCD displays. Rock solid on this one.
I was hoping no one would pick up on that before I fixed that!
Oh well, I guess I have to fix it now.
Glad to hear it runs on a DE2 board.
I had mot heard from anyone to verify that.
Good to hear it works Ok on your screen(s) too.
Thanks for the I/O assignments as well.
Cheers
Brian