Jump to content
Paul Slocum

Transferring data from 2600 to PC via audio?

Recommended Posts

I'm working on an Atari 2600 music program, and I'm trying to figure out a good way to get music data from the Atari 2600 to the PC.

 

The best idea I've had so far is to encode the data into audio, and to have the PC record the audio and decode the data. Anyone have any thoughts on this? It seems like it would be pretty easy to modulate the 2600 audio signal into a bitstream that would be reasonably easy to decode on the other end. Transfer rate would probably need to be slow, but the total transfer would probably only be 500-1000 bytes.

 

Other ideas I've had are to display the data as hex and have the user transcribe it. I currently have this implemented, but it's a bit tedious and error prone to transcribe hundreds of bytes of data.

 

Another idea is to use the Atarivox to store data, and then use the 2600daptor to transfer the data to the PC. This seems like a good method, but then the user has to buy $75 worth of extra gear. With the audio method, no extra equipment is needed.

  • Like 2

Share this post


Link to post
Share on other sites

I used that method a few years ago to dump the built-in games in a clone console that doesn't have bidirectional joystick ports. It was reliable (altough slow), and the console was not a/v modded (I connected it to a portable B/W tv through RF, then used the headphone jack on the TV to connect to the PC soundcard).
http://atariage.com/forums/topic/185932-my-2600-cart-dumper/

Here is the routine I used. calling the "Playbyte" subroutine sends the value in the "byte" variable as FSK audio.
A '0' (SPACE) is encoded as 1 period of a sinewave, while a '1' (MARK) is two periods at twice the frequency. The data format is as follows:
1 start bit (SPACE)
8 data bits (least significant bit first)
2 stop bits (MARK)

 

Before starting the actual transfer, a leading tone ( a series of '1' ) was sent (calling the "Playbit" subroutine with the carry set), to help the decoding program to detect the start of the data.

    IF FAST ;1300 baud
; 1 bit = 2736 color clock cycles = 912 proc. clock cycles = 12 scanlines
; AUDF0 values
SPACE		=	11	; 1300Hz PAL (1310Hz NTSC)
MARK		=	5	; 2600Hz PAL (2620Hz NTSC)
TIMER		=	14	
    ELSE    ;520 baud
; 1 bit = 6840 color clock cycles = 2280 proc. clock cycles = 30 scanlines
; AUDF0 values
SPACE		=	29	; 520Hz  PAL (524Hz  NTSC)
MARK		=	14	; 1040Hz PAL (1048Hz NTSC)
TIMER		=	36	
	ENDIF

;AUDC0	value
WAVEFORM		=	4	; 01 (pure tone)

;AUDV0 value
VOLUME			=	15
	


;-------------------------------------------------------
	subroutine Playbyte
Playbyte
	jsr Play_Start_bit	;start bit
	sec
	ldx #9
.newbit
	ror byte
	jsr Playbit

 
	dex
	bne .newbit

	
;-------------------------------------------------------
	subroutine Playbit
Playbit
;bit = carry
        
        bcs .mark		
Play_Start_bit
        ldy #SPACE		
        .byte $2c 	;BIT abs 
.mark   
        ldy #MARK	
End_bit
.tmr_lp
	lda INTIM		;riot
	bne .tmr_lp

;-------------------------------------------------------
	lda #TIMER
	sta WSYNC		
	sta TIM64T		
	sty AUDF0		
	rts
;x=0
;carry set



Here's a sample waveform (capture of the clone console through rf using Audacity).
post-10599-0-12174200-1464859966_thumb.png

  • Like 5

Share this post


Link to post
Share on other sites

Awesome, thanks so much for the code and info! I'll give it a try.

 

What unusual ROMs were on that console that you were dumping?

Share this post


Link to post
Share on other sites

Some alternative ideas, just to throw them out there...

 

The AtariVox eeprom driver uses i2c to communicate with the chip. i2c to USB devices from China are about $10 on ebay (would need to be connected to a DB-9). You could use the driver direct to a custom program on the PC, and this would give you 2-way communication.

 

Use A26F/MidiJoy and one of those cheapo midi to USB cables. Create your own sysex dump in your program.

 

Also worth noting that the Savekey device implements the eeprom circuit of an AtariVox, usually for much cheaper. Not sure if these are still being made - CPUWIZ was doing them in the past. Reading on the PC side could be done with this circuit though I don't believe there's a ready-made solution.

 

...the audio idea sounds good too. :)

Share this post


Link to post
Share on other sites

I would use a PIC and a serial to USB adapter, then use either one joystick port or both to transfer the data digitally. Similar to my 7800 MCP devkit adapter.

 

And welcome back, Paul.

  • Like 1

Share this post


Link to post
Share on other sites

In fact, come to think of it, you could use the MCP adapter board on the 2600 and just write a small piece of receiver software on the PC side.

 

 

MCPIO2.jpg

Share this post


Link to post
Share on other sites

What unusual ROMs were on that console that you were dumping?

Just the usual taiwanese pirate hacks, actually. Sometimes you can find some previously unknown variation in those consoles.

As an amateur programmer, my goal was just to see if I could do it, and after I had it working, I turned it into a more general cartridge dumper by adding other features such as bankswitch support and serial output. The audio method is still useful because despite the slow speed, it doesn't require any custom adapter.

 

Probably you can reliably use higher speed if using a/v modded console and the routine can be optimized to take less cycles (in my dumper I wanted it to work also on stocK RF, and I focused on optimizing for space usage, as everything had to run from the riot ram).

 

You could also implement serial communication (even bidirectional) in software through a controller port. You cannot reach the high speed transfer like if you use an external microcontroller as in the MCP, but for the small amount of data that you need for this application, it might not be an issue.

In this case you only need a TTL to rs232 level converter to connect to a serial port (either a real one or a serial to USB adapter). There are also cheap TTL-serial to usb adapter which don't require the level converter.

 

 

Share this post


Link to post
Share on other sites

:idea: You can simply use a SaveKey an dump the game onto it. Wickeycolumbus and I have developed the code for this some years ago.

Share this post


Link to post
Share on other sites

:idea: You can simply use a SaveKey an dump the game onto it. Wickeycolumbus and I have developed the code for this some years ago.

I was aware of that at the time, but I couldn't use it (nor Batari's FB2 dumper), as that specific clone console uses a custom ic which integrates 6507, RIOT and TIA, plus some extra logic to read the console switches and the joysticks as a 5x3 keyboard matrix, to reduce the pin count on the chip. (only 8 pins required for 5 switches and 2 joysticks, instead of 13).

Because of that, instead of the RIOT and TIA I/O pins, the matrix keyboard decoder pins are connected to the controller ports and the console can only use standard mechanical joysticks (made of switches without electronics). There's not power pin, no ground pin (the pin corresponding to one of the matrix columns is connected there instead), no RIOT I/O pins and no TIA trigger input (replaced by the 5 matrix rows pins), and no paddles inputs. There's no way to output data on that console, so savekey, serial communication, and even keypads or paddles cannot be used.

 

 

As for the use in the 2600 music program, using the SaveKey/AtariVox will still require some custom adapter or, if the serial eeprom is socketed, an eprom programmer to transfer the content to a PC.

  • Like 1

Share this post


Link to post
Share on other sites

As for the use in the 2600 music program, using the SaveKey/AtariVox will still require some custom adapter or, if the serial eeprom is socketed, an eprom programmer to transfer the content to a PC.

Wouldn't a simple DB9 to USB adapter do?

Share this post


Link to post
Share on other sites

No, those adapters provide a standard rs232 serial port.
The "VOX" part of the AtariVox (the speakjet chip) uses a UART serial protocol (like rs232), but with TTL levels (and if I remeber correctly, inverted logic).
The eeprom (the savekey part of the AAvox), which is what you need for this application, uses a different protocol (I2C).

Moreover, the AtariVox uses a custom pinout to match the signals available on the Atari controller ports, so you still need some rewiring even if you find a commercial adapter with matching signal levels and protocol.

Edited by alex_79
  • Like 1

Share this post


Link to post
Share on other sites

I'm working on an Atari 2600 music program

I'm excited already!

 

My two cents is that I'd prefer a transfer method that doesn't require extra hardware.

Do you plan to release the PC-side software under a free software license? It'd be better that the code not be restricted to just one or two operating systems.

Share this post


Link to post
Share on other sites

The Atarivox doesn't work with standard RS232 adapters, but it could be read with something like a 2600daptor 2 because the device's joystick pins are bidirectional.

 

A lot of good ideas here, but overall I like the audio method best because it doesn't require any additional equipment. (Yes, I would release the transfer software under an open license)

Share this post


Link to post
Share on other sites

I have nothing to add to this thread except to say that I think it's very cool. It reminds me of when the Stella Gets A New Brain CD came out, and I ran out to get a Starpath Supercharger to send these crazy old ROMs to my Atari via a Discman. Then I found BIN2WAV.exe (replaced by MAKEWAV apparently) so I could stick arbitrary ROMs into the audio port and send them to the VCS. Caveman junkyard flash card, man!

  • Like 1

Share this post


Link to post
Share on other sites

Continued derail:

 

"Caveman junkyard flash card, man!"

 

I don't know if it was referred to as flash back then.

I think of it as a 6K RAM cart you can fill.

 

I even have a playlist on my phone with... Wow... 307 binary sound files for my Supercharger! Including my 4K FLAPPY and the new 4K Pac-Man by DINTAR816.

  • Like 2

Share this post


Link to post
Share on other sites

Another idea is to use the Atarivox to store data, and then use the 2600daptor to transfer the data to the PC.

Does anyone have a utility to do this already? I am very interested in this as I have these and I had already started working on a program to develop sounds. I was planning on storing the data to the Vox and dumping it this way.

 

 

Soooo.... has anyone already written something? I just need to extract the data from the Vox to a binary file on my computer. :)

Share this post


Link to post
Share on other sites

Does anyone have a utility to do this already? I am very interested in this as I have these and I had already started working on a program to develop sounds. I was planning on storing the data to the Vox and dumping it this way.

 

 

Soooo.... has anyone already written something? I just need to extract the data from the Vox to a binary file on my computer. :)

 

Nothing is currently written. I know it's possible because I confirmed that the joystick port pins are bidirectional, but I'm not totally clear whether it requires an update to the 2600daptor's firmware or not.

 

You could just use the audio code that alex_79 posted to dump data from your Atarivox as audio. I'm not sure if he has code available to decode the audio into a binary, but I don't think it would be that hard to write a decoder. I'm planning to write my own anyway, which I'll eventually share.

Share this post


Link to post
Share on other sites

 

Nothing is currently written. I know it's possible because I confirmed that the joystick port pins are bidirectional, but I'm not totally clear whether it requires an update to the 2600daptor's firmware or not.

 

You could just use the audio code that alex_79 posted to dump data from your Atarivox as audio. I'm not sure if he has code available to decode the audio into a binary, but I don't think it would be that hard to write a decoder. I'm planning to write my own anyway, which I'll eventually share.

I was confusing the 2600dator with what the USB interface I have:

 

post-7074-0-07183500-1465012675_thumb.jpg

 

 

While searching about it I believe I found exactly what I need to dump the data:

 

http://atariage.com/forums/topic/148945-atarivox-savekey-driver/

 

It complained about missing a driver so I went to the FTDI site and downloaded the Windows executable.

 

I ran the executable and then plugged in the USB interface to install the drivers. I opened a command prompt and it worked like a charm.

 

post-7074-0-53541400-1465013522_thumb.png

 

 

All I can say is wow, thank you GroovyBee and Richard H. It is so rare that I actually find exactly what I need so easily like this. And on top of that I really want to say a big thank you to Richard H for all his help.

 

 

Jeff

  • Like 2

Share this post


Link to post
Share on other sites

Regarding Omegamatrix post above.

I could not get Stella on OSX to speak out to the real AtariVox. The same machine running windows worked.

 

Solution was to "uninstall" the the FTDI driver downloaded and installed for Mac OSX.

OSX already has FTDI built in, and installing the website driver makes things not work!

 

Took me forever to figure that one out.

 

So on OSX, the AtariVox USB adapter just works.

Don't install any downloaded drivers!

 

I also have 2 latest 2600-'dapters, the ones that config to most every Atari controller, but not used yet as I like the real hardware more. They will be good for programming use using real controllers testing in Stela.

Share this post


Link to post
Share on other sites

 

I'm not sure if he has code available to decode the audio into a binary, but I don't think it would be that hard to write a decoder. I'm planning to write my own anyway, which I'll eventually share.

 

The decoder program is in the zip attached in the cart dumper thread:

http://atariage.com/forums/topic/185932-my-2600-cart-dumper/

I just checked it and the source is missing (while I'm sure it was included in previous revisions). I have it in another computer and I will be able to post it tomorrow. (I don't know if that could be useful, it's not an example of best coding practices, and probably comments are in italian mixed with bad english...) :-D

 

The executable is included, anyway, so you can try it with the dumper software (you can let it dump itself).

 

Share this post


Link to post
Share on other sites

This circuit connects to a PC's serial port and will read/write the AVox / MemKey.

 

Very cheap and easy to build (no SMD components / firmware).

 

I have the driver software somewhere.

 

 

 

post-2630-0-14367500-1465047584_thumb.gif

  • Like 2

Share this post


Link to post
Share on other sites

I love the idea of communicating to a computer using audio. Made me think video would be another way. Use the play field as bar code type deal.

  • Like 1

Share this post


Link to post
Share on other sites

I love the idea of communicating to a computer using audio. Made me think video would be another way. Use the play field as bar code type deal.

 

Since my program can already display the data on screen in hex, I thought about having the user take photos of the screen and feed them into a program that reads them. But I know more about audio than I do about computer vision, so the audio route seemed easier.

Edited by Paul Slocum

Share this post


Link to post
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.

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