tags:

views:

351

answers:

2

About 15 years ago, I used to amuse myself and annoy my CS teacher by writing bad code that would directly modify the text on the monitor. This was/is easily done by accessing video memory at 0xB8000 on VGA-equipped PC-compatibles.

Fast forward to today, I decided to try out my old trick through a debug port that gives me access to read physical memory. To my gratification, it still worked on the first platform I tried it on. Then, dishearteningly, I discovered that it doesn't work on many other systems. It seems that the systems it doesn't work on all have UMA (shared-memory) graphics.

So, a question for all of you BIOS writers, low-level OS guys, and video driver gurus - if I'm in regular 80x25 color textmode on a PC-compatible system with shared graphics memory, in real mode, and the contents of 0xb8000 - 0xB8FFF are all 0xFF instead of giving me what's on the screen, where did the screen buffer go?

+2  A: 

The CGA (Color Graphics Adapter) and MDA (Monochrome Display Adapter) cards used different regions. One (color) is at 0xB8000; but monochrome starts at 0xB0000. Remember, you could have both displays active on the machine at once.

See DOS Memory Map (although it has a typo in the offset for CGA - should be 8000h not 0800h).

As far as VGA (Video Graphics Array) goes, its memory starts lower, at the 640K boundary at 0xA0000 and continues for 64K - but it can go beyond, as the card could have up to 256K. Some sample code for programming VGA is here. But it isn't quite so simple as it has multiple video modes. You might try here for some help.

Are you sure you have VGA, and not EGA or XGA or Super-VGA? All of those have slightly different semantics... But still, I'm pretty sure any of those should put text either at 0xB0000 or 0xB8000. What happens when you type either

MODE MONO

or

MODE CO80

-- does that affect the display? Those would switch from one adapter text mode to the other, under DOS.

lavinio
I've scanned everything from 0xB0000 to 0xBFFFF - it's all junk (0xFF). The memory at 0xC0000 is the VGA bios as expected; that lets me know that my method of accessing memory is working, but doesn't help me grab the screen contents...
Drew Shafer
+3  A: 

Ah, if it's a BIOS screen then all bets are off. The fact that it's a BIOS on a motherboard with integrated graphics leans things even more in favor of video strangeness.

In all likelyhood "classic" VGA functionality is for all intents emulated. With an external video card this would be invisible to the BIOS - it still sees a VGA video card. But a BIOS hardwired to the video card wouldn't need to setup the fake VGA layer and old school 20 bit address space memory mapping just to stick some text on the screen.

Instead the BIOS may interface directly with the card (via some proprietary mode) until the operating system is actually going to be started up, at which point it does memory mapping itself. This has a major advantage in that for a card that shares main memory, you don't get a blank screen on startup if your RAM is incorrectly installed (instead the video cards propritary BIOS mode could use a buffer normally reserved for some other purpose, allowing you to get into the BIOS and see 0MB of RAM installed)

David
Yep - I was just informed by a coworker that Phoenix bios is using mode 12h. The video information is there at 0xA0000, but it's all pixels, no ascii characters. Bummer. Right answer, but a bummer ;-)
Drew Shafer