From: Ron Grunwald Organization: Edith Cowan University To: djgpp AT sun DOT soe DOT clarkson DOT edu, Elmar Vogt Date: Thu, 16 Nov 1995 16:44:24 GMT+800 Subject: Re: A peculiar question: Extra Segments & DJGPP...? Reply-To: r DOT grunwald AT cowan DOT edu DOT au Alright, here are my opinions to this. > The method of choice is then to use interrupt x10, function (dec)19 > - write a string to screen. Still on the right track? > > From C, this is usually done with int86x(19, ®ister_in, > ®ister_out, &segments). Correct? No. Try register_in.h.ah=19; int86x(0x10, ®ister_in, ®ister_out, &segments); > > x10 asks for a pointer to the string to be displayed. Fine. Alas, > the way I understood it, its address is given by a combination of > Extra Segment ES and Base Pointer BP, where ES is defined in segments, > and BP in register_in. > > Say, *STRING is the string I want to display, then STRING holds the > corresponding address- yes? Then, all I have to do is convert that value > to a long int, divide it by 16 and pass the result to ES, then > taking the modulo of the long int and passing this to BP. Agreed? Definitely not. You have to remember that this refers to programming under real mode with 16-bit memory segments. Under DJGPP you are programming in protected mode, where the concept of segmentation is vastly different. The ptr. contained in STRING is a 32-bit linear addr. The segment value you're after is actually the Selector defining your data segment. Memory segments are defined in Descriptor tables, and the Selector is an index to a particular entry in a Descriptor table. > Unfortunately, whenever I try to do so, I get a segment violation upon > calling the interrupt. This is not surprising if you applied the algorithm you mentioned before. > Now, where did I go astray? As for what to do now, it'll be a pretty lengthy task if you want to do this from scratch, and I'm not quite sure how to do this yet either. Djgpp comes with a whole bunch of _go32_dpmi_... functions to handle these sorts of problems. You'll be much better off solving your problem by looking at these first. They're contained in DPMI.H. Regards, Ron. ******************************************************************** | Author.............. Ron Grunwald | | Internet............ r DOT grunwald AT cowan DOT edu DOT au | | Phone............... (09)273 8027 or (09)273 8468 | |------------------------------------------------------------------| | Department.......... Computer Operations and Systems Management | | Division/Faculty.... Information Technology | | Institute........... Edith Cowan University, Churchlands | | Location............ Perth, Western Australia | ******************************************************************** "I don't have any solution but I certainly admire the problem!"