Message-Id: <199809050354.XAA27244@delorie.com> Comments: Authenticated sender is From: "George Foot" To: tomstdenis AT my-dejanews DOT com Date: Sat, 5 Sep 1998 04:52:07 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: 2 questions Reply-to: mert0407 AT sable DOT ox DOT ac DOT uk CC: djgpp AT delorie DOT com Precedence: bulk On 4 Sep 98 at 21:59, tomstdenis AT my-dejanews DOT com wrote: > > 1. how do you set the screen to 640x480x16(along with how to set a pixel > > color)? > > Well you would use the __dpmi_init() function to set up mode 12h. Like this > > #include > > test() > { > __dpmi_regs r; > > r.d.eax = 0x12; > __dpmi_init(0x10, &r); > } You meant `__dpmi_int'. To set a pixel you can choose between three ways; two using direct memory writes and one using the video BIOS (which will be slow in djgpp). For direct writes, first calculate the address of the byte to write to, and the bit mask for the pixel you want to write: addr = 0xa0000 + y*80 + (x >> 3) mask = (1 << ((~x) & 7) (those may not be quite right, consult a book on EGA/VGA graphics) Then choose: 1) Using write mode 0: Set the set/reset register with the colour number, and set the enable set/reset register to 0xF. Then write a byte to selector `_dos_ds', offset `addr', the byte being `mask'. 2) Using write mode 2: Set bit mask register to `mask' and write the colour number you want to use to selector `_dos_ds', offset `addr'. IIRC in both cases you should latch first, i.e. read from the address (and discard the value) before writing back to it. -- george DOT foot AT merton DOT oxford DOT ac DOT uk