home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-03-05 | 1.9 KB | 79 lines | [TEXT/TPAS] |
- {$R-}
-
- (*
- peek -- a sample HyperCard external function (return the contents
- of a memory location).
- ⌐Apple Computer, Inc. 1987
- All Rights Reserved.
-
-
- Modified for Turbo Pascal by Brian Liebowitz
-
- You must install the DHDR resources called PasXFCN and PasXCMD
- into your copy of Turbo before compiling this XCMD. You must also
- have compiled the unit HyperXCMD and moved it into the Turbo progam,
- and the file XCMDGlue.inc must be accessible. After compiling,use
- ResEdit to change the ID from 300, and to copy the XCMD or XFCN into
- your stack or Hypercard.
- *)
-
- {$U-} { Don't include runtime units}
- {$D PasXFCN} {Compile as XFCN}
-
- Program Peek;
-
-
- USES MemTypes,QuickDraw,OsIntf,ToolIntf,HyperXCmd;
-
- TYPE
- Str19 = String[19];
- WordPtr = ^INTEGER;
- LongPtr = ^LongInt;
-
- PROCEDURE PasXFCN(paramPtr: XCmdPtr);
- VAR peekAddr,peekSize,peekVal: LongInt;
- Wordtemp:WordPtr;LongTemp:LongPtr;
- str: Str255;
-
- {$I XCmdGlue.inc }
-
- BEGIN
- WITH paramPtr^ DO
- BEGIN
- { first param is addr }
- ZeroToPas(params[1]^,str);
- peekAddr := StrToNum(str);
-
- { second param, if given, is size }
- peekSize := 1;
- IF paramCount = 2 THEN
- BEGIN
- ZeroToPas(params[2]^,str);
- peekSize := StrToNum(str);
- END;
-
- CASE peekSize OF
- 1: peekVal := BitAND($000000FF,Ptr(peekAddr)^);
- 2: begin
- Wordtemp:=WordPtr(BitAND($FFFFFFFE,peekAddr));
- peekVal := BitAND($0000FFFF,(Wordtemp^));
- end;
- 4: begin
- Longtemp:=LongPtr(BitAND($FFFFFFFE,peekAddr));
- peekVal := Longtemp^;
- end;
- OTHERWISE peekVal := 0;
- END;
-
- str := NumToStr(peekVal);
- returnValue := PasToZero(str);
- END;
- END;
-
- BEGIN
- END.
-
- (*Remember to change the ID of this resource from 300*)
-
-
-