🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.msdos.programmer
4 messages
4 total messages Started by Julian Cowley Fri, 17 Aug 1990 04:51
Finding the MCGA in Quick C 2.01
#1909
Author: Julian Cowley
Date: Fri, 17 Aug 1990 04:51
29 lines
1390 bytes
I've just come over from comp.lang.c where this request drew a
blank expression from the members of the newsgroup.  What I'm
trying to do is access the MCGA screen at A000:0000.  Here was
my first attempt:

PutPixel (int x, int y, unsigned char c)
{
  unsigned char far *mem;

  FP_SEG (mem) = 0xa000;
  FP_OFF (mem) = 320 * y + x;

  *mem = c;		/* <-- this line gives a run-time error */
}

The commented line caused run-time error R6013: illegal far
pointer use.  (Unfortunately, I do not have the manuals to look
up the cause, even though this is a legitimate copy of Quick
C.)  The help page for the FP_* macros says that the macros
won't work under certain conditions in small and medium models,
but this happens in large model also.

So my question boils down to this: what is the cleanest way of
accessing an absolute address such as 0xa0000 in Quick C?

julian cowley
university of hawaii at manoa
julian@uhccux.uhcc.hawaii.edu
julian@uhccux.bitnet
Re: Finding the MCGA in Quick C 2.01
#1910
Author: David M. Read
Date: Fri, 17 Aug 1990 11:46
23 lines
1257 bytes
In article <> julian@uhccux.uhcc.Hawaii.Edu (Julian Cowley) writes:
>
>So my question boils down to this: what is the cleanest way of
>accessing an absolute address such as 0xa0000 in Quick C?
>

I don't know about QuickC for sure, but I have done the following
successfully in full-blown Microsoft C (5.1):
   
   unsigned char far *mem;

   mem = 0xA000:0000;
   *(mem + offset) = val;

where offset & val are self-explanatory.  I did this in order to 
do some direct screen writes to CGA ram, and everything worked just
fine, in all four memory models.

Good luck with it...

--
Dave Read                       | read@lampf.lanl.gov 
UT-Austin Nuclear Physics       | readdm@walt.cc.utexas.edu
Re: Finding the MCGA in Quick C 2.01
#1913
Author: William C. Marsh
Date: Fri, 17 Aug 1990 15:25
28 lines
1262 bytes
Lots of people post code that looks like:
>   unsigned char far *mem;
>
>   mem = 0xA000:0000;
>   *(mem + offset) = val;

Could we please stop using code that looks like this?  This is very unportable
to other 80x86 C compilers!  If you use the provided services in the compiler
(either MSC style or TurboC style) then there is a good chance it will work
elseware (Plus, it's easier to understand).

Examples (Using the above):

MSC:

	FP_SEG(mem) = 0xA000;
	FP_OFF(mem) = 0x0000;

TurboC:

	MK_FP(mem, 0xA000, 0x0000);

Bill
-- 
Bill Marsh, Naval Ocean Systems Center, San Diego, CA
{arpa,mil}net: bmarsh@cod.nosc.mil
uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!nosc!bmarsh
"If everything seems to be coming your way, you're probably in the wrong lane."
Re: Finding the MCGA in Quick C 2.01
#1951
Author: Jon Keck
Date: Tue, 21 Aug 1990 00:33
34 lines
1581 bytes
In article <2060@cod.NOSC.MIL> bmarsh@cod.nosc.mil.UUCP (William C. Marsh) writes:
>Lots of people post code that looks like:
>>   unsigned char far *mem;
>>
>>   mem = 0xA000:0000;
>>   *(mem + offset) = val;
>
>Could we please stop using code that looks like this?  This is very unportable
>to other 80x86 C compilers!  If you use the provided services in the compiler
>(either MSC style or TurboC style) then there is a good chance it will work
>elseware (Plus, it's easier to understand).
>
>Examples (Using the above):
>
>MSC:
>
>	FP_SEG(mem) = 0xA000;
>	FP_OFF(mem) = 0x0000;
>
>TurboC:
>
>	MK_FP(mem, 0xA000, 0x0000);

From the Turbo C 2.0 Reference Guide, p. 251, the syntax of the MK_FP 
macro is

	void far *MK_FP(unsigned seg, unsigned ofs);

 
-- 
John Keck INTERNET:keck@sea.com UUCP:...!ucsd!soledad!keck VOICE:619/581-6181
Systems Engineering Associates, 2204 Garnet Ave Suite 203, San Diego CA 92109
-----------------------------------------------------------------------------
 "Much speech leads inevitably to silence. Better to hold fast to the void."
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads