From: David Rager Newsgroups: comp.os.msdos.djgpp Subject: Accessing the ROM char set Date: Sun, 01 Mar 1998 04:30:08 -0500 Organization: University of Pittsburgh Lines: 116 Message-ID: <34F92AA0.14EFEA1F@pitt.edu> NNTP-Posting-Host: jbddup-a-1.rmt.net.pitt.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I've been trying to teach myself how to do graphics in djgpp by writing my own graphics library. I've been building up step by step, new functions as I learn how they are implemented. Right now I want to blit the characters in the ROM char set to the screen in mode 13h. Here's what I'm trying to do: (sample code from a book) void blitChar (int xc, int yc, char c, int color, int transparentFlag) { int offset, x, y; char far * workChar; unsigned char bitmask = 0x80; workChar = romCharSet + c * CHAR_HEIGHT; // romCharSet is F000:FA6E // CHAR_HEIGHT is 8 pixels (8x8) offset = (yc << 8) + (yc << 6) + xc; for (y = 0; y < CHAR_HEIGHT; y++) { bitmask = 0x80; for (x = 0; x < CHAR_WIDTH; x++) { if (*workChar & bitmask) { videobuf [offset + x] = color; // videobuf is A000:0000 } else if (!transparentFlag) { videobuf [offset + x] = 0; } // end if bitmask = (bitmask >> 1); } // end for offset += SCREEN_WIDTH; workChar ++; } // end for } // end blitChar ****** This is what I need to do in DJGPP: void blitChar (int xc, int yc, char c, int color, int transparentFlag) { int offset, x, y; unsigned char bitmask; unsigned char charoffset; unsigned char workChar; unsigned short video_ds = __dpmi_segment_to_descriptor (0xa000); // this needs to be A000:0000. This works with no problems. // what is 0xa000? is it the same as 0xa0000000? or 0x0000a000? // Yes, I know 0xa0000000 is considerabley larger than 0x0000a000 // (0x1 is 1, 0x10 is 16, 0x100 is 256, ok, trivial concept), but // why do i use 0xa000 here and 0xa0000 for nearptr functions? // what is this form of hex notation: xxxx : xxxx? how should I be // reading this? I thought I understood this till now. unsigned short romCharSet_ds = __dpmi_segment_to_descriptor (); // what do i put here? ^ // this is where I'm getting my troubles. I need to access // F000:FA6E // the video descriptor above is throwing me off. I'm not really // following what's going on there. // I tried to use 0xf000fa6e (obvious choice, but this function // takes a 16 bit int), 0xfa6ef000, 0xf000, // 0xfa6e, 0xf000 + 0xfa6e, 0xf000 and add 0xfa6e to my // charoffset, 0xfa6e and add 0xf000 to my charoffset, // and quite a few others. charoffset = c * CHAR_HEIGHT; offset = (yc << 8) + (yc << 6) + xc; for (y = 0; y < CHAR_HEIGHT; y++) { bitmask = 0x80; workChar = _farpeekb (romCharSet_ds, charoffset); // I get some really strange stuff from here. for (x = 0; x < CHAR_WIDTH; x++) { if (workChar & bitmask) { _farpokeb (video_ds, offset + x, color); } else if (!transparentFlag) { _farpokeb (video_ds, offset + x, 0); } // end if bitmask = (bitmask >> 1); } // end for offset += SCREEN_WIDTH; charoffset++; } // end for } // end blitChar What am I doing wrong/what should I be doing? Yes, I read through the FAQ. Unfortunately, it is a FAQ and not a tutorial. It seems to be geared toward people who already know what they are doing. So most of the questions I have are not addressed in it (probably trivial to others). You won't go over my head. I just need steered in the right direction. Please post any responses here and e-mail me if possible at djrst14+@pitt.edu Thanx. Dave.