Drawing in VGA using Visual C++ 5.0
Posted on 1998-09-14
I'm writing a small library that is supposed to write to a VGA graphic card. I need to test this library with visualC++.
I know how to program VGA mode 18 using registers.
But I don't know how to switch the screen into VGA mode.
I have a borland sample program that is doing it the following way:
#define int10 0x10
union REGS regs;
regs.h.ah = 0;
regs.h.al = (char)18;
Great but I can't find REGS and int86 in Visual C++.
I know the screen is at 0xA0000000;
And color register is set by
outportb( 0x3C4, 2 );
outportb( 0x3C5, color ); /* one of 0..15 (15 = black) */
Bit mask is set by
outportb( 0x3CE, 8 );
outportb( 0x3CF, mask );
Writing into screen memory requires reading the byte first because a latch reset required. (that's what I was told).
Then one can write bits into screen memory.
I would like to be able to try this from Visual C++ 5.0.
I know it is crazy to try drawing into VGA that way but apparently some crazy computer science teacher beleive it is still extreamly important to know how to do so.
Any help would be welcome.