Jump to content
IGNORED

Hacking for AtariVox


mos6507

Recommended Posts

I'm kind of surprised this hasn't been discussed earlier (or maybe it has).

 

I would like to gather a list of games that people might like to see hacked for added AtariVox support. Games that already have (volatile) high score tables might be good candidates even if they don't necessarily cry out for voice. Games that use both ports at once are a problem (like Wizard of Wor) otherwise 2P games would have to be altered to both access the same controller.

 

I'll start things off.

 

Coinop ports that had voice but aren't 2P simultaneous:

-------

Berzerk (already bumped a separate thread)

Gorf

Star Trek: Strategic Operations Simulator

Megamania could be hacked into Astro Blaster

Star Wars: The Arcade Game

Q-Bert

Reactor

 

Simulators that could have a chatty damage control computer:

-------

Starmaster

Robot Tank

Phaser Patrol

 

 

 

 

Anyone who hacks a game in order to be able to fit in speech gets a free AtariVox. Well, I guess they would need one to be able to hack it, but they get the NEW combo one if they do it ;)

Edited by mos6507
Link to comment
Share on other sites

  • 1 month later...

Is that really the way The Voice sounds on the O^2 or is that the emulator that makes it sound so rough? AtariVox is definitely better than that.

 

There is a TTS companion chip for Speakjet. If you wanted a speak and spell sort of thing you'd probably need that, or at least a big TTS dictionary in a banked ROM and some fast assembly code to scan through it.

Link to comment
Share on other sites

Thomas also posted an optimised version of the AtariVox i2c code.

I'm hoping you will be adding AtariVox speech to Duck Attack?

 

Chris

 

Thanks for the updated .inc link!

 

I would love to have some sounds in there (a nice robotic "duck in vicinity!" would be great) but I'm not sure if I have the byte-squeezing skills to pull it off. I'm going to play around and see if I can manage it, although I'm not optimistic since things are pretty darn tight as it is. (And I don't actually have an AtariVox, so testing would be tough.)

 

I did decide to add a "save game" feature, though, so that if you're wandering around on Level 14 and want to play something else for a while, you can save the game to the EEPROM and resume it later. That (and high score retention) will be in v0.09. Since Stella emulates that, testing should be straightforward (I hope).

 

--Will

Link to comment
Share on other sites

Ah perfect, that's exactly what I was looking for!

Thanks!

--Will

 

Thomas also posted an optimised version of the AtariVox i2c code.

I'm hoping you will be adding AtariVox speech to Duck Attack?

 

Chris

I just wanted to add that if you'll be using an AtariVox with Stella, you must use this latest optimized i2c code. Thomas released this new code in part because we found a bug when adding AVox support to Stella.

Link to comment
Share on other sites

I just wanted to add that if you'll be using an AtariVox with Stella, you must use this latest optimized i2c code. Thomas released this new code in part because we found a bug when adding AVox support to Stella.

 

Thanks for the heads-up. Out of curiosity, what was the nature of the bug?

 

--Will

Link to comment
Share on other sites

Thanks for the heads-up. Out of curiosity, what was the nature of the bug?

 

IIRC, the bug was only in the first optimised version that Thomas posted, not the original code (which is in the AtariVox docs above).

I think the bug was caused by an insufficient delay between i2c operations, but I can't remember properly now.

 

Chris

Link to comment
Share on other sites

Thanks for the heads-up. Out of curiosity, what was the nature of the bug?

 

IIRC, the bug was only in the first optimised version that Thomas posted, not the original code (which is in the AtariVox docs above).

I think the bug was caused by an insufficient delay between i2c operations, but I can't remember properly now.

 

Chris

I'm a bit vague on the details now as well, but it was related to asserting both the SDA and SCL lines at the same time. Basically, the code was generating a state that was invalid according to the specs of the I2C protocol. I suspect it probably worked on real hardware because one of the lines took priority over the other. But that's not something that can be depended on; it might fail on future versions of the hardware.

 

I didn't realize the original code worked. I do know that the AStar ROM doesn't work in Stella (wrt AVox support), and I thought the author used the original code. In any event, the very latest optimized code does work. If you're so inclined, perhaps you could test with the original and latest optimized i2c code. It would be nice to know if the original code actually works in Stella. If not, we should modify the documentation ...

Link to comment
Share on other sites

I just wanted to add that if you'll be using an AtariVox with Stella, you must use this latest optimized i2c code. Thomas released this new code in part because we found a bug when adding AVox support to Stella.

 

Well, I'm brand new to programming for the AtariVox, and I must be making a rookie mistake, although I don't know what it is.

 

I'm including Thomas's i2c_v2_2.inc, I'm using the example code from AtariVox.rtf EXACTLY as it's written, and I've got my ROM configured in Stella to look for the AtariVox in the right port (screenshot attached). But when the example code runs, the first jsr i2c_startwrite always returns with the carry flag set, which from the documentation means it was unable to communicate with the port.

 

buffer = $80

jsr	i2c_startwrite	; Start signal and $a0 command byte
bcs	eeprom_error	; exit if command byte not acknowledged

lda	#$01			; upper byte of address
jsr	i2c_txbyte
lda	#$40			; lower byte of address
jsr	i2c_txbyte

ldx	#$00
write_loop
lda	buffer,x		; get byte from RAM
jsr	i2c_txbyte		; transmit to EEPROM
inx
cpx	#$08			; 8 bytes sent?
bne	write_loop

eeprom_error
jsr	i2c_stopwrite	; terminate write and commit to memory


rts

 

Is there some initialization that I'm missing? Or a Stella configuration option I've missed?

 

--Will

post-23222-125996986377_thumb.png

Link to comment
Share on other sites

Is there some initialization that I'm missing? Or a Stella configuration option I've missed?

 

There is an option to use a real AtariVox in Stella (Input Settings -> Virtual Devs -> AVox Serial port), but I don't think this will interfere with the SaveKey stuff. Have you tried setting the right port to "SaveKey" instead? Do other games (e.g. Juno First) do their SaveKey saving and loading fine with this version of Stella? Could the stack pointer be overwriting something (e.g. the SaveKey temp variable) when you do the jsr? If it still doesn't work, you could post some more of your code here.

 

Chris

Link to comment
Share on other sites

There is an option to use a real AtariVox in Stella (Input Settings -> Virtual Devs -> AVox Serial port), but I don't think this will interfere with the SaveKey stuff. Have you tried setting the right port to "SaveKey" instead? Do other games (e.g. Juno First) do their SaveKey saving and loading fine with this version of Stella? Could the stack pointer be overwriting something (e.g. the SaveKey temp variable) when you do the jsr? If it still doesn't work, you could post some more of your code here.

 

Chris

 

Setting the P1 controller to SaveKey gives the same results. Juno First is working fine saving and retrieving its high scores, so Stella is able to read and write to the .dat file. The stack pointer is at $F7 when the SaveAndLoad_Main function (which contains the example code) is called, and drops to $F5 when the jsr i2c_startwrite is called; the temp variable is at $DD, so there shouldn't be a conflict there.

 

Here's how I'm calling it: the main game loop calls a joystick input function (PlayerMove, at $F374 in bank 7), which checks if the fire button is being pressed in the egg shelf room. If it is, it JSRs to the SaveGame function, which JSRs to the SaveAndLoad_Main function ($B9C3 in bank 3) which contains the example code. The first thing that function does is call jsr i2c_startwrite, which on return has the carry flag set. (And viewing the contents of the .dat file confirm nothing has been changed from all $FF's.)

 

When SaveAndLoad_Main returns, it puts the player in either the score room (if the carry flag is clear, meaning success) or the credits room (if the carry flag is set, meaning failure), and so far it has always done the latter.

 

--Will

DUCKNTSC.BIN

Link to comment
Share on other sites

I just wanted to add that if you'll be using an AtariVox with Stella, you must use this latest optimized i2c code. Thomas released this new code in part because we found a bug when adding AVox support to Stella.

 

Well, I'm brand new to programming for the AtariVox, and I must be making a rookie mistake, although I don't know what it is.

 

I'm including Thomas's i2c_v2_2.inc, I'm using the example code from AtariVox.rtf EXACTLY as it's written, and I've got my ROM configured in Stella to look for the AtariVox in the right port (screenshot attached). But when the example code runs, the first jsr i2c_startwrite always returns with the carry flag set, which from the documentation means it was unable to communicate with the port.

 

buffer = $80

jsr	i2c_startwrite	; Start signal and $a0 command byte
bcs	eeprom_error	; exit if command byte not acknowledged

lda	#$01			; upper byte of address
jsr	i2c_txbyte
lda	#$40			; lower byte of address
jsr	i2c_txbyte

ldx	#$00
write_loop
lda	buffer,x		; get byte from RAM
jsr	i2c_txbyte		; transmit to EEPROM
inx
cpx	#$08			; 8 bytes sent?
bne	write_loop

eeprom_error
jsr	i2c_stopwrite	; terminate write and commit to memory


rts

 

Is there some initialization that I'm missing? Or a Stella configuration option I've missed?

 

--Will

Just thought I'd take care of the obvious first; you are restarting Stella, correct? It's not enough to select the AVox as the right controller in the UI. You then have to restart Stella with the same ROM to pick up the change (as indicated by the text at the bottom '(*) Changes to properties require a ROM reload'). Currently, one cannot 'hotplug' a virtual controller while Stella is running a game; you have to exit the game and start again. This is a deficiency I'm working on fixing for a future release.

 

Alternatively, you can start your game from the commandline with the following:

stella -rc atarivox ROM_FILE

which will force the right controller (the -rc command) to the AtariVox. Using a real AVox will result in the same issues, if I'm correct in thinking that your issue is that Stella isn't actually using the AVox controller at all.

Link to comment
Share on other sites

Just thought I'd take care of the obvious first; you are restarting Stella, correct? It's not enough to select the AVox as the right controller in the UI. You then have to restart Stella with the same ROM to pick up the change (as indicated by the text at the bottom '(*) Changes to properties require a ROM reload').

 

Yep, definitely restarting Stella each time. What's interesting is when I recompile the ROM, Stella will "forget" that I've specified AtariVox for the P1 controller (perhaps it uses a checksum or modification date rather than simply the filepath of the ROM?) and reverts it to Joystick, but regardless I do change the controller setting outside of the game (and then confirm it's still set correctly by looking at the config after starting the game.)

 

--Will

 

EDIT: Tried it with the commandline argument, still can't access the EEPROM: Stella.exe -fullscreen -1 -rc atarivox DUCKNTSC.BIN

Edited by e1will
Link to comment
Share on other sites

Just thought I'd take care of the obvious first; you are restarting Stella, correct? It's not enough to select the AVox as the right controller in the UI. You then have to restart Stella with the same ROM to pick up the change (as indicated by the text at the bottom '(*) Changes to properties require a ROM reload').

 

Yep, definitely restarting Stella each time. What's interesting is when I recompile the ROM, Stella will "forget" that I've specified AtariVox for the P1 controller (perhaps it uses a checksum or modification date rather than simply the filepath of the ROM?) and reverts it to Joystick, but regardless I do change the controller setting outside of the game (and then confirm it's still set correctly by looking at the config after starting the game.)

Yes. this is correct. The ROM properties are indexed by MD5sum, so a recompile of a ROM is essentially creating a new ROM entry (which uses joysticks by default). In fact, this was precisely why the various commandline options were added; to force the properties to a specific value. So if you're always launching from the commandline (either yourself or with an IDE), it's easy to force the controller. Otherwise, you need to do it each time from the UI, which is something I'm thinking about reworking for a future release.

EDIT: Tried it with the commandline argument, still can't access the EEPROM: Stella.exe -fullscreen -1 -rc atarivox DUCKNTSC.BIN

You don't need to specify the fullscreen argument each time; it's saved after the first time. If it still doesn't work, then it might be a problem in the programming of the AVox itself. Unfortunately, I can't help in that area.

 

EDIT: I should also add that using SaveKey vs. AtariVox will not help, as they both are doing exactly the same thing behind the scenes wrt accessing the EEPROM. To Stella, an AVox is just a SaveKey with an additional SpeakJet chip.

Edited by stephena
Link to comment
Share on other sites

If it still doesn't work, then it might be a problem in the programming of the AVox itself. Unfortunately, I can't help in that area.

 

If I understand correctly, the problem is the very first "jsr i2c_startwrite" command, before any AtariVox or SaveKey programming is performed. I suggest that e1will posts the binary containing the problem so that we can debug it and see why this is happening.

 

Chris

Edited by cd-w
Link to comment
Share on other sites

If it still doesn't work, then it might be a problem in the programming of the AVox itself. Unfortunately, I can't help in that area.

 

If I understand correctly, the problem is the very first "jsr i2c_startwrite" command, before any AtariVox or SaveKey programming is performed. I suggest that e1will posts the binary containing the problem so that we can debug it and see why this is happening.

 

Chris

 

Correct, the first jsr i2c_startwrite is failing (setting the carry flag.) The binary is posted above (post #18), the first jsr i2c_startwrite is at $B9C3. Either stepping through it in the debugger or letting it run at normal speed seems to produce the same results.

 

--Will

Link to comment
Share on other sites

Correct, the first jsr i2c_startwrite is failing (setting the carry flag.) The binary is posted above (post #18), the first jsr i2c_startwrite is at $B9C3. Either stepping through it in the debugger or letting it run at normal speed seems to produce the same results.

--Will

 

I'm having a bit of trouble finding the AtariVox calls in your code. Can you let me know when they are called in the game, and which bank/address they are at. Ideally, if you could separate the AVox stuff from your main code and post the source, or post a symbol file for the Stella debugger?

 

Chris

Edited by cd-w
Link to comment
Share on other sites

Correct, the first jsr i2c_startwrite is failing (setting the carry flag.) The binary is posted above (post #18), the first jsr i2c_startwrite is at $B9C3. Either stepping through it in the debugger or letting it run at normal speed seems to produce the same results.

--Will

 

I'm having a bit of trouble finding the AtariVox calls in your code. Can you let me know when they are called in the game, and which bank/address they are at. Ideally, if you could separate the AVox stuff from your main code and post the source, or post a symbol file for the Stella debugger?

 

Chris

 

Sure, symbol file attached.

 

--Will

 

EDIT: The jsr i2c_startwrite call is the only call in the game that pushes the stack pointer down to F3, so if you have trouble locating that call you can just add a breakif {sp==F3} and it will catch there. Starting a game, move the robot to the right door and into the light blue room, then pressing the fire button is what triggers the AtariVox call.

DUCKNTSC.zip

Edited by e1will
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...