Oldskooler Ramblings

the unlikely child born of the home computer wars

CGA Corruption

Posted by Trixter on November 8, 2006


The majority of my 15 minutes of fame, it seems, has come from google video and youtube, with my 8088 Corruption demonstration. I did it mostly to impress other demosceners at a wild compo, but I’ve received at least 100 emails about it, had it reverse-engineered, and had unix and gameboy players made for the data file… it’s quite humbling.

Ever since then, people have asked for more. While I can easily do more — the framework supports 60 frames per second instead of the 30 used in 8088 Corruption, and let me tell you, 60fps CGA video is wickedly creepy — I have always wanted to do a “proper” 8088 megademo. This means it would work off of two floppy disks, use no more than 640K of RAM, use the internal speaker for sound, and of course, work with stock CGA.

That may not have the “wow” factor of 8088 Corruption, but just like the numa numa guy, you can never really make a sequel to an internet phenomenon, can you? It never turns out as good. So I’ve pretty much made up my mind that, should I ever have the free time to make another oldskool demo, it will feature — amongst other things — 60Hz CGA demo effects.

I can hear it now: “CGA demo effects? CGA sux! CGA has 4 ugly colors, slow memory, and only one video page! What are you going to do, make it look even shittier?” Well, non-believer, I’ve been dorking with CGA for a while and have already come up with some neat stuff. But the concept went into 2nd gear when my old friend Andrew Jenner (the guy who reverse-engineered Digger) contacted me with some CGA questions and we got to talking, then experimenting. You see, Andrew has been working with the MESS guys trying to get their CGA emulation 100% perfect, and has been studying the Motorola 6845 character generator documentation and CGA tech reference for weeks, so he had some unique insight I never had the patience for.

Here’s a taste of what we’ve been able to do with stock CGA on a regular XT:

100% successful:

  • 160×200 two video pages
  • 320×100 two video pages
  • 256×128 two video pages (great for sprites)
  • 320×100 full-screen interleaved with two video pages
  • the ability to shift the screen left and right in two-bytecolumn increments on any scanline

50% successful:

  • 640×200 in 4 colors (not a typo!) but every other column doesn’t latch memory quickly enough so every other bytecolumn is garbled)
  • 320×100 full-screen non-interleaved (desired scanline pattern would be aabbccdd but it comes out ababcdcd)
  • 160×400 interlaced (both sets of lines are generated properly by the MC6845, but the surrounding CGA hardware doesn’t half-shift the second set so you get 200 flickering lines instead of 400 individual lines)

Should Be Possible But Untested Due To Lack Of Time:

  • Changing display memory offset every other scanline
  • The ultimate bomb: Text and graphics mode splitscreen! I’m serious!

When I have trouble falling asleep at night, I think of the possibilities… then shortly before I drift off to sleep, I remind myself of what a colossal nerd I must be. But still, it’s very satisfying doing things that nobody else has done, let alone even thought of.

Advertisements

11 Responses to “CGA Corruption”

  1. I can hardly wait! It would be fantastic to see all these things in a real demo.

    Btw, I worked out today that in graphics modes on a composite monitor, the CGA is capable of exactly 349 different colours. Though some of them may not be distinguishable from one another on most TVs, they are all technically different colours as they have different digital representations before they get converted into an analogue signal. Also 88 different palettes are possible (though 3 only contain one colour and another 6 are just 3 or 5 different shades of grey).

  2. Wicked! It looks like you’ll have a place to show off too, since Blockparty is coming up in late April (http://demoparty.us). Going to be a goooood time.
    Now speaking of the Demoscene, I’ve begun uploading clips from NAID ’96 to youtube, starting with the tracking seminar given by Andy Sega. It’s by no means comprehensive, but it’s a good illustration of how things were done “back then”(uuuhg). Anyway, that can be found at http://youtube.com/watch?v=ROSJ3-NH0oQ . That’s the only one at this point, I’m thinking of uploading some of the award cermony speeches or music performances next.

  3. Trixter said

    Sweet lord, I thought Andy’s tracking seminar had been lost!!! That totally made my day! I remember thinking how in awe I was as he literally whipped around that program, even the audience was amazed. That is great news.

  4. Trixter said

    Is there any more than just the 3 minutes? There was a lot of great stuff in that seminar, like Basehead’s syncopation and other stuff.

  5. Sadly, that’s all she wrote. My camera’s battery died at the point where this clip ends.

  6. Optimus said

    Wow, wow! I am really looking forward for that!!!

    You are the only guy working on such crazy stuff for old PCs who nobody cares about anymore but I am one of the sceners who truly admire your dedication :)

  7. You literally CAN change the memory offset on every scanline, but as far as I can remember that is a major CPU hog: you need to sync to horizontal scan — as far as I can remember the CPU was too slow to do this using loops and the timer resolution too horrible to do this properly using the PIC. I’ve done this successfully on a 80386 but I’m not sure ye olde ’88 is up to the task.

    On the other hand, I would be really interesting in seeing it in action if you DO get it to work. Time to dust the old XT? :-)

  8. phoenix said

    A little late with a reply, I know.. just added your feed to livejournal (trixterblog).

    I remember Miracle’s Never Assume demo from NAID’96 had a split textmode/graphics screen at the end! The endpic remained on screen while the text screen with the DOS prompt at the bottom scrolled up. Or down, maybe. It worked when I first saw it but bugged a bit on newer/faster PCs.. dunno if it was the video cards or the OS.

    There was also this VGA test app which always came with video card disks in the 90s that showed all your wonderful SVGA resolutions. It also showed off some cool textmode tricks. I remember the smooth X & Y scrolling, and smooth split screen scrolling!

    If and when you find time for 8088 coding, would you do color composite graphics or just pure RGB monitor?

  9. Trixter said

    Most if not all of those tricks are VGA-specific, so trying to do them on CGA requires mucking with registers realtime, something the 8088 is *almost* too slow to do. :-)

    As for “real” CGA graphics, I’m not sure, but I’m heavily leaning toward composite color. This is because the graphics routines are much simpler (each pixel is a nybble), I have a much greater palette of colors to work with, and I can connect the composite CGA output directly to a capture device or projector if I want to exhibit my work. So we’ll see :)

  10. sbeam said

    I have been thinking if it´s possible to change the color for every scanline in 640×200 mode, so you could do multiple color raster bards in hires? But as far as i can see the only way to determine horizontal retrace is to calculate the timings yourself.

    I have been looking for ages for a CGA monitor, but only yesterday found out that my Commodore 1901 monitor was able to drive a CGA card, so i have´nt experimented with it yet. But after reading just a little bit i already started to get funky ideas :) Care to share any tricks?

  11. Trixter said

    It is indeed possible to change the palette and/or background color every scanline, and on anything other than the PCjr you can do this by monitoring the horizontal retrace bit. As for palette AND background color, it’s close to the wire but it can be done. I was going to write a GIF viewer someday that used all 16 colors like this in an “IFLI” manner like C64 but I think I’ll save that technique for a future demo instead.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: