🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.atari16
Article #1318

Pascal demo (4 of 5)

#1318
From: fouts
Date: Sun, 27 Jul 1986 05:55
112 lines
2776 bytes
This is the peekpoke.pas.  It is part of my OSS Pascal demo.
I did not write the code for this part, but got it from the
OSS Buletin board

----- CUT HERE -----

  {$P-}

  FUNCTION peek( address: long_integer ): long_integer;

    TYPE
      byte_ptr = ^byte;

    VAR
      funny: RECORD
               CASE boolean OF
                 true:  ( a: long_integer );
                 false: ( p: byte_ptr );
             END;

    BEGIN
      funny.a := address;
      peek := funny.p^;
    END;

  FUNCTION wpeek( address: long_integer ): long_integer;

    TYPE
      int_ptr = ^integer;

    VAR
      funny: RECORD
               CASE boolean OF
                 true:  ( a: long_integer );
                 false: ( p: int_ptr );
             END;

    BEGIN
      funny.a := address;
      wpeek := funny.p^;
    END;

  FUNCTION lpeek( address: long_integer ): long_integer;

    TYPE
      lint_ptr = ^long_integer;

    VAR
      funny: RECORD
               CASE boolean OF
                 true:  ( a: long_integer );
                 false: ( p: lint_ptr );
             END;

    BEGIN
      funny.a := address;
      lpeek := funny.p^;
    END;

  PROCEDURE poke( address: long_integer; value: byte );

    TYPE
      lint_ptr = ^long_integer;

    VAR
      funny: RECORD
               CASE boolean OF
                 true:  ( a: long_integer );
                 false: ( p: lint_ptr );
             END;

    BEGIN
      funny.a := address;
      funny.p^ := value;
    END;

  PROCEDURE wpoke( address: long_integer; value: integer );

    TYPE
      int_ptr = ^integer;

    VAR
      funny: RECORD
               CASE boolean OF
                 true:  ( a: long_integer );
                 false: ( p: int_ptr );
             END;

    BEGIN
      funny.a := address;
      funny.p^ := value;
    END;

  PROCEDURE lpoke( address, value: long_integer );

    TYPE
      lint_ptr = ^long_integer;

    VAR
      funny: RECORD
               CASE boolean OF
                 true:  ( a: long_integer );
                 false: ( p: lint_ptr );
             END;

    BEGIN
      funny.a := address;
      funny.p^ := value;
    END;

  {$P=}
Technical Details
Message-ID: <8607270555.AA14186@ames-nas.ARPA>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!caip!nike!ucbcad!ucbvax!AMES-NAS.ARPA!fouts

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!caip!nike!ucbcad!ucbvax!AMES-NAS.ARPA!fouts
From: fouts@AMES-NAS.ARPA
Newsgroups: net.micro.atari16
Subject: Pascal demo (4 of 5)
Message-ID: <8607270555.AA14186@ames-nas.ARPA>
Date: Sun, 27-Jul-86 01:55:28 EDT
Article-I.D.: ames-nas.8607270555.AA14186
Posted: Sun Jul 27 01:55:28 1986
Date-Received: Sun, 27-Jul-86 06:16:57 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 112