Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!cmcl2!yale!husc6!mit-eddie!genrad!decvax!decwrl!hplabs!hp-pcd!orstcs!nacer
From: nacer@orstcs.UUCP (nacer)
Newsgroups: comp.sys.ibm.pc
Subject: ms-pascal ?
Message-ID: <216700003@orstcs.UUCP>
Date: Fri, 26-Dec-86 00:21:00 EST
Article-I.D.: orstcs.216700003
Posted: Fri Dec 26 00:21:00 1986
Date-Received: Wed, 31-Dec-86 20:52:30 EST
Organization: Oregon State University - Corvallis, OR
Lines: 47
Nf-ID: #N:orstcs:216700003:000:1609
Nf-From: orstcs!nacer    Dec 25 21:21:00 1986


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