151 points · by doener · 1y ago · 25 comments
Jazz was as far as I know the only game to use odd/even mode, which is normally used for text mode, for 256 color graphics. It gives 128K of memory, extremely fast blitting and double buffering at 320x200 and is a super interesting hack, but it's almost completely undocumented. I only found out because QEMU made a mess of it until I decided I wanted to play some Jazz. :)
Isn't this similar(identical?) to the tricks John Carmack used to get side scrolling Mario clones like Commander Keen working on the PC platform, who's rudimentary graphics system couldn't do that back then?
256 color modes are a different beast. The VGA can only load four bytes at a time but those four bytes must have the same address and come from the four planes. So whereas the 16 color mode split the color information across planes, 256 color modes put a whole pixel in a byte and four adjacent pixels go into four planes. Normally you want 1 byte per pixel and ignore planes completely, so the hardware is programmed to remap bits 0-1 of the address to the planes and do some magic so that reads also work as intended. You can still do smooth scrolling in this mode, but double buffering requires more expensive copies from VRAM to main memory.
Michael Abrash then noticed that this is absolutely not necessary and you can use planes in 256 colors mode. Unlike Carmack's Keen, this was completely undocumented. In retrospect it's quite obvious: the VGA was composed of two completely independent pieces of hardware dealing respectively with CPU accesses to VRAM and creating the video output from VRAM contents, and as long as the two are programmed in a compatibile manner things just work. But still it's not how you were supposed to do 256 color graphics on the VGA.
This was called "mode X" and it gives you several benefits: VRAM to VRAM copies are cheaper, which you can use for both blitting and double buffering, and you have access to 256K of memory which enables higher resolutions (theoretically up to 360x480, in practice everybody used 320x240). This worked well for games like DOOM or Wolfenstein 3D that redrew the whole screen at once, however the wins for blitting were a lot less clear because dealing with the 4 planes meant more complicated routines and a lot of writing to the card's registers.
So what Jazz does is use a middle ground mode where you have bit 0 of the address used to pick 2 planes and the other 2 are picked through the video card's registers. Normally this is used in text mode so that even bytes describe characters and odd bytes describe colors, hence odd/even mode. Jazz applies it to 256 color mode and then it only addresses pairs of pixels at once, so that it doesn't have to program the video card registers as much as in 4-plane mode X. Essentially the graphics mode is a 160x200 matrix where each of the 160 horizontal cells is composed of two pixels.
Well...
Keen 1-3 only scrolled by a maximum of 16 pixels. After that, it would reset the scroll and copy the entire screen over by 16 pixels (one tile). In order to reduce the amount of copying, the levels were all designed with repeating patterns to minimise the number of changed tiles on each scroll.
Why? Because the documentation didn't say what happened if the hardware scrolling wrapped around, and Carmack carefully designed the engine to avoid this potential edge case. They named the technique "Adaptive tile refresh".
For episodes 4-6, Carmack was confident enough in the wrapping behaviour of hardware scrolling, and the engine was redesigned to take advantage of this. I guess they had tested enough 3rd party EGA cards to be sure they all behaved in the same way.
This removed the need for repeating patterns in the level, allowing for much improved graphics. Though they did need to add a compatibly mode that avoided wrapping across the 64KB boundaries, as some SVGA cards did the wrong thing.
So the scrolling was documented, but perhaps not well enough.
Although that website contains what must be the most egregious misuse of a hamburger menu I've ever seen.
https://arcadespot.com/game/earthworm-jim/
I think Jazz was the first game that ran smoothly on old hardware. Could be fun to pick up a full retro CD set like the Doom collection. The publisher should still consider the Steam store, as on a Deck the lower resolution wouldn't seem as dated.
Fun games =3
I remember sinking hours into this on my parents' Windows 3.1 machine (maybe it was an old dos box).
As for me, playing one of my favourite childhood games on real hardware again, with a good CRT and a Sound Blaster, almost made me cry, the nostalgia hit was enormous :S
- Pentium 2 at 300 MHz
- 384 MB of RAM
- Nvidia TNT2 Ultra
- Sound Blaster AWE64 Gold (the last ISA model, a PITA to get it working because modern ATX power supplies don't provide the -5V required by ISA cards, so I had to find an old enough PSU)
- 32 GB CompactFlash
- The cheapest CD drive, floppy drive, PS/2 keyboard and ball mouse, and speakers that I could find at my nearest junk store
- Sony Multiscan E200 that I got for free from a very generous office colleague!
- A proper beige box
- Windows 98 SE
The total cost was around 300 bucks, with the AWE64 being the most expensive component at 100 bucks. Not cheap, but well worth it for the nostalgia trip.
I would also like to find a Voodoo and a GUS, but they are ridiculously expensive nowadays.
I swear this is the kind of computer that sell for 30€ around here without the gpu (that you can get for 10€). Indeed the awe32 seems to be the most costly part but you can find it way under 100 bucks.
Might be regional.