¶Altirra 1.1 released
I finally have some time lately to flush out some of the stuff I've had going on lately, and since all my latest VirtualDub work went out with 1.9.2, it's time for something else. A while ago I posted the first version of Altirra, my Atari 8-bit computer emulator. Due to some encouragement from some friendly people on AtariAge, I went back and fixed a whole bunch of emulation bugs in the emulator, and the result is version 1.1:
(Update: Links to version 1.1 removed -- superceded by current version.)
As proof of its worthiness of release, I present my in-emulator triumph over evil in The Last Starfighter:
The primary improvements are a lot of undocumented features implemented in GTIA, a couple of fixes to POKEY, and several tricky but important timing fixes in ANTIC. The display code now also does aspect ratio locking (a feature that I need to integrate back to VirtualDub).
Working on an emulator for an old computer system is basically working to an inflexible, and unfortunately incomplete, spec. I have access to the official Atari Hardware and OS reference manuals, which describe all hardware registers and kernel calls in the system. You can write an emulator that exactly conforms to those specifications and the result is that you will be able to run maybe half of the software that was released. The other half won't work because it depends on undocumented behavior such as when the display list interrupt bit resets (scan line 248) and the exact number of clock cycles it takes to enter the vertical blank routine (47-53 for XL OS). The spec is unrelenting and frozen -- unless you have a time machine, there is no way to change it. Therefore, you will implement exactly what the hardware does, period, and anything less is a bug. It gives you some appreciation for when you do have leeway to get specs changed to ease implementation.
There is one feature that I wanted to get into this version that I couldn't, which is artifacting. Artifacting is a phenomenon of composite video where unfiltered high frequencies in luminance are misinterpreted by the TV as colors. In NTSC Ataris, the high-resolution modes output pixels at a rate exactly twice the color subcarrier, which means that alternating luminance values produce colors instead of patterns. NTSC is designed with frequency interleaving to mitigate this somewhat, but the Atari produces non-interlaced video with a constant color subcarrier phase, defeating this. The way I tried to simulate this was brute-force, simply converting the video screen to a virtual 13.5MHz (4*Fsc) signal and then separating it out to Y/I/Q with FIR low pass and high pass filters. Well, the result kind of sucked, with an exceptionally blurry luma output and visible rippling in artifacted areas. The result on a real Atari with my LCD monitor's composite input looks significantly better, which leads me to believe there's something I'm missing, possibly a non-linear separation algorithm.
Changelist after the jump.
Version 1.1 [May 12, 2009]:
* CPU: Added an option to disable illegal opcode support.
* Disk: Added .XFD support.
* Disk: Added rudimentary hard disk (H:) support.
* UI: Added exception handler to write crash information.
* UI: F8 now also breaks into the debugger.
* UI: Fixed some window activation issues in the docking system.
* UI: Display is now locked to correct aspect ratio.
* UI: Dockable panes are now based on percentage rather than absolute width.
* UI: Changed location of Registry key to work around antivirus false
* Cartridge: Added support for cartridge images that have headers.
* Cartridge: Added support for MaxFlash 128K and 1M cartridge formats.
* Debugger: F5/F8/F9/F10/Shift+F10 now work.
* Debugger: Frames are now double-clickable in the call stack window.
* Debugger: F10 now works in the console command line.
* Debugger: Added history window.
* HLE: Rewrote HLE kernel mode to be based off the LLE kernel for better
* Simulator: Init and run vectors are now implemented properly -- fixes
New Year's Miracle demo.
* Simulator: $FFFF optional headers in executables no longer produce load
* Kernel: DRKMSK was not set -- fixes missing status bar in The Last Word.
* Debugger: The start of instruction PC is now reported instead of the CPU
raw internal PC.
* Debugger: Fixed infinite loop when viewing disassembly beyond $FFFF.
* Debugger: Disassembly view edit window now works.
* Debugger: Fixed a cycle being lost by the CPU on each step or breakpoint
* Debugger: Console window now scrolls to bottom when updating.
* UI: Implemented some Ctrl+Key combinations.
* UI: Fixed jittering problems in full-screen mode.
* UI: Fixed some focus problems when docking and undocking panes.
* UI: Full-screen mode no longer shows window borders when using GDI or
DirectDraw for display.
* UI: Removed horizontal and vertical blank regions from display window.
* UI: Caps Lock now works.
* UI: Mouse pointer is now hidden in full-screen mode.
* Disk: Improved disk emulation compatibility with SpartaDOS X.
* Disk: Fixed corruption of first byte on sector writes.
* Pokey: Added missing channel 2+4 high pass filter.
* Pokey: Fixed off-by-one in 1.79MHz 16-bit timing that screwed up some demos
using 4-bit polynomial beats.
* Pokey: Pot scanning is now implemented.
* GTIA: Color mixing with PRIOR D0-D3=0 now works.
* GTIA: Fixed incorrect luminance for background in 16 color mode.
* GTIA: Fixed player/playfield priorities in 9 color mode.
* GTIA: Fifth player now mixes in PF3 color properly in 16 color/luma modes.
* GTIA: Color registers no longer have four luma bits.
* GTIA: ANTIC modes other than 2, 3, and F now work with GTIA modes.
* GTIA: Implemented psuedo-mode-E caused by resetting the GTIA mode mid-scanline.
* GTIA: Collisions now register in 9 color mode.
* GTIA: Implemented one color clock shift in 9 color mode.
* GTIA: Changing HSCROL in the middle of a mode line now works.
* ANTIC: Corrected WSYNC, DLI, and VBI timing.
* CPU: Fixed instruction timing for read-modify-write opcodes using abs,X