Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!killer!chasm From: chasm@killer.DALLAS.TX.US (Charles Marslett) Newsgroups: comp.sys.ibm.pc Subject: Re: VGA and Bit Mask Register: HEEEEEELP ! Summary: READ the byte first to load the latches Message-ID: <7467@killer.DALLAS.TX.US> Date: 7 Mar 89 14:10:34 GMT References: <1040010@hprnd.HP.COM> Organization: The Unix(R) Connection, Dallas, Texas Lines: 46 In article <1040010@hprnd.HP.COM>, pyt@hprnd.HP.COM (Pierre-Yves Thoulon) writes: :> 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. :> . . . :> 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++) To load the 32-bit latch register, insert a read operation here: junk = *Address; /* loads the latches so unmodified bits are OK */ :> *Address = 4; /* paint pixel Red */ :> } :> The effect you were seeing was the contents of the latches (left over from long ago) being copied into the current byte in memory (bye-bye other 7 bits). :> Desperately, :> Pyt "starting to see green and blue stripes in bed at night...". :> hplabs!hprnd!pyt Charles Marslett =========================================================================== Charles Marslett STB Systems, Inc. <== Apply all standard disclaimers Wordmark Systems <== No disclaimers required -- that's just me chasm@killer.dallas.tx.us