From: richard AT stardate DOT bc DOT ca Newsgroups: comp.os.msdos.djgpp Subject: Re: Page Boundaries Date: Thu, 13 Aug 1998 04:40:31 GMT Organization: Rapidnet Technologies Internet Lines: 34 Message-ID: <35d2662c.11944776@news.rapidnet.net> References: <6qsevr$5jd$3 AT pump1 DOT york DOT ac DOT uk> <35D25BB4 DOT EC72F30C AT unb DOT ca> NNTP-Posting-Host: wlp38.rapidnet.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Thu, 13 Aug 1998 00:21:24 -0300, Endlisnis wrote: >Steve Carter wrote: > >> Anyone know how to allocate a page of memory, aligned to the page >> boundary? It would be a shame to allocate 128k to just use 64. This is >> for DMA to my soundcard, so it's a problem that must have been solved >> umpteen times. > >I need to know that too. I want to use __djgpp_map_physical_memory, but it >says I need a page-aligned data-block. What is page-aligned and how to I >create/calculate a page-aligned address. AFAIK page boundrys are EMM but paragraph boundrys are for regular ram. A page of regular ram is 64K and always starts on a paragraph boundry. A paragraph boundry occours every 16 bytes. In dos far pointers are two part something like SSSS:OOOO . (segment:offset) The absoloute memory address is calculated like so. ( SSSS << 4 ) + OOOO Perhaps when you read page boundry the author means paragraph boundry. An address of 0a00:0000 where the offset has a zero value gives an address range of 64k. if you increment the offset by 0xffff + 1 the offset wraps around back to zero, so the 64k page. All this mess is because of 16 bit registers and 20 address lines (of the 8086). Hope that helps Cheers Richard