Direct memory addressing in TURBO C/C++

Mark W. Schumann catfood at NCoast.ORG
Sun Mar 3 13:16:53 AEST 1991


In article <MORGAN.91Feb27195403 at chaos.cs.brandeis.edu> morgan at chaos.cs.brandeis.edu (Dylan Kaufman) writes:
>Hi,
>
>I have been trying to figure out how to do direct memory addressing in
>C++.  The addressing I am thinking about in particular is done with
>the keyword absolute in TURBO Pascal.  For example, to turn the Num
>Lock key off :
>
>var
>  Key_Status_Bit : word absolute $0040:$0017;
>begin
>  Key_Status_Bits := (Key_Status_Bits and $DF);
>end.
>
You can do this with--

    * (unsigned int *) MK_FP (0x0040, 0x0017);

MK_FP() is a macro that is defined in Turbo C (2.0 at least) and
Mix Power C.  I think it is defined in MC.  This is NOT considered
part of ANSI but it looks as if you are trying to do some very
machine-dependent stuff anyway.

Hope it helps.


-- 
============================================================
Mark W. Schumann  3111 Mapledale Avenue, Cleveland 44109 USA
Domain: catfood at ncoast.org
UUCP:   ...!mailrus!usenet.ins.cwru.edu!ncoast!catfood



More information about the Comp.lang.c mailing list