From: Charles Sandmann Subject: Re: Writing to screens etc To: A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk (A.Appleyard) Date: Tue, 31 Jan 1995 13:34:03 -0600 (CST) Cc: DJGPP AT sun DOT soe DOT clarkson DOT edu > Charles Sandmann replied:- > > ... A simple example of what you want to do is: > > #include > > #include > > _farsetsel(_go32_info_block.selector_for_linear_memory); > > _farnspokeb(0xa0017,0x14); > > (1) Should `0xa0017' be `0x0017' or `0xa0000017'? It should be 0xa0017, as written. This is the offset from the beginning of memory in bytes. It is computed as 16*real_mode_segment_register + offset This is the same rule for all conversions from seg/off to 32 bit offset. > (2) Do I have to call farsetsel() once per program, or every time I write to > the screen? Probably once per subroutine call, there may be other calls which set the selector. Depending on what your code calls, you may be able to set it once per program. Since this routine inlines to a single segment register load, it's not expensive and not worth bugs to try to avoid too much.