Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!uiucdcs!uxc.cso.uiuc.edu!uxe.cso.uiuc.edu!mcdonald From: mcdonald@uxe.cso.uiuc.edu Newsgroups: comp.sys.ibm.pc Subject: Re: EGA's memory Message-ID: <45900110@uxe.cso.uiuc.edu> Date: 21 Feb 88 15:04:00 GMT References: <2171@bsu-cs.UUCP> Lines: 61 Nf-ID: #R:bsu-cs.UUCP:2171:uxe.cso.uiuc.edu:45900110:000:3099 Nf-From: uxe.cso.uiuc.edu!mcdonald Feb 21 09:04:00 1988 >I understand about how there are the different bit planes and stuff, >but heres the deal: >My card has the full 256k, and you start counting at $A000, that means >that it runs to $DFFF. This doesn't run true, because I have rom routines >for my hard disk at $C800. So how does one access the high 128K of the card? >(I know that 128k runs from $A000 to $BFFF) First you must understand the wierd way the EGA does colors, which apparently you don't fully understand. The memory in a full 256k EGA, when in mode 15 or 16, the ones for 350x640 pixels, runs from address 0xA0000 to 0xAFFFF. That is 65536 bytes of address space. It doesn't go any higher. The trick is that at any given address, say 0xA0000 itself, there are actually 4 bytes. A memory reference instruction, say mov (memory),ax ,will load zero, one, two, three or four of those bytes at once depending on how the "plane mask" register is set. If you read them , you can do it in two ways: set a read mask register to either 0, 1 , 2 or 3, and you will read 8 bits from one plane. Or you can set the "color compare" register to a value from 0 to 15. In this case the four planes for each bit make a 4-bit word. That is, there are 8 4 bit words at that address. Each one is compared to the register. If a 4-bit word at, say, the 2 bit position of the 8-bit memory word compares the same as the register, the 2-bit of the word you read from the EGA is a 1, otherwise it is 0. I that clear? ( No, but it is all I can do in one page.) >And what is it used for? You will note that 640X350 is only 28000. This means that there is room for two full pictures at that resolution. There are two good uses for that. One, used by Codeview (I presume), would allow you to store your picture (or text) in one, and use the other for a debugging screen. The second use is for animation. You draw a picture in page 0 while page one is displayed, and vice-versa. This allows blinkless, seamless animation. This is used (on a CGA) by , for example, Flight Simulator. >I know there are ram based fonts somewhere, but where? There is a ROM bios call to tell you. Look in the manual (IBM Technical Reference Manual, Options and Adapters.) >and how? >can you, in the 640 x 350 graphics mode, create text attributes? >(I'm looking for Blink if anyone knows). Oh my, you're in trouble. There is no blink in graphics mode! You set the timer interrupt to point to your program, and at the appropriate time, redraw the letter yourself (ugh.) In fact, the BIOS doesn't support full text attributes in graphics mode. In particular, you can have any background color you want as long as its color 0 (not necessarily black.) Different characters cannot have different backgrounds. If you need this, or if you need to draw characters over previously existing graphics, you have to do it yourself. Look in a graphics package I recently posted to comp.sources.misc called "Egafast". This does the text bit. If you want a green letter with a red background, overlaying anything previously there, draw a red character 219, then a green letter. Doug McDonald