Jump to content

Photo

Hacking for AtariVox


38 replies to this topic

#1 mos6507 OFFLINE  

mos6507

    River Patroller

  • 4,915 posts

Posted Thu Oct 15, 2009 9:06 AM

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, Thu Oct 15, 2009 1:57 PM.


#2 e1will OFFLINE  

e1will

    Moonsweeper

  • 349 posts

Posted Wed Nov 25, 2009 9:37 AM

Is there an AtariVox programming FAQ someplace?

--Will

#3 the.golden.ax OFFLINE  

the.golden.ax

    Quadrunner

  • 12,547 posts

Posted Wed Nov 25, 2009 10:10 AM

This would be VERY cool. In addition I'd love it if someone would port a simple speak and spell (like the one on OD2).



I'd also like to see several 7800 hacks, and NEW stuff too! ;)

AX

Edited by the.golden.ax, Wed Nov 25, 2009 10:10 AM.


#4 mos6507 OFFLINE  

mos6507

    River Patroller

  • Topic Starter
  • 4,915 posts

Posted Thu Nov 26, 2009 10:19 PM

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.

#5 the.golden.ax OFFLINE  

the.golden.ax

    Quadrunner

  • 12,547 posts

Posted Fri Nov 27, 2009 9:46 AM

It is that rough when you type it directly. It is possible to get plenty out of it if you trick it, and that is half the fun. Coming up with word and letter combinations strung together to make it sound good. Personally, I enjoy making it cuss. :D

AX

#6 cd-w OFFLINE  

cd-w

    Stargunner

  • 1,612 posts
  • Juno First!
  • Location:Glasgow, UK

Posted Sun Nov 29, 2009 4:54 AM

Is there an AtariVox programming FAQ someplace?
--Will

Yes, although I can't find the web page where they live, so I have attached them below.

Chris
Attached File  AtariVox_docs.zip   12.08KB   208 downloads

Edited by cd-w, Sun Nov 29, 2009 4:55 AM.


#7 e1will OFFLINE  

e1will

    Moonsweeper

  • 349 posts

Posted Sun Nov 29, 2009 6:57 PM

Yes, although I can't find the web page where they live, so I have attached them below.

Chris


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

Thanks!

--Will

#8 cd-w OFFLINE  

cd-w

    Stargunner

  • 1,612 posts
  • Juno First!
  • Location:Glasgow, UK

Posted Mon Nov 30, 2009 1:56 AM

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

#9 e1will OFFLINE  

e1will

    Moonsweeper

  • 349 posts

Posted Mon Nov 30, 2009 9:38 PM

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

#10 stephena ONLINE  

stephena

    River Patroller

  • 3,304 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Tue Dec 1, 2009 9:20 AM

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.

#11 e1will OFFLINE  

e1will

    Moonsweeper

  • 349 posts

Posted Tue Dec 1, 2009 11:24 AM

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

#12 cd-w OFFLINE  

cd-w

    Stargunner

  • 1,612 posts
  • Juno First!
  • Location:Glasgow, UK

Posted Tue Dec 1, 2009 11:35 AM

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

#13 stephena ONLINE  

stephena

    River Patroller

  • 3,304 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Tue Dec 1, 2009 2:55 PM

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 ...

#14 Primordial Ooze OFFLINE  

Primordial Ooze

    Dragonstomper

  • 541 posts
  • Quacker Blaster Lead Programmer
  • Location:United States of America

Posted Tue Dec 1, 2009 5:36 PM

Quick question, how can i get an AtariVox besides hacking a game and adding AtariVox support for it?

Sincerely,

Dino Dash Derby

#15 Richard H. OFFLINE  

Richard H.

    Stargunner

  • 1,033 posts
  • VirtualBoy 32MBit cart
  • Location:UK

Posted Wed Dec 2, 2009 9:05 AM

how can i get an AtariVox

When the AA store re-opens they'll be back in there.

Glenn's probably built over 100 by now (so there won't be a shortage anytime soon).

#16 e1will OFFLINE  

e1will

    Moonsweeper

  • 349 posts

Posted Fri Dec 4, 2009 5:46 PM

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

Attached Thumbnails

  • duck-controller-config.PNG


#17 cd-w OFFLINE  

cd-w

    Stargunner

  • 1,612 posts
  • Juno First!
  • Location:Glasgow, UK

Posted Sat Dec 5, 2009 6:15 AM

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

#18 e1will OFFLINE  

e1will

    Moonsweeper

  • 349 posts

Posted Sat Dec 5, 2009 7:38 AM

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

Attached Files



#19 stephena ONLINE  

stephena

    River Patroller

  • 3,304 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Sat Dec 5, 2009 7:40 AM

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.

#20 e1will OFFLINE  

e1will

    Moonsweeper

  • 349 posts

Posted Sat Dec 5, 2009 7:49 AM

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, Sat Dec 5, 2009 7:54 AM.


#21 stephena ONLINE  

stephena

    River Patroller

  • 3,304 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Sat Dec 5, 2009 8:04 AM

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, Sat Dec 5, 2009 8:08 AM.


#22 cd-w OFFLINE  

cd-w

    Stargunner

  • 1,612 posts
  • Juno First!
  • Location:Glasgow, UK

Posted Sun Dec 6, 2009 6:30 AM

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, Sun Dec 6, 2009 6:31 AM.


#23 e1will OFFLINE  

e1will

    Moonsweeper

  • 349 posts

Posted Sun Dec 6, 2009 11:54 AM

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

#24 cd-w OFFLINE  

cd-w

    Stargunner

  • 1,612 posts
  • Juno First!
  • Location:Glasgow, UK

Posted Mon Dec 7, 2009 3:38 AM

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, Mon Dec 7, 2009 3:38 AM.


#25 e1will OFFLINE  

e1will

    Moonsweeper

  • 349 posts

Posted Mon Dec 7, 2009 12:07 PM

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.

Attached Files


Edited by e1will, Mon Dec 7, 2009 12:34 PM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users