Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!lll-crg!mordor!sri-spam!sri-unix!hplabs!hp-pcd!orstcs!nacer
From: nacer@orstcs.UUCP (nacer)
Newsgroups: comp.sys.ibm.pc
Subject: ORIGIN, ADSMEM ???
Message-ID: <216700002@orstcs.UUCP>
Date: Thu, 27-Nov-86 22:52:00 EST
Article-I.D.: orstcs.216700002
Posted: Thu Nov 27 22:52:00 1986
Date-Received: Mon, 15-Dec-86 04:32:20 EST
Organization: Oregon State University - Corvallis, OR
Lines: 51
Nf-ID: #N:orstcs:216700002:000:1793
Nf-From: orstcs!nacer    Nov 27 19:52:00 1986

/* Written  5:49 pm  Nov 25, 1986 by nacer@orstcs.cs.ORST.EDU in orstcs:net.lang.pasca */
/* ---------- "ORIGIN, ADSMEM ???" ---------- */

I am trying out MS-Pascal and I would like to know whether it is possible
to do either of this three things:

  A) declare a variable at a specific physical address (Segment & Offset).
  B) assign and physical address value (Segment & Offset) to a pointer
     variable.
  C) declare a variable X on top of an already declared (of course) variable
     Y, so that they share the exact same starting location in memory.

  I have noticed the existence of ORIGIN and ADSMEM in Microsoft-Pascal
  and I have tried to simulate the Turbo-Pascal implementation of ABODULTE
  and the function PTR but with no success.

  Below are the programs  A, B, and C which show what I am trying to achive.

  Any hints will be greatly appreciated.  Thank you.

  Reply by mail to:                   hp-pcd!orstcs!nacer
  or post.


PROGRAM  A  ( INPUT, OUTPUT ) ;
 TYPE   X_TYPE = ARRAY[ 1..10 ] OF BYTE ;
 VAR    X [ORIGIN 16#A000 : 16#0 ] : X_TYPE ;
                       { in Turbo-Pascal--> x : x_type absolute $A000:$0000 ;}
BEGIN   X[ 1 ] := 255    END .


PROGRAM  B  ( INPUT, OUTPUT ) ;
 TYPE   X_TYPE = ARRAY[ 1..10 ] OF BYTE ;
 VAR    X : ^X_TYPE ;                       {here x is a pointer to an array}
BEGIN   X := ADSMEM[ #A000 ] ;  X[1] := 255  END .
                                    {in Turbo-Pascal--> X := PTR( A000, 0 ) ;}

PROGRAM  C  ( INPUT, OUPUT ) ;
 VAR
  Y : INTEGER ;
  X : ????                       {Turbo-Pascal--> X : INTEGER ABSOLUTE Y ;}

BEGIN
 Y := 10 ;
 WRITELN( X ) ;                  {X have the value 10in this case}
END .


     Thank you!                     hp-pcd!orstcs!nacer

/* End of text from orstcs:net.lang.pasca */