Create your own video game with the SX-Tech or PDB
![Bean](https://forums.parallax.com/uploads/userpics/855/n505WZVEIPHT1.jpg)
INTRODUCING THE: Mere Mortal Video Game Driver
Okay, I've been working on the video driver for quite awhile. And now that SX/B 1.51 is out I've gotten around to testing it.
All you need is 4 resistor (470 Ohm,·1K, 1K, 22K) and buttons for Up, Down, Left, Right and Fire.
You have a screen of 16h X 11v tiles.
All video and sound generation is done by an interrupt routine. You don't need to worry about ANY of that. This driver allows "Mere Mortals" to write video games for the SX.
If you written games on a ZX81, TI994a, C64 or any of the 1980's computers you will have a good idea how this works.
Look at the mmvgd.sxb file to see how to connect everything. It's quite simple. Then load one of the demo games (Pong, Driver, or Flip-it) to see how they work.
The driver has some very handy routines. 4 way scrolling and routines to increase or decrease a value on the screen (score, timer, ect).
Check it out and please ask if you have any questions...
[noparse][[/noparse]edit] Updated to version 1.1. Changed timing to work with LCD displays, and added PAL video support.
Bean.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
Post Edited (Bean (Hitt Consulting)) : 8/14/2006 12:37:43 PM GMT
Okay, I've been working on the video driver for quite awhile. And now that SX/B 1.51 is out I've gotten around to testing it.
All you need is 4 resistor (470 Ohm,·1K, 1K, 22K) and buttons for Up, Down, Left, Right and Fire.
You have a screen of 16h X 11v tiles.
All video and sound generation is done by an interrupt routine. You don't need to worry about ANY of that. This driver allows "Mere Mortals" to write video games for the SX.
If you written games on a ZX81, TI994a, C64 or any of the 1980's computers you will have a good idea how this works.
Look at the mmvgd.sxb file to see how to connect everything. It's quite simple. Then load one of the demo games (Pong, Driver, or Flip-it) to see how they work.
The driver has some very handy routines. 4 way scrolling and routines to increase or decrease a value on the screen (score, timer, ect).
Check it out and please ask if you have any questions...
[noparse][[/noparse]edit] Updated to version 1.1. Changed timing to work with LCD displays, and added PAL video support.
Bean.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
Post Edited (Bean (Hitt Consulting)) : 8/14/2006 12:37:43 PM GMT
Comments
Post Edited By Moderator (Bean (Hitt Consulting)) : 7/31/2006 1:04:12 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
Having video output code as an option on the SXes is a wonderful contribution.
One really has to want to study quite a bit to get started from scratch with video.
This really offers using old TVs and Monitors as workbench devices or home control stations.
I have a project that I need to get started, a frequency counter. I was just looking as some frequency counter code and apparently the SXes will count 50Mhz with +/- 4 hz resolution by using the RTCC pin. That is a $3 chip instead of the Propeller which is a $25 chip.
I was wondering if I had an LCD that would clearly display that all those digits [noparse][[/noparse]10 digits wide with commas].
On the other hand, video can often handle 25 lines of 40 characters each.
And I can add title and read it without my glasses. I can add menus too.
Actually you are being quite generous as you might keep all that knowledge to yourself and just tout your board which can do this and a bit more. With including a serial interface in the program , I can have BasicStamps doing all sorts of thing that I can watch.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"If you want more fiber, eat the package.· Not enough?· Eat the manual."········
Post Edited (Kramer) : 8/1/2006 2:22:21 PM GMT
Thanks.
The driver, support routines, and the two tile pattern tables take up only 1K of code space. Leaving 1K for the user.
This also shows how using LOAD can hide alot of uglyness from projects.
Next step....Space Invaders...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·
It's a simple sketch program.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
This looks very nice. However let me provide some user feedback and questions.
1. When I first connected it I saw no video. I soon realized that I required· a 20 MHz resonator (external). This brought the video up.
2. You state in the title that this will work with the PDB. However, when I used the 8 pushbuttons (with 10K tied high) and 220 ohm resistors going to the pins it made me wonder if this was incorrect. I saw no movement on the video display when pushing the buttons. Can you confirm that we should NOT use the X9 Pushbuttons on the PDB and use only·8 individual (no resistors) pushbutton switches?
3. The Sketch program sort of worked with the PDB X9 (8) push button switches (with 10K and 220 ohm resistors tied in on the PDB). I was able to see the small block flash off / on as it moved left/right/up/down. Is this the correct response or a result of using possibly wrong pushbutton settup on the PDB?
All in all great! Please confirm my suspicion about not being able to use the PDB X9 pushbutton switches (because of the resistors).
Thanks.
2) Hmmm, either buttons should work. The program enable the SX pullups but an additional 10K shouldn't matter. The 220 ohm in series shouldn't matter either.
3) You need to press the "fire" button (RA.2) to draw/erase. (Please download again, I accidentally uploaded an old version the first time).
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·
Thanks for the updated program. I went back and checked all my connections and they look good.
1. I still require a 20 MHz resonator on the PDB for the video to be displayed. It does·NOT work for me with only the SX-Key' oscillator (which mine is fairly new).
a. SX-KEY and no on board resonator - No Video displayed.
b. SX-Key and a 20 MHz on board resonator - Video displayed.
c. No SX-Key and a 20 MHz on board resonator - Video displayed.
c. No SX-Key and no on board resonator - No Video displayed.
Programs do take a little long to download that I am accounting for the 1K+ of program(s) to download.
2. When using a 20 MHz resonator for video display to work, the Sketch program allows the Joystick 1 up/down/left/right buttons to move a flashing small square around the screen. I did not see any effect when pressing the Joystick 1 "fire" button to draw or erase (I used a separate {non PDB pushbutton} between RA.2 and ground). All I get is a moving flashing square - no line tracing or line erasing or anything else. I don't know if that is the expected result or not. This happens with the old·code and the new code. {{BTW: Was the new code you mentioned only the MMVGD program or all the programs - Drive, Pong, etc.}}
3. When using a 20 MHz resonator for video display to work, no·other programs (old or new) show any signs of Joystick 1 or 2 up/down/left/right button or "fire" button action - no movement just video displayed.
4. Check your comments in your programs as some of them may not show the·correct version number of SX/B (not 1.51) such as 1.43, etc.
Anything else I should look at. It is pretty straight forward in the connections. X9 connections 7..0 to the appropriate SX-28 pins. I have also tried (2) SX-28 IC's. I used a separate individual pushbutton (radio shack)·from ground to RA.2 for the·fire button. I have·no fire button for Joystick 2·- but this should not matter. I know the video connections are correct going to the SX-28 otherwise I would not have any video (when using a resonator). Other than that there are not any connections left to check.
What else should I look at next?
Thanks.
2) It was just Sketch.SXB that was new.
3) Can you try a different SX chip ? Maybe bad port pins or something ? I'm at a loss ?
4) Will do...
When I get home I'll take a picture of my setup. I'm using an atari joystick that I cut the DB9 off and just soldered the wires to header pins. But I was using the PDB buttons before I did that.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·
I have the SX-Key not the Blitz (which does work in Debug mode) to step, walk and run through debuging).
I did not try the new Sketch program. I will try that tonight.
I stated in my last posting that I did try 2 different SX-28 ICs. However, I will try another one too.
I have recently modified the SX/B example 4x4 matrix keypad program to work with an old Radio Shack 3x5 matrix keypad that I have. I will try this out tonight which should exercise all of the SX-28 pins. However, I beleive this should be ok.
BTW: Where can I get an Atari joystick? I like this better than using the PDB buttons.
Thanks.
It's sounded like maybe you had a some bad pins. Try measuring the voltage. It should be pretty close to +5 when the buttons is NOT pressed. And should go pretty much to 0 when the button is pressed.
The easiest way is to buy an "Atari Flashback 2". It's about $30 and has 2 atari joysticks. Other than that E-bay is the cheapest.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·
Here is an update:
I checked all the pins (RB0-RB7, RA2 and RA3) on the SX-28 itself (pins 10-17, 8 and 9) AND on the PDB socket for close to 5v and using the PDB X9 buttons, get 0v when pushed. This acts as expected. I have checked the Audio out and heard it on PONG so this works.
I ran the SX-key through the DEBUG and it works ok (idle, walk, run, etc). However, I·ALWAYS have to have a resonator installed to see the video displayed.
The new Sketch program does allow me to draw and erase and move it up/down/left and right.·This program appears to·work.
The Flip it program works up/down/left/right and fire. This program appears to work.
The Pong program works for up/down as expected. This program appears to work.
On the Drive program - it did not· work for any of the up/down/left/right buttons only fire (RA.2). However, after loading in all the programs a few times, it started to work for left/right and fire which is probably the expected keys (up/down? - I don't know). Anyway perhaps the SX-28 needed to be "flushed out" or something. All is working with the exception of the needing to have a resonator to see video.
Ideas? Comments?
Thanks.
Program with the SX-Key.
Press Ctrl-K to bring up the SX clock configuration dialog.
Make sure the "On" check box is marked. (it's near the bottom).
Type in "20" in the input line and press TAB.
Does it work now ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·
Enjoy.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
cheers ... brian riley, n1bq, underhill center, vermont
See the K107 Serial LCD Controller at
www.wulfden.org/k107/
Absolutely. And you could have more tiles on the screen. I would think 24h x 16v should be doable. Plus you would have 3x the code space for your game (3K vs 1K).
I was originally going to do that, but I figured the XGS is already out. Of couse this would be much cheaper.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·
CHEAPER????? - You cannot even begin to put an SX28 proto board together for the price of the SX48 proto board! The SX48 board is the best bargain and most incentive to do SX work going. I keep wishing I had more time to play with it. But what you have done here has given me reason to steal some time from my Propeller Robot Controller time ... I see this Game Framework, for lack of a better term, that you have given the SX world as a Framework for developing less frivolous apps, not sure what yet,but it will occur to me.
Bean, you really need to learn how to stand up take your well earned bows more often!!!!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
cheers ... brian riley, n1bq, underhill center, vermont
See the K107 Serial LCD Controller at
www.wulfden.org/k107/
There was talk of a $9.95 SX28 proto board. I'm not sure what happened to that ?
I will start working on a SX48 version. I'm not sure I can get 24 tiles across @ 20Mhz, I may have to increase the clock.
I was asked about a year ago to make a video display for boyscout pine car races. Basically time the cars as they ran and show the winner. That would be pretty easy with just some IR sensors at the start and end of the track.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·
I was away this weekend enjoying Gatlinburg, TN and Pigeon Forge, TN (Dollywood) with the family and was not able to get back to you sooner. BTW I have relocated to KY for my job from MD a couple of months back. My email has changed to charter.net from comcast.net as to be noted on your SXVM site.
Anyway, I changed the Ctrl-K and it was set to .400 MHz (400 KHz). When I entered in 20 MHz, the video turned on (no resonator). I love the SX Invaders.
BTW: I stoped at the Great Smokey Mountains Flea Market this morning on the way home and found an orginal Atari joystick for $15 because he said they were hard to get. I will use an RS-232 connector tomorrow night and try it out on my PDB.
Thanks again - All is working.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Is there any way the Parallax LCD Character Creator (Windows software - used to generate Hex code for LCD characters) could be modified or used for the SX game character coding? I'm thinking probably not. Any thoughts on this?
Thanks.
http://www.sxlist.com/techref/datafile/charsets.htm
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
James Newton, Host of SXList.com
james at sxlist,com 1-619-652-0593 fax:1-208-279-8767
SX FAQ / Code / Tutorials / Documentation:
http://www.sxlist.com Pick faster!
This should help. I even saw an interesting link about the creation of the Alphabet which was neat to watch. Thanks!
On another note...I am thinking more about the limited memory in the SX-28·having only·1K left for games. If one wanted to choose (like in a game selection switch or something) which game they wanted to play, which method (if doable) would make more sense:
1. Program all the games into 1 SX-28 or SX-48(?). How about using an external·larger EEPROM to store and call each game as needed? I'm not sure if this would work as the EEPROM can only store data not program information that needs to be compiled first to the SX-28.
2. Simply allow the user to reprogram the chip as needed (simplest approach - but the user would have to wait for the download and have an SX-Key).
3. Have many SX-28's linked together (with individual games loaded in each) and switched on as needed though a menu calling master SX-28 (or some variation).
Thanks.
2) Would be nice because the user could make their own games and/or modify the games (cheat). But would be fairly expensive and the user would need a PC.
3) Would be the most practical for a small number of games. You could simply connect the MCLR pin of the "game" SX chips to output pins of the "menu" sx chip. Only if MCLR is high will that SX run.
BTW: I'm working on making the driver work with PAL also (require recompile though). Also the timing has been tweaked because some LCD video screen would not work. I will post it later this week.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·
http://forums.parallax.com/showthread.php?p=600796
In your SX-Invaders code, (Start section):
Start:
· ' Start game here
··
· ' Setup top line "· SCORE 000000· "
· '··········· SC·· OR·· E_·· 00·· 00·· 00·· _M·· MM··· (_ = space)
· PUT vLine0, $AB, $0C, $DF, $00, $00, $00, $FE, $EE
Can you explain where the Hex code refers back to? Is there a table or something listing this?
Thanks.
I think I figured out how the Hex code refers back. However, how did you create the characters? Do you have a 8x8 character set generator program like the Windows LCD one by Parallax? I haven't been able to find one on the internet for 8x8 providing decimal output for the DATA strings. I guess I could do it on paper or program my own, but I don't want to re-invent the wheel if something is already out there.
Thanks.
It's on the very first post in this thread.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·