Let's Code MS DOS 0x11: The Mysterious VGA Mode X

preview_player
Показать описание
So far we programmed the VGA card using mode 13h, which gave us 256 colors at 320x200 pixels. That mode is easy to program, but has very little features. No scrolling, no page flipping. Animating things is pretty hard or flickery at times using this mode. Most games that used the VGA card used a different, undocumented mode: it was called Mode X.

Рекомендации по теме
Комментарии
Автор

I used ModeX in my Deluxe Pacman game for DOS, mainly for the 320x240 resolution which has more screen space and square pixels. I didn't redraw the entire screen each frame though, instead I done what is called "dirty rectangles" where I stored a linked list of the square areas of the screen that changed each frame and then only redraw those areas. This was MUCH faster than redrawing the entire screen.

NeilRoy
Автор

i couldn't resist, i stopped everything i was doing to start this series. these graphics modes have always been a mystery to me. i can't wait to see the scroll / pan part.
this is the best and only tutorial available on yt :)

LeoOno
Автор

I really enjoyed reliving my first days of PC programming, and yelling at the screen about shift operator precedence. Although I never bothered with Mode X back in the day - it was too much work for a kid just playing around with graphics.

jimmy
Автор

You're so good at explaining this. I have the yellow SVGA book and one of Abrash's books, but I never felt comfortable exploring mode X much until watching this (I never like putting anything in my code that I don't fully understand). I like that you start with Mode Y and not X because it gets a fair bit of complexity out of the picture to begin with.

rayforceaddict
Автор

The great thing about Mode X is that you can write up to 4 horizontal pixels at once (if they are the same color, e.g. for filling polygons) by setting the mask bits accordingly. And using the latches (read then write), you can blit between different locations of VGA memory and even apply some operations (e.g. bitwise OR with the value you write), again 4 pixels at once.

ThomasPerl
Автор

High quality video in setting up and using Mode Y, thank you. But Mode X was only mentioned, correct? I understand: a lot of people feel Mode Y is better than X. But I'm here for Mode X -- 320x240 res ... sorry, did I misunderstand? Is Mode X tutorial and usage in here somewhere?

spearsg
Автор

I am still traveling through series puting like for every episode !

IExSet
Автор

Thank you very much for sharing the source code.

szaman
Автор

WOW! Is that Turbo-C++?! I did an SVGA library using that... a million years ago! <3 <3 <3

edgeeffect
Автор

@2:25 What does it mean "only one bitplane is active at a time?". What do we mean by the word "active"?
My guess: Only one bitplane can be read/written by the host at a given time.

sahhaf
Автор

I coded this and after some troubleshooting, I got it to work... except it only cycled through the last 3 frames (frames 2, 3, and 4). I watched the video starting at 37:38 slowed down to 1/4 speed and noticed @root42's code also only showed 3 frames.

tigerleep
Автор

I never understood why Mode X was set up using mode 13h as the base. In my program, I used the mode 12h 640x480x16 as a base of mode X. In addition to the palette registers, only 3 other registers needed to be modified and minimal modification to the CRTC. - Has been very compatible, the mode and the program run fine on bare metal DOS boot on 6th generation Intel.

jussiala-konni
Автор

I don't program but this was still interesting. Gave me some insight into why 320x240 was so "taboo" in VGA game support, more complex to setup than 320x200 but with some nice advantages though. :)
I'm more a pixel artist but been trying to consolidate old DOS screen modes with modern display issues and hindsight parameters. I settled on 320x240(8x8 tile), 320x180(8x6 tile), and 320x120(8x4 tile) as a systemic height reduction approach. It's a way to maintain a 40x30 tilemap standard regardless of any vertical resolution loss. Do you think that could work?

loganjorgensen
Автор

I'd probably do Mode Y instead of Mode X just because there's much less pixels to update. Sure, they're tall pixels, but I really don't mind using GIMP's Print Size option to design for 5:6 pixels.

Do you plan to do Mode Q, by the way?

Nikku
Автор

The unfortunate part is by the time public knowledge of Mode X came about (via Dr Dobbs et al), we already had Watcom C & SVGA modes available, making it largely unneeded. Also, if you read Fabian Sanglard’s book on Doom, you see that id, a major user of that mode, had to make fairly major concessions in order to get the speed from it; rotating sprites etc to fit the vertical prioritized drawing needed for the unchained/planar pixel order. Barely seemed worth the tradeoff, although it’s hard to argue that id didn’t become who they were as a result of their games looking far more advanced than their competition.

NinjaRunningWild
Автор

Interesting. Did you know you can use "x++" instead of "x += 1"? Same goes for subtraction. Not just in for loops!

PeterSwinkels
Автор

I want someone to do 320x175 mode just for the hell of it. It's EGA 350 lines as emulated by VGA, but toggle double scan, 320 pixel line clock.

rootbeer
Автор

I found it frustrating that you felt the need to write a comment about something as simple as using a shift right for divide but skimmed over how the masking works to select the byte plane.

cosmicrdt
welcome to shbcf.ru