laserhawk64
Senior Member
Hello all!
This is my second or third one of these. Hey, at least I don't post terribly often!
I came across an article about this on HackADay: http://www.hive76.org/the-no-video-game
Recently I thought... hey, I wonder if I could make one of these? ...and my spare Picaxe 08M starter kit came to mind (purchased from SparkFun back when they came with the cables...). I would definitely be replacing the chip in question with a 08M2.
Here's what I want to do:
Input would be five buttons, run through a 74165 shift register (sorta like on the NES -- same idea, different chip).
There would be three outputs -- two LEDs (one red, one green) and a spare PC speaker (8ohm, 1/2w max, 2"dia, from the paleocomputing era of about the mid '90s). I know dang well enough to put a transistor (2N2222?) between the Picaxe and the speaker! I'll also put transistors on the two LEDs, just to be safe (they're 20ma exactly, and I don't want to push my luck).
So the pinout would be...
C.0 - "keypad" read enable
C.1 - green LED
C.2 - speaker
C.3 - "keypad" data
C.4 - red LED
C.5 - "keypad" sync (clkin from '165 and keypad clock source)
Gameplay would be fairly similar to the device in the link -- a series of beeps to simulate sonar; as the two submarines get closer, the beeps get more frequent (and less frequent if the player distances him/herself from the enemy sub). The player moves around via four directional buttons -- the traditional up/down/left/right directional pad sort of setup. The fifth button is a 'fire' button that sets off the depthcharge/bombthingy. When the 'fire' button is pressed, the LEDs both flicker (or blink, doesn't matter) and an explosion sound is played (sort of like the white-noise-inspired 8 bit 'explosions' you'd expect from an arcade game). This sound/flicker has a duration of about 2 seconds, and then the outcome is displayed -- green, enemy sub destroyed (game won); no LED, enemy sub intact. The enemy sub, if it gets close enough, will set off its own depthcharge/bombthingy, with similar effects but a slightly different possible readout -- red, player sub destroyed (game lost); no LED, player sub intact.
If either virtual sub is destroyed, the game is (obviously) over and nothing happens (except that the respective LED stays lit) until the player hits a reset button that cycles the power, or turns the game off completely.
I want to do the sounds as PWM or sound commands (probably will need to do straight PWM for the explosion effect). The SpeakJet is way overpriced for what I need at US$25 (SparkFun) and I can't easily locate another sound chip. I don't really need one anyways, as long as I can do this.
I have a couple of concerns, though, which is why I'm posting this...
(1) will a Picaxe 08M2 be able to do all that PWMing acceptably well for this game?
(2) to make the 74165 do its thing, I need to be able to output a 'clock' frequency that is at least compatible with that of the 08M2. Can I do this with the 08M2? It doesn't have to be 4MHz. It probably would be just fine at 40Hz. I just need to be able to output that.
(3) I'm sure there are other issues I'm not thinking of. If you folks could inform me of other problems I might have, that would be great.
Thanks, folks!
EDIT: made a goof already. Obviously I can't output anything on an input-only pin! So what I'm thinking is an external-to-the-chips 40Hz clockpulse generator, and outputting the signal to both chips to sync them together. This brings up a new question...
(2a) would the 08M2 be able to accept a square-wave (clock) input to sync with the '165?
Also, drawing up a prototype schematic diagram right now. I'll upload it when I can; might be tonight, might be tomorrow.
This is my second or third one of these. Hey, at least I don't post terribly often!
I came across an article about this on HackADay: http://www.hive76.org/the-no-video-game
Recently I thought... hey, I wonder if I could make one of these? ...and my spare Picaxe 08M starter kit came to mind (purchased from SparkFun back when they came with the cables...). I would definitely be replacing the chip in question with a 08M2.
Here's what I want to do:
Input would be five buttons, run through a 74165 shift register (sorta like on the NES -- same idea, different chip).
There would be three outputs -- two LEDs (one red, one green) and a spare PC speaker (8ohm, 1/2w max, 2"dia, from the paleocomputing era of about the mid '90s). I know dang well enough to put a transistor (2N2222?) between the Picaxe and the speaker! I'll also put transistors on the two LEDs, just to be safe (they're 20ma exactly, and I don't want to push my luck).
So the pinout would be...
C.0 - "keypad" read enable
C.1 - green LED
C.2 - speaker
C.3 - "keypad" data
C.4 - red LED
C.5 - "keypad" sync (clkin from '165 and keypad clock source)
Gameplay would be fairly similar to the device in the link -- a series of beeps to simulate sonar; as the two submarines get closer, the beeps get more frequent (and less frequent if the player distances him/herself from the enemy sub). The player moves around via four directional buttons -- the traditional up/down/left/right directional pad sort of setup. The fifth button is a 'fire' button that sets off the depthcharge/bombthingy. When the 'fire' button is pressed, the LEDs both flicker (or blink, doesn't matter) and an explosion sound is played (sort of like the white-noise-inspired 8 bit 'explosions' you'd expect from an arcade game). This sound/flicker has a duration of about 2 seconds, and then the outcome is displayed -- green, enemy sub destroyed (game won); no LED, enemy sub intact. The enemy sub, if it gets close enough, will set off its own depthcharge/bombthingy, with similar effects but a slightly different possible readout -- red, player sub destroyed (game lost); no LED, player sub intact.
If either virtual sub is destroyed, the game is (obviously) over and nothing happens (except that the respective LED stays lit) until the player hits a reset button that cycles the power, or turns the game off completely.
I want to do the sounds as PWM or sound commands (probably will need to do straight PWM for the explosion effect). The SpeakJet is way overpriced for what I need at US$25 (SparkFun) and I can't easily locate another sound chip. I don't really need one anyways, as long as I can do this.
I have a couple of concerns, though, which is why I'm posting this...
(1) will a Picaxe 08M2 be able to do all that PWMing acceptably well for this game?
(2) to make the 74165 do its thing, I need to be able to output a 'clock' frequency that is at least compatible with that of the 08M2. Can I do this with the 08M2? It doesn't have to be 4MHz. It probably would be just fine at 40Hz. I just need to be able to output that.
(3) I'm sure there are other issues I'm not thinking of. If you folks could inform me of other problems I might have, that would be great.
Thanks, folks!
EDIT: made a goof already. Obviously I can't output anything on an input-only pin! So what I'm thinking is an external-to-the-chips 40Hz clockpulse generator, and outputting the signal to both chips to sync them together. This brings up a new question...
(2a) would the 08M2 be able to accept a square-wave (clock) input to sync with the '165?
Also, drawing up a prototype schematic diagram right now. I'll upload it when I can; might be tonight, might be tomorrow.
Last edited: