Atari 800 in Hyperspin

This section contains artwork and support files for integrating the Atari800 emulator into Hyperspin. This emulator is well-supported by its development team at SourceForge, and the command line version is a good candidate for integration with  Hyperspin.

Objective

My intent was to provide emulation of the Atari 400/800 system in HyperSpin with as little demand on the end user as possible. This meant keeping game-specific options hidden, and handling special requirements 'behind the curtain'. Because the Atari 800 underwent several iterations during its life cycle, the system ROMs were revised more than once. Some games will only operate with specific ROM sets, and it was desirable to keep the user from having to figure out what goes with what.

Some games use the Atari keyboard, some use joysticks, paddles, light gun or trackball.  I elected to keep the keyboard as mapped by the Atari800 emulator, and map the joystick to the arrow keys. Other input devices were mapped to the mouse or touchpad. To simplify the interface and make it as much like M.A.M.E. as possible, the Fire button is mapped to the left Ctrl key. The various input options and ROM versions are handled by calling the emulator from a batch file, which sorts out the requirements without user intervention. This file ("a8.bat"), is described in later paragraphs.

A special problem with this emulator involves the use of the 'Esc' key and the key used to exit the emulator ('F9'). These keys appear to be 'hard-wired' in the emulator and cannot be changed without modifying the source code and recompiling. My solution is outlined in the following section.

Installing Atari800

Although there are emulator-specific and game-specific requirements for integrating this emulator into HyperSpin, the actual installation is the same as outlined in the documents and tutorials at the HyperSpin website. The batch file discussed later should be placed in the same folder as 'Atari800.exe'.

Since support for 'autorun' in Atari800 is confined to cartridge roms and .com, .exe and .xex files, I setup HyperHQ to accept the extenders 'rom' and 'xex'. I renamed all .com and .exe files to .xex to avoid possible confusiont with Windows exe and DOS com files. Although 'atr' files are the most common Atari 800 game files, there are good collections of 'xex' files available.

To close the Atari800 emulator, it is necessary to press the 'F9' key. Furthermore, the 'Esc' key is used in navigating the emulator menu system. Now, since it was desirable to run the emulator without requiring the user to get involved with the menu system, the interception of 'Esc' by Hyperspin should not be a problem. However, the emulator still needs 'F9' to properly close.

Modifying HyperLaunch

The emulator entry for the Atari800 in HyperLaunch is:

;**********************************ATARI 800************************************
else if (systemName = "Atari 800" && (executable = "a8.bat"))

hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
RunWait, %executable% -run "%romPath%%romName%%romExtension%", %emuPath%, Hide UseErrorLevel
}

By adding the following code to HyperLaunch.ahk, the emulator can be closed by simply pressing the 'Esc' key, as is done with M.A.M.E. and other emulators. Place the code in the 'CloseProcess:' routine as described below.

if (emulator = a8.bat) 
{
Send F9
Sleep 100
}


Add these lines immediately before the line: 'Process, Close, %Executable%'.

As always, be sure and recompile the file after making these changes.

Batch File

The following batch file is used to assign the correct emulator options to each supported game. It should be named 'a8.bat' and placed in the same folder as 'Atari800.exe'.

a8.bat

if %~n2 == starraid goto :opB
if %~n2 == tailbl goto :opB

... (more entries) 

if %~n2 == robobatl goto :opXL
if %~n2 == aplpanc goto :joy2

... (more entries)

if %~n2 == avalanche goto :mousepad

... (more entries)

if %~n2 == arkanoid goto :mousejoy

... (more entries)

if %~n2 == barnblast goto :mousegun
if %~n2 == airball goto :cart
if %~n2 == astrocha goto :cartB
atari800 -run %2
exit
:opXL
atari800 -xl %1 %2
exit
:opB
atari800 -b %1 %2
exit
:joy2
atari800 -config aplpanc.cfg %1 %2
exit
:mousepad
atari800 -mouse pad %1 %2
exit
:mousejoy
atari800 -mouse joy %1 %2
exit
:mousegun
atari800 -mouse gun %1 %2
exit
:cart
atari800 -cart %2
exit
:cartB
atari800 -b -cart %2
exit

----------------------------------------------

The batch file is called from HyperLaunch with the first parameter , %1, containing the parameter line and the second, %2, containing the fully qualified file name, including the path. The batch file operator '%~n2' extracts the name without the extender. The only parameter currently passed by HyperLaunch is the '-run' command. Managing this batch file requires updating as new game files are added, but the process is no more onerous than managing title artwork.

A more efficient and elegant method for connecting each game to its appropriate options would be to modify the game file extender to signify the options and sort files by extender. This would involve less than a dozen choices and would reduce the number of tests in the batch file. I didn't do this because I preferred not to mess with the names, and the penalty for scanning through the name list is not significant.

Artwork

For full integration with Hyperspin, a System graphic for the Main Menu wheel and a System theme are needed.

Here is the graphic I use for the entry on the Main Menu wheel.


This is the graphic that appears when the Atari menu is selected. The Main Menu theme can be downloaded as Atari_800.zip



Game Themes

I could not find game title artwork for the Atari 800 games, so (lacking artistic talent) I decided to use screen shots for the game titles. When the game had a title screen, I used that for the wheel entry. Otherwise I used a screen shot taken during play.

As an experiment, I created a default game theme consisting of an Atari 800 with a video monitor. This provided a background for individual game themes, which consisted of screen shots taken during game play. A few examples of the display during wheel selection are shown below.

 




Conclusion

My current installation is fully functional and robust. Game interaction is very close to that of M.A.M.E.

There are pros and cons in the approach to game themes taken here. I wanted to display a snapshot from the selected game on the monitor without incurring the overhead of a full theme with its background, so I simply load a default theme containing the background and created each game theme with the snapshot only. I always start the wheel at the same point and have made a theme for this game which includes the background. All other themes consist of just a snapshot in Artwork4. Games which do not currently have a theme simply display the background with a blank screen. The positive value, of course, is the low overhead of this method. The negative side is that I always have to start the wheel at the same point and wait for the theme to complete before rotating the wheel. 

I admit that the artwork is unimaginative and unworthy of consideration as a supported system, but it works for me and provides a satisfying game experience.

Adding Support for Game Manuals

This is an often requested enhancement to HyperSpin. I've found a way to provide support for game manuals with minimal cost and effort. It involves using a free application called PDFlite. This PDF reader takes command line arguments to specify the file to be displayed and supports several configuration options which can be specified when the executable has been started.

To implement the method, take a PDF version of a game manual and rename it to match the game (ROM) name. For example, if the game is named "barnblast.xex" name the PDF file "barnblast.pdf" and place it in the same folder containing the game.

Here is the HyperLaunch script for the Atari 800 emulator using a8.bat as modified to allow for game manual support:

;**********************************ATARI 800************************************
else if (systemName = "Atari 800" && (executable = "a8.bat"))

hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
ifExist %romPath%%romName%.pdf
{
 MsgBox,4,Manual Available, Show Manual? (If YES, press 'x' when done with manual)
  {
   ifMsgBox Yes
    {
     Run, "\Program Files (x86)\PDFlite\pdflite.exe" "%romPath%%romName%.pdf"
     Sleep 900
     SendInput ^L ; not necessary when PDFlite remembers settings.
     Sleep 200
     Send ^0         ; not necessary when PDFlite remembers settings
     KeyWait,x,D
     SendInput ^q
     winClose pdflite.exe
     Process, waitClose, pdflite.exe
    }
   }
  }
RunWait, %executable% -run "%romPath%%romName%%romExtension%", %emupath%, Hide UseErrorLevel
}

This script takes the game name and determines whether a corresponding PDF file exists. If not, not special action is taken and the game is run as it normally would. If a manual exists, a MsgBox pops up prompting the user to choose whether to show the manual or not. If not, the MsgBox closes and the game runs. If so, PDFlite is invoked with the game manual displayed. The standard navigation keys, cursor Up and Down, PgUp and PgDn and Home and End are used to navigate the manual.

Screen Display of Manual for Airstrike 2

When you have finished looking at the manual, press 'x' to quite the reader and start the game.

The portions of this script devoted to manual display are not Atari800 dependent. Therefore they can be used with any other emulator which provides game manuals in PDF format. Simply copy all lines between Hotkey... and RunWait... to your emulator script.

Using Manuals from Non-PDF Scans

Although PDF files provide the most universal platform for providing documents, many of the existing manuals for Atari games and other systems consist of multiple jpg, gif or tiff files. Since PDFlite does not support other formats, it would be convenient to convert files with other formats to PDF for inclusion. It happens that freely available software can support these conversions.

Microsoft now provides its Image Composer software free and this program can convert graphic files  from jpg, bmp, gif and png to any of the other formats. Even Microsoft Paint and many other simple graphics programs can do this.

All that is required is to download a driver for a PostScript printer which supports saving to a File, rather than directly printing the file. There are many such drivers available from trusted printer manufacturers. The process is simple. Create a suitable graphic in a desired format and print it to a file using the downloaded printer driver. This allows you to create a file, with a .PS extension, which holds the desired graphic or manual pages.

Use GhostView, a free program, to convert the PostScript file to PDF format and the process is complete. 

Multiple Page Documents

When the manual is available as a set of jpg files, it will be necessary to convert each file to a PostScript file using the tool of choice (Image Composer, for example).  The resulting PostScript files are simply concatentated using the DOS copy command:

copy file1.ps+file2.ps+file3.ps+...filex.ps manual.ps

Now load the resulting into GSView and ignore all DSC violations (there will be several for each file, but they do not affect the integrity of the result). Convert the loaded file into a PDF file, and you are done! If you adopt the conventions I used, you should save the file to the same folder containing your games and give it the same name as the game, e.g. I used airstrk2.xex for the game and airstrk2.pdf for the manual.

Mapping the Atari 400/800 Keys to the PC

In most cases, this is not an issue because the emulator already handles the obvious distinctions between the two keyboards. However, there are some special cases where customized attention is appropriate. For example, the game Alibaba and the 40 Thieves expects the user to control the game inputs from special keys on the Atari 400/800 keyboard which differ from the PC keys.

The game allows the user to switch input devices from the keyboard to the joystick, but even this Option requires the use of the keyboard to make the selection. Here is an image of the Atari 400 keyboard:

Atari 400 Keyboard Layout

The game advises the user that only the arrow keys are required to play. These keys are identified in the image following.

Arrow Keys Required by Alibaba

Note that these arrow keys are associated with keys which perform functions duplicated by the PC keys. In fact, the Down Arrow is associated with the '=' key and it happens that pressing the '=' key on the PC will (in general) be accepted by the emulator.

Having pressed the '=' key at the appropriate prompt in Alibaba, the user will then be able to complete the game using the joystick.

This brief note is no substitute for an exhaustive treatment of keyboard mapping between the two machines, but is only intended to show how to solve one specific problem.