delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/23/17:58:28

From: Apester000 AT aol DOT com
Message-ID: <1a49fd10.36aa53d9@aol.com>
Date: Sat, 23 Jan 1999 17:57:29 EST
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Help porting some 16 bit c code to DJGPP
X-Mailer: AOL 3.0 for Windows 95 sub 18
Reply-To: djgpp AT delorie DOT com

Hi, I'm trying to convert a snippet of code that will find a 64k boundary in
memory for a DMA wav player program I'm writing.  I've found some code to do
this, but it's written for borland c 3.1, and I'm new to DJGPP and don't know
how to port it, since it contains references to segments and offsets.  Here's
the code:

void sbmalloc ( void )
{
    char *data;
    char *aligned, *aligned_physical;
    unsigned long physical;
    data=farmalloc(131000L);
    if(data==NULL)
    {
        printf("Memory Allocation Error\n");
        exit(1);
    }
    physical=((unsigned long)FP_OFF(data))+(((unsigned long)FP_SEG(data))<<4);
    physical+=0x0FFFFL;
    physical&=0xF0000L;
    aligned_physical=(physical>>16)&15;
    aligned=MK_FP(((unsigned short)aligned_physical<<12)&0xF000,0);
}


I understand what the code is doing, but how do I find the physical address of
'data'?  Also, what is the equivelant (if there is one) of MK_FP?  Thanks in
advance for any help you guys can offer.

Brandon Tallent
Apester000 AT aol DOT com

- Raw text -


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