Thursday, May 17, 2007

Game load and save

Mame has an option that allows you to load and save games.
From the keyboard, pressing SHIFT and F7 allows you to save a game to a location.
The location can be just about any key on the keyboard, except player one controls.
Pressing just F7 by itself allows you to load the game back in from the location it was saved to earlier.

This is a pretty nice option, but it does have a few drawbacks.
First, it doesnt work with all games, but it does work with most.
Second, you have to remember which button you saved the game to. A way around this is for each player to pick a certain button (such as player 1 start) to keep his (hers) game at, and keep this selection.
Also, if someone saves the same game to the location (button) you picked, your saved game will be over written. But different games can be saved to the same location.
But it is neat to be able to save games. I have thought this since the early 90's, when I saved my progress with Doom and Duke Nukem. (Ahh, the classics..)

So I decided that The Rage would have a save and a load button.
This is my first machine to have this option.
The problem I had to solve was how to do this.

The keywiz keyboard encoder has an input for the left shift key.
This is also the player 1, action button 4.
But the encoder's default mapping does not include the F7 key.
I got around this by downloading a program called "The Keywiz Uploader".
This program is a free download and is available from the groovy game gear website.

The Uploader allows you to change the key map of the encoder.
I re-mapped the "H" terminal from the default "L" to "F7".
I then connected the "H" wire from the encoder to the "Game Load" button on the control panel.
So to activate the load function, all you have to do is press the "Game Load" button.
But how to use the save game function?
Well, I accomplished that by wiring the "Save Game" button to both the player 1 action 4 button (shift) and the "Game Load" button (F7).
I used diodes to block the signals so that pressing player 1 action 4 button doesnt open the save or load functions.
A diode blocks current flow in one direction, but allows it to flow in the other direction. Think of it as a one way check valve.

Here is a diagram of how I hooked it all up:

Pressing P1 Action4 button connects terminal 4 of the encoder (left shift) to the ground, activating the left shift input. Diode 1 blocks the current flow from the other switches.
Pressing Game Save Button allows current to flow from ground, through Diode 1 to the Left shift input. The current also flows through Diode 2 to activate the F7 input. This has the same affect as pressing the left shift key and the F7 key. (This activates the save game option).

Pressing "Game Load" button connects the ground to the F7 input.
Diode 2 blocks the current flow from the left shift input. So this has the same affect as pressing only the F7 key. (This activates the game load option).

Just about any general purpose diode should work. I used 1-amp rectifier diodes from Radio Shack.
I bought a pack of 25 assorted 1-amp diodes, Radio Shack # 276-1653.
-------------------------------

No comments: