22.02.2014 Views

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>DOS</strong> Programming Guide<br />

void main()<br />

{<br />

/* Need a far pointer to use the screen selector */<br />

char far *ptr;<br />

int i;<br />

}<br />

/* Make a far pointer to screen memory */<br />

ptr = MK FP( PL SCREEN SELECTOR, 0 );<br />

for( i = 0; i < SCREEN SIZE - 1; i++ ) {<br />

*ptr = ’*’;<br />

ptr += 2 * sizeof( char );<br />

}<br />

It is also possible to map screen memory into your near memory using Phar Lap system calls.<br />

Please refer to the chapter entitled "386|<strong>DOS</strong>-Extender System Calls" in Phar Lap’s<br />

386|<strong>DOS</strong>-Extender Reference Manual for details.<br />

5.3 How do I get information about free memory in the<br />

32-bit environment?<br />

Under a virtual memory system, programmers are often interested in the amount of physical<br />

memory they can allocate. Information about the amount of free memory that is available is<br />

always provided under a DPMI host, however, the manner in which this information is<br />

provided may differ under various environments. Keep in mind that in a multi-tasking<br />

environment, the information returned to your task from the DPMI host can easily become<br />

obsolete if other tasks allocate memory independently of your task.<br />

5.3.1 Getting Free Memory Information under <strong>DOS</strong>/<strong>4GW</strong><br />

<strong>DOS</strong>/<strong>4GW</strong> provides a DPMI interface through interrupt 0x31. This allows you to use DPMI<br />

service 0x0500 to get free memory information. The following program illustrates this<br />

procedure.<br />

22 How do I get information about free memory in the 32-bit environment?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!