Mail Archives: djgpp/1999/01/23/17:58:28
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 -