Mail Archives: djgpp/2001/01/23/05:18:11
On Mon, 22 Jan 2001, Darryl Gates wrote:
> // So we need to set up a descriptor in the LDT
> font_descriptor = __dpmi_allocate_ldt_descriptors(1);
You don't check if __dpmi_allocate_ldt_descriptors failed: error no.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);
`font_address' is 0xffa6e, which doesn't have its low 12 bits zeroed,
which might cause __dpmi_set_segment_base_address to fail: error
no.2. You don't check if it did fail: error no.3.
> // 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));
The segment limit should be 1 less than the size (i.e. 256*8 - 1):
error no.4. You didn't check if __dpmi_set_segment_limit failed:
error no.5.
> // 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.
What does it mean ``won't work''? Does it crash? If so, post the
crash message.
> _farpeekb needs to be called with _dos_ds as its
> first argument, and 16*segment+offset (i.e. 0x449) as its second.
That's not true: _farpeekb can be called with *any* selector, not just
with _dos_ds.
- Raw text -