delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/12/19:19:52

From: "Michel Huot" <huotm AT icrdl DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help! VGA programming problem in DJGPP
Date: 12 Jan 1998 23:50:10 GMT
Organization: Bell Network Solutions
Lines: 22
Message-ID: <01bd1fac$9fc3fee0$655c2fce@huotm>
References: <34B46FF2 DOT 22E31F82 AT sunlink DOT net> <34B5E9E9 DOT 136C AT mailhost DOT net>
NNTP-Posting-Host: 206.47.92.101
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

 > byte *VideoBuffer = (byte *)0xA000000L;
 > void plot(int x, int y, unsigned int color)
 >         {
 >         int index = (y<<8) + (y<<6) + x;
 >         VideoBuffer[index] = color;
 >         }
 > When it gets to plot(2, 2, 5); the program crashes. All I want to do is
 > plot a damn pixel! If you can help PLEASE lemme know what I am doing
 > wrong.
The safest way to acces video memory is:

_farpokeb(_dos_ds, 0xa0000+index, color);
or FASTER:
_farsetsel(_dos_ds);
LOOP:
  _farnspokeb(0xa0000+index, color);

Defined in <sys/farptr.h>
_farsetsel sets %fs to _dos_ds(the same descriptor you use in real mode).
 So be sure %fs isnt changed between _farnspokeb calls.


: yourself?

No, I don't think that works -- getsockname returns 127.0.0.1 as the
address.  Not very helpful! :)

: 	I have been trying to write registry access functions too, but I
: haven't made much progress. My calls to the registry don't crash either -
: complete rubbish gets returned though. Does
: __dpmi_simulate_real_mode_procedure_retf work better? I'm already
: allocating DOS memory using __dpmi_allocate_dos_memory. This is as part of
: my Win95 library for DJGPP.

Better than what?  An assembly lcall?

If you do the lcall, Windows gets awfully confused about what type of
parameters you're giving it and every time I received the error code
87 (bad parameters) or for the close key function 1010 (bad key).

Using __d_s_r_m_p_retf gave me different results, but I still couldn't
persuade it to work.  I suspect that my stack was incorrectly formed,
and I wasn't sure what the inputs to __d_s_r_m_p_retf_stack should be
(e.g. what order to put the values in the array).  It should be fairly
trivial to do though.  As I said, Alfons has code which works on
various other compilers and I'm in the process of porting it (well, of
writing a djgpp interface module for it).  There's some distance to go
yet, though.

-- 
Regards,

george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019