22.02.2014 Views

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

ftp://ftp.intel.com/pub/IAL/software specs/dpmiv1.zip<br />

This ZIP file contains a Postscript version of the DPMI 1.0 specification.<br />

5.2 How can I write directly to video memory using a<br />

<strong>DOS</strong> extender?<br />

Many programmers require access to video RAM in order to directly manipulate data on the<br />

screen. Under <strong>DOS</strong>, it was standard practice to use a far pointer, <strong>with</strong> the segment part of the<br />

far pointer set to the screen segment. Under <strong>DOS</strong> extenders, this practice is not so standard.<br />

Each <strong>DOS</strong> extender provides its own method for accessing video memory.<br />

5.2.1 Writing to Video Memory under Tenberry Software <strong>DOS</strong>/<strong>4GW</strong><br />

Under <strong>DOS</strong>/<strong>4GW</strong>, the first megabyte of physical memory is mapped as a shared linear<br />

address space. This allows your application to access video RAM using a near pointer set to<br />

the screen’s linear address. The following program demonstrates this method.<br />

/*<br />

SCREEN.C - This example shows how to write directly<br />

to screen memory under the <strong>DOS</strong>/<strong>4GW</strong> dos-extender.<br />

Compile & Link: wcl386 /l=dos4g SCREEN<br />

*/<br />

#include <br />

#include <br />

/*<br />

Under <strong>DOS</strong>/<strong>4GW</strong>, the first megabyte of physical memory<br />

(real-mode memory) is mapped as a shared linear address<br />

space. This allows your application to access video RAM<br />

using its linear address. The <strong>DOS</strong> segment:offset of<br />

B800:0000 corresponds to a linear address of B8000.<br />

*/<br />

#define SCREEN AREA 0xb800<br />

#define SCREEN LIN ADDR ((SCREEN AREA)

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

Saved successfully!

Ooh no, something went wrong!