www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/16/17:08:20

Date: Thu, 16 Nov 1995 13:24:54 -0800
From: Sam Vincent <svincent AT cs DOT sonoma DOT edu>
To: djgpp AT sun DOT soe DOT clarkson DOT edu, ward AT escape DOT com
Subject: Re: A peculiar question: Extra Segments & DJGPP...?

>  Okay here goes... DJGPP runs in protected 32 bit mode, which is
basically a non-segment memory system. All pointers are 4 byte
ints.. no seg, no offset. What you need to do is put &STRING[0] or
whatever into the psuedo register "ebx" or "ebp" or whatever it
is.. es:bx is ebx, es:bp is ebp, es:ax is eax, and so on.
 
It's something like this:
 
#include <dpmi.h> /* Not sure of this. might be go32.h.. check the docs. */
 
main()
{
char s[80];
_go32_segment_registers r;/* Might be some other name. again, check the docs.*/
 
strcpy(s, "This is an example of direct bios writing.\r\n");
 
r.x.ebx = &s[0]; /* r.x.bp? whatever.. */
 
r.x.ss = r.x.sp = 0; /* Just needed for some reason dealing with stack and
                        crap like that. Once again, check the docs.. */
 
r.x.ax = whatever; 
 
/* don't bother with bx if it's supposed to be es:bx */
 
_go32_dpmi_simulate_int(0x10, &r);
 
return 0;
}
 
okay. check the docs for _go32_dpmi_simulate_int.. it'll explain it better
than I did. but djgpp will take care of the pointer conversion for you.
 
Justin


-----



Uh.. say what?   That will *not* work...
#1.. it will look for the data to use at es:bx..  not at ebx..
#2.. the string is located somewhere in 32-bit memory.. above and beyond
     where DOS's conventional memory lies...  You cannot address memory
     above the 1meg+64k  of conventional memory using segment:offset
     at all..  It's physically impossible.


It must be copied to a chunk of dos memory that you allocated using the
appropriate _dpmi_allocate_dos_memory() or whatever function.
Then you must pass the address of that dos memory in es:bx or wherever
else it wants it.

-Sam

- Raw text -


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