Hacker News new | past | comments | ask | show | jobs | submit login
Mode X (wikipedia.org)
87 points by 32bitkid on March 21, 2015 | hide | past | favorite | 17 comments



Mode X was cool. When I was 13, I had a hand-down IBM PS/2 with an actual VGA adapter (most PCs had a clone, not the original IBM hardware).

I spent a day or two basically putting random values in VGA registers, because I didn't understand what most of the values represented or how they interacted. By trial and error, I discovered a 320 x 600 mode with 256 colors that ran at 50Hz.

With that mode, I could make a fake truecolor image display program that presented 320 x 200 24-bit images: the trick was simply to draw red, green and blue on separate scanlines, and you could count on the CRT to have enough of an afterimage to blend them together.

It worked ok (at least on my 12" IBM-made CRT), and I was very proud to have created a truecolor mode on plain VGA. But then I tried it on a friend's clone PC with no luck.


> With that mode, I could make a fake truecolor image display program that presented 320 x 200 24-bit images

The classic PC demo "Unreal" from 1992 did something similar [1]. I believe they used Mode X at 320x400 or 320x480.

[1] https://youtu.be/pLJhtefcoPE?t=5m31s


Another interesting thing you could do with the VGA was use slight color deviations to get 256 shades of gray instead of 64 (the VGA had 6-bit DACs). So instead of incrementing red, green, and blue all at once in your palette entries, you would bump one channel at a time. Depending on the use case, it could look better to have the slight color variation than the harsh banding of only 64 shades of gray.


Unlike what the Wikipedia article says, the main advantage was not the square pixels. Although that was nice, the killer features were double buffering and hardware scrolling. Double buffering allowed you to draw to an off-screen buffer and switching to show it instantaneously after rendering, and hardware scrolling allowed you amazingly smooth arcade/console-like game backgrounds.


The best ModeX variant I used was at the very edge of what the hardware and monitor could manage.

400x300 87Hz.

I modified one of my games at the time to use it and It was comically difficult to play because the movement was synced to the framerate and consequently played almost 50% faster.

I always wanted to write a paint package for it using temporal dithering. You can get away with a lot with a 43Hz dither. Mixing colours of similar luminosity doesn't flicker annoyingly at all and gives you way more than 256 colours


Oh man, I remember getting deep into this because of "Denthor's Asphyxia Tutorials" in pascal and C - I went looking for them again recently, but ended up just chasing a trail of dead links: does anyone have them lying around?!


Hornet archive still has them https://hornet.org/


I also remember those days...

A quick google search, and I found these: http://archive.gamedev.net/archive/reference/listed82.html?c... (clicked a couple of links, they do not seem dead)


Mode X and all the flavors are what really got me into programming. Turbo Pascal + inline assembler. Good times.


Sadly this still needs implementation in the open-source JavaScript x86 emulator v86: https://github.com/copy/v86/issues/26


My first brush with assembly was for mode X. I remember bliting bitmaps with transparency.


There is probably an entire generation of developers that typed mov AX, 0013h followed by int 10h more than just once.


I have so many great memories of learning coding by writing little games that used Mode X for the graphics.

I was able to get so much experience experimenting to optimize my code to draw stuff on screen fast enough to get a decent frame rate, and I learned a lot about pointers, memcopy, peek, and poke, etc. One of my biggest "breakthroughs" was when I realized that drawing sprites by looping through one pixel at a time with an if statement to either draw or not draw depending on whether the pixel was transparent wasn't as fast as preprocessing the sprite using a form of RLE and then copying strips of pixels in one operation with memcopy, essentially skipping over the transparent areas for free. Later I found out that technique had already been around for decades, but 11 year old me was super excited when I figured it out.


I 'invented' that RLE trick too! I also had control codes that would create patterns and dithers. Oh the hoops I jumped through to get 50 Hz scrolling on a 486 - good times.


Neat. I fondly remember the trick on the Apple IIgs to get 3,200 colors on the screen at one time[1]. The VGC chip had a 320x200 video mode with 16 color palettes. The VGC could hold 16 palettes in memory at a time, but you could swap palettes in and out of video memory, resulting in each scan line having its own palette of 16 colors, allowing 3,200 (200x16) different colors to be displayed on the screen at once. Because it was CPU intensive you couldn't do much else, but at the time it was pretty cool.

[1] http://en.wikipedia.org/wiki/Apple_IIGS#Graphics_modes


I miss this mode. So many games that... work in DosBox now, don't they. Welp, there goes my weekend.


Mode X. Nostalgic. It was my school project to write graphics driver for Mode X for game developers.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: