nacer@orstcs.UUCP (11/26/86)
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