delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/16/03:15:07

Subject: Re: A peculiar question: Extra Segments & DJGPP...?
To: djgpp AT sun DOT soe DOT clarkson DOT edu (gcc)
Date: Wed, 15 Nov 1995 16:40:17 -0500 (EST)
From: Justin Ward <ward AT escape DOT com>

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

- Raw text -


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