From: "Darryl Gates" Newsgroups: comp.os.msdos.djgpp Subject: Need help loading BIOS fonts... Lines: 75 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: Date: Mon, 22 Jan 2001 18:31:16 GMT NNTP-Posting-Host: 24.65.238.3 X-Complaints-To: abuse AT home DOT net X-Trace: news1.rdc1.ab.home.com 980188276 24.65.238.3 (Mon, 22 Jan 2001 10:31:16 PST) NNTP-Posting-Date: Mon, 22 Jan 2001 10:31:16 PST Organization: Excite AT Home - The Leader in Broadband http://home.com/faster To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi all, I'm trying to load the BIOS fonts (which I've been told are at 0xffa6e) into an array of my own so that they can be drawn to the screen in graphics mode (I'm using mode 105h). Anyway, I have no problem doing this when I use __djgpp_nearptr_enable(), but I want to be able to do it with _farpeekb(). I try setting my segment base address to 0xffa6e and then copying them over, but it doesn't seem to be working. Here is my chunk of code that I'm using. I've tried to search this ng and look through the FAQ, and I still haven't got it right. Any help or insight into what I'm doing wrong would be greatly appreciated... void load_fonts() { // just a counter! int i; // This is the address that the fonts are at in memory int font_address=0xffa6e; // The following section uses near pointers #ifdef NEAR_PTR // Use when getting fonts with near pointer // This is done in load_fonts() when using far pointers char *rom_char_set=(char *)0xffa6e; // Load the character font from ROM using near pointers character_set=(char*)malloc((256<<3)*sizeof(char)); __djgpp_nearptr_enable(); rom_char_set += __djgpp_conventional_base; for(i=0;i<(256<<3);i++) { character_set[i]=rom_char_set[i]; } __djgpp_nearptr_disable(); // The next section uses far pointers #else // So we need to set up a descriptor in the LDT font_descriptor = __dpmi_allocate_ldt_descriptors(1); // Now we have to set the base address for the segment that has // the fonts. We use the font_address. __dpmi_set_segment_base_address(font_descriptor,font_address); // Okay, the segment base address has been set, so we have to reset our // font_address to 0, so that we can index through the array of fonts // and copy them all to our array font_address = 0; // Now we set the segment limit so that we don't grab stuff that's // outside of the ROM fonts. This is just the number of bytes that // the fonts take up in memory (256*8 or 256<<3) __dpmi_set_segment_limit(font_descriptor,(256<<3)); character_set=(char*)malloc((256<<3)*sizeof(char)); // Now we want to just go through the list of ROM fonts in memory // and copy that exactly into our array. This is the easy bit! for(i; i<(256<<3); i++) { character_set[i]=_farpeekb(_dos_ds,16*(i+0xffa6e)); //character_set[i]=_farpeekb(font_descriptor,i); /* This won't work. _farpeekb needs to be called with _dos_ds as its first argument, and 16*segment+offset (i.e. 0x449) as its second. See section 18.4 in the FAQ. */ #endif } }