Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!gatech!emcard!stiatl!john From: john@stiatl.UUCP (John DeArmond) Newsgroups: comp.sys.ibm.pc Subject: Re: VGA and Bit Mask Register: HEEEEEELP ! Message-ID: <3552@stiatl.UUCP> Date: 6 Mar 89 21:47:16 GMT References: <1040010@hprnd.HP.COM> Reply-To: john@stiatl.UUCP (John DeArmond) Organization: Sales Technologies Inc., Atlanta, GA Lines: 44 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. >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. The problem here is very simple. First you gotta remember that you are dealing with IBM-designed hardware which is to say "it's straaaaange". Normally, when you think of a 4 plane color video system (RGBI) you would think the memory would be arranged so that adjacent bits in a byte would address different color planes. bit 0 is red, bit 1 is green, bit 2 is blue, etc with perhaps 2 pixels per byte. Well, IBM did not do it that way. The arranged 4 parallel sets of memory so that each logical address can address any of 4 physical memory banks depending on the setting of several registers in the controller. Within a plane, a byte represents 8 adjacent pixels (even this depends on the mode - I'm assuming 640x350 right now). You can either set up dot writes to a plane or you can use a {semi, poorly} documented mode whereby a plane is mapped into the processor address space. You then write one plane at a time. To set or reset a specific pixel, you must retrieve the applicable byte and mask the bit. Sorry if i'm short on specifics but it's been awhile since I worked on this. I'll be glad to scrounge some code up from home that implements this write and read VERY fast. I'd also suggest you buy a book from Microsoft Press called "Programmers guide to the IBM video adaptors" or something like that. You can tell it right away because the listings are printed in some of the worst icky green ink you ever tried to read. There are some bugs in this book but my code documents the ones I've found so the book should be of real value if you are really hacking an EGA/VGA card. John -- John De Armond, WD4OQC | Manual? ... What manual ?!? Sales Technologies, Inc. Atlanta, GA | This is Unix, My son, You ...!gatech!stiatl!john | just GOTTA Know!!!