Wednesday, January 10, 2018

Using the SIO2Arduino with Atari 130XE

The SIO2Arduino is a DIY disk drive emulator which runs on an Arduino board and hooks up to the Atari 8-bit via the SIO port. My own experience of installing the sketch on an Arduino Mega was the topic of my last post. Here, I describe hooking the Arduino up to SIO and using it to boot the Atari into TurboBASIC XL.

I suggest one gets their SD card reader and LCD display working independently prior to hooking up to Arduino up to the Atari. The software works fine without an Atari present - of course it will dump error messages to the serial monitor. All the connections are described on the original SIO2Arduino webpage. I posted my activities on the Antic Podcast Facebook Page and Michael Glaser of the Atari XEGS Cart-by-Cart Podcast joined in with his experience. It was nice to have a partner in crime. He made this nice pin-to-pin connection cheat sheet for hooking up the Mega 2560.

The idea of attaching the Arduino to my Atari made me pretty nervous. The last thing I wanted to do was blow the I/O pins on the POKEY. The creator of SIO2Arduino points out the standard colors of the Atari Data In (orange) and Data Out (green) wires in the SIO cable in his hookup guide. Fortunately, one of the SIO cables I have has machine screws instead of rivets attaching the connector back shells. Removing half of the back shell let me double check my connections. I found that the pins on the jumper wires from the Sunfounder Arduino clone kits are a nice fit for the sprung sockets in an SIO plug. Here's a photo of these connections.
Once I triple checked my connections, I powered up the Arduino and then the Atari. Magic!

One of the peculiar behaviors I found was directories need to have less than 256 files. SDrive can scroll thru them, but SIO2Arduino will mod-256 the file number and you won't load the file you intended.

I am an avid fan of the BASIC 10-Liner Game Competition. As Kevin Savetz says, "It's the most wonderful time of the year." At last, I can test my own programs on real hardware - after developing them with modern tools, of course. The first thing I tried was mounting and booting TurboBASIC XL. That was successful. I could even write a short program ("Hello World" anyone?) and save it to the disk image. Sweet! Then I played a couple rounds of my ersatz Interceptor - pretty nice on real hardware.

If you have a few minutes more to waste, check out my video of it in action.

Thanks for visiting.

Monday, January 1, 2018

Setting up the SIO2Arduino for Atari 8-bits

I recently acquired an Atari 130XE 8-bit personal computer, but it did not come with any storage devices. I had heard about the SIO2Arduino project (probably on the Antic podcast) and thought I'd give it a try. The SIO2Arduino uses an Arduino microcontroller board to emulate an Atari floppy drive plugged into the Atari's Serial Input Output (SIO) port. Disk images are stored on a microSD card and selected using a button on the Arduino or through the SDrive software on the Atari. All I was missing for this great project was a microSD card breakout board. I ordered the Adafruit version because it was clear it had good 3.3V/5V logic level translation. I had a Mega2560 board bought for another project and ended up not using. The SIO2Arduino software supports an LCD display when used with the Mega, which I had from on old starter kit. Here's a photo of the final result in all its prototype glory:

[NOTE: This post covers using the original master branch of the software with an Arduino Mega. There is another branch that allows using an LCD with an Uno or Nano.]

The tallest hurdle for setting this up is finding the right Arduino IDE and libraries. Before assembling any hardware (and while waiting for my SD card board to arrive), I wanted to make sure I could compile the software. The software relies on an old SdFat library which is no longer to be found (by me anyway) and using the current version stops compilation in a recent IDE (1.8.4 at the time I tried). Github user Zemac was kind enough to post a solution in an open Issue on the SIO2Arduino github repository. I quote it here for your convenience:

If you want this code to run on the current Arduino IDE and need sdfat old library (ver.21.9.2013). It was also necessary to insert a code library SPI.h.Library and sketch can be found at this link. The code is already set on the control button and there is the added library SPI.h. The code is functional in the Arduino IDE 1.6.5.https://drive.google.com/file/d/0BwX94lwwuDfzcEdrUm1ub29VQm8/view?usp=sharing 
Hello Zemáč 
From Czech Republic
Since Zemac was successful with IDE 1.6.5, I decided to stick with that and not try to build the software under 1.8.4. To do so, I followed the steps below. I think there is a better way to do this using the arduino builder, but this got me up and running quickly:
  • Download the older version (1.6.5) as the Windows .zip file (not the Windows installer) and uncompress it into its own directory arduino-1.6.5-r5
  • Download and unzip the Arduino.zip file from Zemac's Google Drive link into the arduino-1.6.5-r5 directory. This creates a directory called Arduino containing all the necessary files (both SIO2Arduino and libraries). 
  • Start the Arduino IDE. Select "Preferences" under the "File" menu and set the "Sketchbook location" to arduino-1.6.5-r5\Arduino.
  • Select "SIO2Arduino" from the Sketchbook selector under the File menu.
The SIO2Arduino sketch and its supporting files should open in the IDE. From there, one follows the directions found on the original SIO2Arduino page. I set mine up in the config.h file as follows:

  • Uncomment the #define ARDUINO_MEGA statement and comment out the others.
  • Uncomment the #define LCD_DISPLAY statement
  • Turn on debug output by uncommenting #define DEBUG
Select Mega from the Tools/Board menu and then hit the check mark to compile. Once you have a good configuration, build up the hardware.

Since the SD card break out board was new to me, I tested it out with the newer IDE and SD demo software before trying to load the SIO2Arduino. I used the Adafruit tutorial as a guide. Note, you'll have to change the wiring to use the SPI pins and the appropriate SD CS line on the Mega. After working through the SD card demo, the pin definitions in the config.h file should look familiar. I also tested out my LCD display (with parallel interface) ahead of time because I hadn't used it for a couple years. The Arduino tutorial helps there. There are newer displays that use a serial interface - I'm not sure if those will work with SIO2Arduino. Once I had both the SD card and LCD display working, I configured things for the SIO2Arduino and uploaded the code. I checked out the terminal to see the debug output - it indicated it could read the files, but of course there was no Atari attached.

I'll probably cover hooking it up to my Atari in a later post. 

Happy New Year!