Message-ID: <3698DDFD.133F233A@net4you.co.at> Date: Sun, 10 Jan 1999 18:06:05 +0100 From: Seawolf X-Mailer: Mozilla 4.07 [de] (Win98; I) MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Pointer to memory References: <36985DB7 DOT C5C7D160 AT 2xtreme DOT net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 194.177.154.90 X-Trace: 10 Jan 1999 18:05:03 +0100, 194.177.154.90 Lines: 90 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > I am trying to port some code, for reading the fonts in ROM for DOS. > Anyway, what I need to do is to get the memory location of this... I > have 2 pointers... segment and offset... > > And I want to have the pointers added, for example if the segement is > 0xAA and the offset is 0x03 then I can make a pointer to 0xAD... > > The code I am trying to port looks like this: > > char *offset=regs.x.bp; > char *segment=regs.x.es; > > char *font=*MK_FP(segment, offset); > > That is the code... the last line is the one I am having trouble with... > Thanks for the info, I hoped I described this well enough. > > -- Alex I've already done that, here's the code (ripped off my add-on library AllegroPlus): First thing are the macros: #define FAKE_FP_OFF ( (__tb) & 0x0f ) #define FAKE_FP_SEG ( ((__tb) >> 4) & 0xffff ) #define __fp_put(buf,len) dosmemput((buf),(len),(__tb)) #define __fp_get(buf,len) dosmemget((__tb),(len),(buf)) (don't think about the names ;) Second thing is the load routine for a 8x16 font //11:30 15.08.1998 fix //loads a 8x16 dos font (4096 bytes). #include #include #include "allplus.h" void set_8x16_font( uchar *_dat) { __dpmi_regs r; if( _dat == NULL) return; r.x.ax = 0x1110; r.x.bx = 0x1000; //points r.x.cx = 256; //bytes per char r.x.dx = 0; r.d.ebp = FAKE_FP_OFF; //offset macro r.x.es = FAKE_FP_SEG; //segment macro __fp_put( _dat, 4096); //dosmemput macro __dpmi_int( 0x10, &r); } And last thing is the load routine for a 8x8 font //11:30 15.08.1998 fix //loads a 8x8 dos font (2048 bytes). #include #include #include "allplus.h" void set_8x8_font( uchar *_dat) { __dpmi_regs r; if( _dat == NULL) return; r.x.ax = 0x1110; r.x.bx = 0x0800; //points r.x.cx = 256; //bytes per char r.x.dx = 0; r.d.ebp = FAKE_FP_OFF; //offset macro r.x.es = FAKE_FP_SEG; //segment macro __fp_put( _dat, 2048); //dosmemput macro __dpmi_int( 0x10, &r); } I hope this helps you. ---------- Thomas Wolf (seawolf AT net4you DOT co DOT at) "Hardware is fast enough to do interesting things, but not fast enough to do what we really want." -- Michael Abrash / id Software