Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hpda!hpcupt1!hprnd!pyt From: pyt@hprnd.HP.COM (Pierre-Yves Thoulon) Newsgroups: comp.sys.ibm.pc Subject: VGA and Bit Mask Register: HEEEEEELP ! Message-ID: <1040010@hprnd.HP.COM> Date: 5 Mar 89 23:21:43 GMT Organization: HP Roseville Networks Division Lines: 51 I've been trying to play with my VGA card and I'm trying to use it in write mode 2 and to write ot a given pixel after setting the bit mask correctly. From I understand, if the bit mask register is set to 0, nothing should be happening when I write to the display memory, but every time I write a byte, I see an nice 8 pixel long line appearing on my screen, half green, half blue. What am I doing wrong ? Is there any register other than the Mode and Bit Mask registers that I need to program ? My test program looks like this: #define START (char far *)0xa0000000 #define END (char far *)0xa0009600 void main(void) { union REGS regs; char far *Address; regs.h.ah = 0; regs.h.al = 0x12; int86(0x10, ®s, ®s); /* set display mode 0x12 */ outp(0x3ce, 5); /* Mode register */ outp(0x3cf, 2); /* Write Mode 2 */ outp(0x3ce, 8); /* Bit Mask register */ outp(0x3cf, 0); /* all bits masked */ for (Address=START; Address < END; Address++) *Address = 4; /* paint pixel Red */ } I set the video mode to 0x12, but the same behavior occurs in mode 0x10. Instead of a nice black-remaining screen, I get vertical green and blue stripes. If I set the bit mask to something else than 0, the unmasked pixels are correctly painted, but the masked one are painted green or blue, depending on where they are in the byte. In a nutshell, I am unable to update a single pixel without trashing its 7 neighbors. What am I doing wrong ? Any help VERY MUCH appreciated. Desperately, Pyt "starting to see green and blue stripes in bed at night...". hplabs!hprnd!pyt BTW: I noticed that if I use write mode 0 rather than write mode 2 in the small program above, I still get these stupid green and blue stripes.