PC Atari Emulator 1.5

Author: John Dullea (jxd230@psu.edu)

Contents

  0. What's new?
  1. What is it?
  2. System requirements
  3. Features
  4. Bugs/future additions
  5. Program instructions
  6. Disclaimer
  7. And finally...
  8. Acknowledgements






0. What's new?

Version 1.5

. First off, you'll note that there are two executables: ATARI.EXE and
  ATARI160.EXE.  Both have been improved in speed, but ATARI160 is an even
  faster version.  It places your VGA card into a non-standard 160x200 VGA
  mode that allows the emulator to run faster, since it has to do less
  work to display to the screen.  The speedup should be especially noticeable
  with slower VGA cards or I/O buses.

. The 99-second clock bug in Ice Hockey is fixed.  The ADC and SBC
  instructions weren't setting the N (negative) flag bit when in BCD mode.

. I've gone over all the sound initialization routines carefully after lots
  of mail concerning problems with the sound in 1.4a and have made some
  changes.  I've tested it pretty thoroughly, and hope this should solve most
  of the problems people have been having.

. DMA values 0 to 3 are now supported, instead of just the DMA 1 in 1.4a.  Be
  sure that the BLASTER command line contains a "D#" entry for the DMA value.

Version 1.4a

. I've gotten this version to run under Windows 95; the problem was that
  Windows does not let you lock an XMS memory block, thus requiring a
  different method of moving data to and from XMS.

Version 1.4

. I've overhauled the vertical synchronization in the emulator.  It uses an
  autosynchronizing technique to analyze the vertical sync location and
  shift the screen up or down to get the signal to take place within a
  certain scan line range.  There is still a little jitter in a couple of
  games, and PAL games still give some difficulty.  However, a few more games
  come up properly now, and most of the jitter is gone.  PAL games do look
  better than they did as well.  Part of the problem is that many games
  require more than 200 scan lines to display, so there will always be
  compromises.

. The sound routines are different again; since there have been problems with
  sound quality and slower speed, I've created a hybrid version of the sound
  routines in versions 1.2 and 1.3.  This version uses the new routines to
  pre-calculate the sounds upon startup, but stores them in XMS memory.  When
  a game is running, the sounds are copied from XMS, adjusted for volume on
  the fly, and played using the old routines.  Since XMS is being used, don't
  expect this version to work from within a Windows 95 DOS prompt; you'll
  probably have to restart in MS-DOS mode or exit Windows 95 completely by
  "shutting down" and typing "MODE CO80" when the "It's safe to turn off..."
  screen appears (this at least works when I use my old MS-DOS COMMAND.COM;
  I don't know if it works with the one for Windows 95).  Also, since the old
  routines olly support DMA 1, other DMA's probably won't work (they're
  unchanged from version 1.2).  At one point I experimented with using the
  FM registers to produce just the pure tones, but FM synthesis does not
  support square waves and the sound didn't come out quite right.  Also, with
  this version, the 'Z' menu key (for changing the buffer size) is still
  supported, but it automatically truncates the buffer size so that it's
  evenly divisible by 4 because my routines use doublewords for speed.  There
  is also a slight delay as the sounds are recreated for the new buffer size
  and stored in XMS.  You'll need enough XMS to hold all the sounds at max.
  volume; for a large buffer size, this can go as high as 5,120,000 bytes. The
  amount of XMS required is 512 times the buffer size; for a 4096-byte buffer
  (which I find sounds very good), 2,097,152 bytes of XMS are required.

. Improved the joystick calibration routuine.  This should help with joystick
  drift somewhat; the problem appears to arise if the joystick trimmers are
  not centered during the calibration.  The old routines treated the left
  distance the same as the right (and similarly for the up/down distance).
  The new routines ask you to move the joystick to the upper left corner, then
  center the joystick, and finally to move to the lower right corner.  This
  allows the center to be explicitly known, allowing each of the four
  directions to be treated seperately.

. Improved the playfield display of Astroblast and Tutankham.  There appears
  to be at least a 64-pixel delay between the time CTRLPF is written to and
  when it affects what is drawn on the screen.

Version 1.3

. I've changed the keyboard key assignments for pleyer 2 to J, K, L, and I.
  Enter still serves as the fire button.  I hope this makes things easier.

. This version uses completely different cound code (and no XMS); I've been
  able to get it to run in a Windows 95 DOS window, but the sound doesn't
  play quite right (the games are playable, though).  I might try to auto-
  detect Windows in a later version and use it's sound routines.

. Some display problems that arose in Space Invaders and Astroids are now
  fixed.

. Greatly improved debugger.  Four new keys are available:
  . <End> moves the address to 1FFFh
  . <Ins> moves to the current Program Counter
  . "D" toggles the display between 320x200 and 320x400, which also displays
    the TIA and input register contents, as well as object x positions
  . F1 displays a help screen

. Much better sounds, using the routines written by Ron Fries instead of my
  sample file.  The quality of the sounds is adjustable to accommodate
  slower PC's by letting the user adjust the sample buffer size.  Smaller
  buffer sizes allow the sound routines to run quicker, but degrade quality.
  The 'Z' key in the menu allows buffer sizes in the range 1000-10000 bytes
  to be set.  The default buffer size is 4500 bytes; I find this to be
  fairly acceptable on my P90, and the emulator seems to run just a bit
  faster.  New buffer sizes are immediately saved to the configuration file.

  A note about using the buffer size: with different games you may notice
  "popping" sounds at different buffer sizes.  This  arises from resetting
  the digital playback to allow sounds to play continuously.  If anyone has a
  method for restarting DMA playback without any popping noise, their help
  would be appreciated.  One way to get rid of the popping is to make the
  buffer very small, which tends to make it blend into the noise as a slight
  buzz.  Although larger buffer sizes tend to space them out thus creating
  purer tones, there is an upper limit on usable buffer sizes since larger
  buffers result in longer delays before changes in sound are played.

. Partial Starpath Supercharger Support.  The emulator will attempt to
  run single-load Supercharger games.  For this to work, all Supercharger
  images must be 8448 bytes in size.  They will be displayed in the menu
  in red and are autodetected when <Enter> is pressed.  Alternately, the
  command-line switch BANKSP will use a Supercharger ROM.  Multi-load games
  are on the agenda, but aren't yet supported.

. Video Touch Pad emulation for Star Raiders.  Either the VTP command switch
  or the 'V' key in the menu will enable the keys used to emulate the right
  keyboard controller only, while leaving the left joystick active.  The
  Video Touch Pad has the same characteristics as the keyboard controllers.

. CBS Booster-Grip support.  When CBS games are run (i.e. Omega Race, Tunnel
  Runner, and Mountain King) the joystick buttons that normally perform
  select and reset will instead emulate the two buttons on the CBS Booster-
  Grip joystick add-on.  This controller definitely came bundled with Omega
  Race; I don't know if it came with the other two games.

. Better control flexibility.  For most games, player 1 can use the joystick
  and  player 2 can opt to use the player 2 keyboard controls, if no second
  joystick is available.  Indy 500 is the exception to this feature; both
  players muse use either joysticks or the keyboard.

. Less vertical jitter.  I have improved the vertical synchronization quite
  a bit, and most of the jitter should be gone.

Version 1.2

. It seems that the emulator doesn't work in the DOS box of Windows 95.  I
  think it's because of the interrupt and DMA overrides that are being done.
  For now, I guess it'll have to be run by restarting in DOS mode or by
  "shutting down Windows" and typing MODE CO80 to get to a C> prompt when
  the "it's safe to turn off" screen appears.  I'll try to take a look at
  it's behavior under W95's DOS shell, but I seriously doubt I can do
  anything about it.

. Got rid of that annoying beep whenever you exit a game or trace in the
  debugger

. Some more games now work

. Improved keyboard support

  Player 1 fire .................. <Space> or keypad <Enter>
  Player 1 up .................... Either up arrow key
  Player 1 down .................. Either down arrow key
  Player 1 left .................. Either left arrow key
  Player 1 right ................. Either right arrow key

  Player 2 fire .................. normal <Enter>
  Player 2 up .................... J
  Player 2 down .................. M
  Player 2 left .................. ,
  Player 2 right ................. .

. Indy 500 controllers are emulated by using the left/right keys or joystick
  movements of both players.  Indy 500 emulation is enabled/disabled by
  using the I key or the INDY500 command switch.

. Improved display of several games

. Atari keyboard controllers are now supported.  The key mapping is as
  follows:

  LEFT CONTROLLER      RIGHT CONTROLLER

  1 2 3                4 5 6
  Q W E                R T Y
  A S D                F G H
  Z X C                V B N

  Keypad emulation is enabled/disabled by using the B key or the KB command
  switch.

. Support for PC's without sound cards sould work properly; use the 'S' key
  in the menu to disable sound.

. An upper limit on the number of frames-per-second can be set for the
  emulator, or it can be run with no fps limit.  This feature is available
  both as a command-line argument (FRAMExx) and from the menu (F key).

Version 1.1a

. Fixes a bug in the joystick routine that causes the entire emulator to slow
  down if only one joystick is plugged in.

Version 1.1

. SOUND!  I've stripped out everything related to the Activision sound files
  and started fresh (uncovering quite a few bugs in the sound code, as well).
  There is now some basic sound support, but the polyphonic sounds are fairly
  rough and untested (I'd appreciate any comments!).  I think that I've
  matched the pitch fairly well.  Also, I recorded the tank firing sound from
  Combat, scaled it so that the volume stays constant, and used it to generate
  my own sample file for noise sounds.  It's not perfect, but it is fairly
  close (and better than silence!)

  NOTE: You must have the "BLASTER" environment variable correctly defined for
  sound to work.

  Also, Just as I was about to release this version, Dan Boris (the author of
  Virtual VCS) has graciously sent me an amazing set of routines written by
  Ron Fries called the TIA Sound Emulation Library.  I am currently attempting
  to get them to work with my emulator instead of my crude samples.

. The emulator should run a little bit faster.  To quote Michael Abrash,
  TANSTATFC ("There ain't no such thing as the fastest code.")

. The program now shouldn't immediately exit if game files have the read-only
  attribute set, but should be able to use them.

. If you enter a path as the first argument (e.g. "ATARI C:\GAMES") the menu
  will display, using that directory instead of the current one.

. By request, I went over the screen palette again and tried to make it a
  bit more accurate; I hope this looks better!

. Support for both PC joysticks

. Bowling and Codebreaker now work






1. What is it?

The PC Atari Emulator is a DOS program that emulates the famous Atari 2600
on the Intel 80486+ platform. It is mainly written in assembly language, with
Borland Pascal 7.0 suppliying higher functions (such as an integrated
debugger and disassembler).






2. System requirements

OS:    MS-DOS
CPU:   Intel 80486 or greater, for the BSWAP instruction (though a Pentium is
       highly recommended for performance purposes)
RAM:   640K
Other: Mouse required for paddle emulation
       A 4-button joystick is strongly recommended, ESPECIALLY a Gravis
       GamePad
Sound: A SoundBlaster or compatible is required for sound support






3. Features

. Very fast emulation due to the assembly implementation

. Full collision checking

. Left paddle is emulated using the mouse

. Emulates Indy 500 controllers, keyboard controllers, Video Touch Pad, and
  CBS Booster-Grip

. Support for two joysticks (four-button joysticks can control select, reset,
  and both players' fire buttons)

. Built-in menu allows easy selection of games

. On-line help in the menu system

. Built in interactive debugger that supports bank-switched images

. Built-in disassmebler for images 4k or smaller (i.e. non-bank-switched)

. Support for Atari 8k, Atari 16k, Super-chip, Parker Bros., CBS, and
  M-Network bank switching (M-Network, though, is untested, since I have no
  such games to test with)

. Partial support of Starpath Supercharger single-load games

. Sound support






4. Bugs/future additions

A (very) few games do not yet run perfectly. Some bugs/omissions are:

. Vertical jitter on a few games

. Some games don't come up at all.  I think they are mainly due to bad dumps,
  since the code implies bank switching but the dumps I have are not big
  enough.

. I'm sure there are others I haven't found yet... :)

Features to be added (if I ever make the time):

. Add the last few undocumented instructions that aren't implemented

. Expand the disassembler to handle bank-switched images

. Likewise, there are probably others I haven't thought of yet... :)

I'm sure I could fix a lot of these with some work, but I've been working on
this since January 1996, and I decided that it was high time to just upload
the darn thing instead of tinkering with it forever....






5. Program instructions

  Step 1: Copying the software

  It's pretty simple.  Just extract the files from whatever archive you
  got it from (e.g. ZIP file) and place them where your game files are (e.g.
  in your Action Pack directory).  There should be the following files:

  ATARI.EXE ....... the program
  ATARI.PAL ....... the color palette
  ATARI.CFG ....... sound on/off, joystick, etc.
  ATARIDBG.FNT .... my 5x7 font for the integrated debugger
  ATARI.TXT ....... this file


  Step 2: Running the program

  The easiest way to run it is by entering the name with no parameters:
  (make sure there are .BIN files present, or the program will exit)

  ATARI

  Inside you will find a menu showing all game files.  Scroll around with
  the cursor keys or use the joystick (hit 'J' to calibrate it, or 'K' to
  disable joystick support).  F1 will bring up the online help, which details
  all commands and command-line options.  If your system supports more than
  25 rows of text, the program will support it (I wrote a nifty program that
  gives me 80x50 text with full 720x800 resolution on ATI Mach 32 and Mach
  64 cards, for example).

  You should notice that files are color-coded according to size; 2k and 4k
  files are gray, 8k are white, 12k are black, and 16k are yellow.  Hitting
  <enter> (or joystick button 1) runs 2k, 4k, atari 8k, CBS 12k, and standard 16k (non super-chip)
  files.  'A' runs Activision "special" files (e.g. Robot Tank and Decathlon).
  'R' runs 16k super-chip games, 'P' runs 8k Parker Bros., and 'M' ATTEMPTS
  to run M-network games (I have none, so testing was impossible).  'D'
  toggles the integrated debugger, which will kick in when you run a game.

  Ok, you've picked a game and gotten it to appear.  How do you start playing?

  F2.........................Reset
  F4.........................Select
  F5.........................Color/BW toggle
  F6,F7......................Player 1,2 difficulty switches
  <Esc>......................Exit game
  Joystick/cursor keys.......move
  <Space>/joystick fire......fire
  joystick buttons 2,3,4.....select,reset,player 2 fire (not very useful)

  Finally, the program supports command-line arguments to allow other shells
  and batch files to drive it.  It's usage is as follows:

  ATARI [gamefile] [BANK|BANK16|BANKA|BANKM|BANKP|BANKC|BANKSC|BANKSP]
        [DEBUG] [DISASM] [FRAMExx] [KB] [INDY500] [VTP]

  BANK........8k standard file
  BANK........16k standard file
  BANKA.......Activision "special"
  BANKM.......M-Network (would someone please tell me if this works?)
  BANKP.......Parker Bros.
  BANKC.......CBS RAM Plus
  BANKSC......Atari Super-Chip
  BANKSP......Starpath Supercharger
  DEBUG.......Use integrated debugger
  DISASM......Try to disassemble a 2k or 4k file to LISTING.ASM
  FRAMExx.....limit display to xx frames per second
  KB..........Emulate Atari keyboard controllers
  INDY500.....Emulate Indy 500 paddles
  VTP.........Emulate Video Touch Pad





6. Disclaimer (a.k.a. covering myself)

For the following discussion, this software, the PC Atari Emulator, will be
referred to as "PCAE".

The author of PCAE hereby grants unlimited license for users of PCAE to freely
copy it for personal use (I can't think of a reason why a company would want
to use it).  PCAE is supplied as-is; the author WILL NOT be held responsible
for ANY damages that may occur as a direct or indirect result of, or inability
to use, PCAE.  The author grants no warranty whatsoever, and none should be
implied.

                          USE IT AT YOUR OWN RISK.

As stated previously, PCAE may be copied and distributed freely for personal
use.  It MAY NOT be sold by anyone without prior written consent by the author
(after all, why would anyone want to sell this?)  It may be distributed as
part of a shareware/freeware package as long as not more than $7 US (1996
dollars) is charged for its distribution.  PCAE MAY NOT be distributed without
this document in its complete form.

PCAE emulates a commercial game system for which copyrighted software was
developed and still exists.  The author of PCAE hereby forbids anyone to
distribute PCAE in conjunction with any other copyrighted software (because
if anyone does, I don't want to be held responsible).  In addition, users of
PCAE are specifically forbidden from using it in any way with copyrighted
software for which they are not in legal ownership.  PCAE should IN NO WAY be
regarded as condonation of, or an excuse to commit, software piracy, and the
author will not be held responsible for the actions of others.

Whew!  (dammit, Jim, I'm a programmer, not a lawyer!)






7. And finally...

Well, I hope you like it.  If there are any problems please let me know.  I
might release the source code since the available time I have to support this
is limited; it'll depend on how many changes are requested.





8. Acknowledgements

This emulator was not written completely without help.  I would like to thank
the following people for their assistance (knowingly or otherwise):

Norbert Juffa for writing the millisecond timer used in the fps limiting code

Dan Melton for writing the keyboard interrupt service routine

Matt Conte for building the awesome homepage

Ron Fries for writing the sound routines, and Dan Boris for sending them to me

Everyone else who has sent suggestions and feedback, you know who you are!
