The AtariVox is built around 2 main components:
- The SpeakJet chip, which is responsible for the Voice Synthesis.
- The EEPROM chip, which allows game data to be loaded or saved.
In this thread I'll just address using the AtariVox's EEPROM. I'll start a separate thread about the voice capability another time.
The AtariVox EEPROM is separated into 3 different areas:
- The Static Area. This is quick and simple, but you must reserve a location from Richard Hutchinson.
- The Scratchpad Area. This area is similar to the Static Area, except you can do what you like here. Another game may also do what it likes here, so you can't expect any data stored in the Scratchpad to survive after the atari is shut-off.
- The Filesystem Area. You chose your own unique filename for storage in this area, and you may do what you like with the file. Unless another game chooses the same filename, your game's data won't be overwritten by other games.
AvoxEEPROMMemoryMap.txt 987bytes 185 downloads
Learn By Example
The easiest way learn how to use the Static Area and Filesystem Area is to look at the commented examples I've attached. They show how to write a single byte to each area, and how to read it back...
avoxeeprom-static-area.20110209.zip 4.5KB 180 downloads
avoxeeprom-file-area.20110209.zip 6.18KB 167 downloads
...please note that the provided examples are bundled with 2 assembly modules, i2c.inc and bbavox-eeprom-*.asm. The first is the official AtariVox i2c driver, and the second is higher level code for interfacing with bB, written by myself.
Both of these files should be placed in the same directory as the basic program you'll be working with.
Points Worth Noting
While using the AtariVox EEPROM is fairly easy, there are a few things to keep in mind:
- it's a bad idea to write to the EEPROM continually. (eg. every frame)
Like most flash devices, the EEPROM can only be written to a limited (but very large) number of times. [contributed by cd-w]
It's also worth noting this isn't true of Stella, which uses a file to emulate the EEPROM. [contributed by stephena]
- the EEPROM is quite slow, so the bB routines have been written with that in mind. You need to read or write just a single byte between drawscreen commands. If you fail to do this with reads you'll blow the scanline count, and if you fail to do this with writes the writes will fail and you'll blow the scanline count.
Even when you're doing that, you won't have a whole lot of cycles left for other things; it's probably a bad idea to read/write EEPROM in your main game loop.
- For Static Area access, when your game is nearly done you should request an official memory location from Richard H.
When you just start your game, feel free to instead access the Scratch Area $3000-$3FFF. Do NOT request a memory location until your game is very nearly done.
- the provided bB Static Area functions force your read/write requests to use the scratch area, even when you tell them to use another location, so a bug won't destroy real saved data.
When you have been provided a location by Richard, to get your code to use it you'll need to add the line "const AVoxSafetyOff=1" to your code, which disables the safety mechanism.
- To test this in stella, you need to modify the "game properties->controllers" dialog so a virtual AtariVox is plugged into the right controller port. You'll need to do this each time you change your game, because stella will think it's a new program after the change.
If you launch stella from command-line, you can also tell it to start with its virtual AtariVox plugged in:
stella -rc atarivox <romfile> (or with a physical AtariVox plugged into your coputer: stella -rc atarivox -avoxport COMx <romfile>, where x is the commport number) [contributed by cd-w and stephena]
- The SaveKey by CPUWIZ is functionally equivalent to the AtariVox EEPROM. If your code works with one, it should work with the other.
AtariVox is the creation of Richard Hutchinson, and the drivers were created by Alex Herbert. All thanks and credit should go to these guys!
Please report any bugs or problems with the example code in this thread.