Mode 12h

Programming, for all ages and all languages.
REV

Re:Mode 12h

Post by REV »

This is what I got. Still I'm getting no pixel at posy and posx!

pixeladdress = (char *)0xA0000;
pixeladdress = pixeladdress + ((640 * posy) + posx) / 8;
bitoffs = ((640 * posy) + posx) % 8;
bitoffs &= 0x7;
*pixeladdress = (1 << bitoffs);

I have a feeling Ive done something stupid :(
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Mode 12h

Post by Candy »

I get the feeling something else is wrong. Are you sure that:

1. Mode 12h is actually enabled
2. You have mapped 0xA0000 to the physical 0xA0000
3. Your video card is VGA compatible
4. The two colors you're using are actually distinguishable (you're not trying to see the difference between two blacks, should normally not be a problem)
5. You're writing to a valid bit plane
?

Also, you're using a write which overwrites the other 7 bits with zeroes. You could replace that with:

Code: Select all

*pointer = (*pointer) & (~(1<<shift)) | (newval << shift)
REV

Re:Mode 12h

Post by REV »

Candy wrote: 1. Mode 12h is actually enabled
2. You have mapped 0xA0000 to the physical 0xA0000
3. Your video card is VGA compatible
4. The two colors you're using are actually distinguishable (you're not trying to see the difference between two blacks, should normally not be a problem)
5. You're writing to a valid bit plane
1. Yes I used the BIOS while I was in real mode
2. I have a global varible: unsigned char *pixeladdress = (char *)0xA0000;

3. What year is this? (in short yes)
I assume 4 and 5 are my proublem.
What can I do to fix this?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Mode 12h

Post by Candy »

REV wrote: 3. What year is this? (in short yes)
The question wasn't as cynical as it seemed. Since about 99% of all video cards will not be used as VGA card anymore, there (I have heard) are cards that aren't VGA compatible anymore, since it isn't used and just about all customers don't care.
I assume 4 and 5 are my proublem.
What can I do to fix this?
You can solve nr 4 by writing all colors to be very different. However, if you haven't written any colors, they should be distinguishable in any case (iirc, they are the full color spectrum you map with RGB + brightness, each either off or on).
Nr 5 is harder and I myself don't know how. You could ask Dex4U, he seems to know the actual implementation of Mode12 stuff a lot better.
dc0d32

Re:Mode 12h

Post by dc0d32 »

http://my.execpc.com/~geezer/osd/graphics/modes.c

works fine on all the machines i tried [VGA compat].
REV

Re:Mode 12h

Post by REV »

http://mcs.uwsuper.edu/sb/324/Intro/vga.html

I found that. Too bad it uses inline assembly. (Not that I hate assembly I don't like mixing it with C). Oh well. It looks good for me to start figuring this out.
earlz

Re:Mode 12h

Post by earlz »

there (I have heard) are cards that aren't VGA compatible anymore
hope their video driver never crashes or anything because windows actually relies on vga as a backup video driver
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Mode 12h

Post by Candy »

Jordan3 wrote:
there (I have heard) are cards that aren't VGA compatible anymore
hope their video driver never crashes or anything because windows actually relies on vga as a backup video driver
Still an "I've heard", not an "I've seen"... Am going to be looking out for those cards actively now. AFAIK, the PC text output was more like the Hercules cards, using int10 in textmode only. Windows uses this text output doesn't it?
earlz

Re:Mode 12h

Post by earlz »

iirc no except for in their little boot thingy(hold F8)
JAAman

Re:Mode 12h

Post by JAAman »

hope their video driver never crashes or anything because windows actually relies on vga as a backup video driver
actually, this is only true for win9x -- winXP safe mode (and with no drivers installed) uses 800x600x16bit (iirc) (prob vbe3 if its availible, though i dont know that for certain -- winXP is capable of using higher modes without drivers also -- that is why i asume it falls back on vbe) -- though it is possible to enable VGA mode, its a separate option -- not default
Post Reply