delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/01/19:18:38

Date: Sun, 1 Mar 1998 16:18:13 -0800 (PST)
Message-Id: <199803020018.QAA20601@adit.ap.net>
Mime-Version: 1.0
To: djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Accessing the ROM char set

At 04:30  3/1/1998 -0500, David Rager wrote:
>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.
[snipped]
>****** 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?

No. The `__dpmi_segment_to_descriptor' function takes a real-mode segment as
its argument. See below.

>      // 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

This is how real-mode memory segmentation works. Addresses are shown in the
form SSSS:OOOO where SSSS is the segment part and OOOO the offset part. In
real mode, the processor combines these like so: `(seg << 4) + ofs'. But
since you are not in real mode, you get to do it yourself when you want to
access conventional memory linearly.

>
>      // reading this? I thought I understood this till now.
>
>   unsigned short romCharSet_ds = __dpmi_segment_to_descriptor ();
>                                                                      //
>what do i put here? ^

Probably `0xF000'.
>
>      // 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.

Try `_farpeekb(romCharSet_ds, 0xfa6e)'.

>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.

Hope this has helped somewhat.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019