DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦be50114bc⟧ Ada Source

    Length: 6144 (0x1800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Raw_Dump_W_Addr, seg_04b961

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



-- raw_dump
--
-- This file provides two procedures, raw_dump_w_addr and raw_dump, both
-- print out a dump of memory:
--
-----------------------
-- procedure raw_dump_w_addr(
--              addr:   system.address;
--              count:  integer;
--              p_addr: unsigned_types.unsigned_integer)
--
-- Raw_dump_w_addr displays both the value and ascii interpretation of
-- "count" bytes starting at "addr".  The display is 16 bytes per line
-- and each line is preceded by an address, which starts out as the value
-- of p_addr and is incremented by 16 for each successive line.  Here is
-- some example output, preceded by "--":
--
--  AAABBB: 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 "abcdefghijklmnop"
--  AAABCB: 71 72 73 74 75 76 77 78 79 7A 41 42 43 44 45 46 "qrstuvwxyzABCDEF"
--
-- There is an example test program at the bottom of this file that
-- calls both of these subprograms.
-----------------------
-- procedure raw_dump(addr: system.address; count: integer)
--
-- Raw_dump prints count bytes starting at addr.  See the comment
-- at the end of the file for a couple of example calls on raw_dump.
--
with Hex;
with System;
use System;
with Text_Io;
with Unchecked_Conversion;
with Unsigned_Types;
procedure Raw_Dump_W_Addr (Addr : System.Address;
                           Count : Integer;
                           P_Addr : Unsigned_Types.Unsigned_Integer) is
    -- number of hex digits in an integer
    Hex_Digits : constant := Integer'Size / 4;

    Left_To_Do : Integer := Count;

    type Byte is range 0 .. 16#FF#;
    for Byte'Size use 8;

    type Memline_Rep is array (0 .. 15) of Byte;
    Memline : Memline_Rep;
    Mp : Integer := 0;

    -- "char_star" is a reference to C, where the following two declarations
    -- would probably have been:
    --
    --   char *byte_ptr;
    --
    type Char_Star is access Byte;
    Byte_Ptr : Char_Star;

    Byte_Val : Integer;
    Ptr_Val : Unsigned_Types.Unsigned_Integer;

    Pr_Addr : Unsigned_Types.Unsigned_Integer := P_Addr;

    Val_Count : Integer := 0;

    Line : String (1 .. 80);
    Lp : Integer;

    procedure Finish_Line is
    begin
        if Mp < 16 then
            for I in 1 .. (16 - Mp) * 3 loop
                Line (Lp) := ' ';
                Lp := Lp + 1;
            end loop;
        end if;

        Line (Lp) := '"';
        Lp := Lp + 1;

        for I in 0 .. (Mp - 1) loop
            if Integer (Memline (I)) >= Character'Pos (' ') and
               Integer (Memline (I)) <= Character'Pos ('~') then
                Line (Lp) := Character'Val (Memline (I));
            else
                Line (Lp) := '.';
            end if;
            Lp := Lp + 1;
        end loop;

        Line (Lp) := '"';
    end Finish_Line;

    function Addr_To_Ptr is
       new Unchecked_Conversion (Source => System.Address, Target => Char_Star);
    use Unsigned_Types;
    function Ptr_To_Uint is
       new Unchecked_Conversion
              (Source => Char_Star, Target => Unsigned_Integer);

    function Uint_To_Ptr is
       new Unchecked_Conversion
              (Source => Unsigned_Integer, Target => Char_Star);

begin
    Byte_Ptr := Addr_To_Ptr (Addr);
    while Left_To_Do > 0 loop
        Val_Count := 16;
        if Val_Count > Left_To_Do then
            Val_Count := Left_To_Do;
        end if;
        Left_To_Do := Left_To_Do - Val_Count;

        Line (1 .. Hex_Digits) := Hex.Unsigned_To_Hex (Pr_Addr, Hex_Digits);
        Pr_Addr := Pr_Addr + Unsigned_Integer (Val_Count);

        Line (Hex_Digits + 1) := ':';
        Line (Hex_Digits + 2) := ' ';
        Lp := Hex_Digits + 3;

        Mp := 0;
        for Ii in 1 .. Val_Count loop
            Byte_Val := Integer (Byte_Ptr.all);
            Memline (Mp) := Byte_Ptr.all;
            Mp := Mp + 1;

            Ptr_Val := Ptr_To_Uint (Byte_Ptr);
            Ptr_Val := Ptr_Val + 1;
            Byte_Ptr := Uint_To_Ptr (Ptr_Val);

            Line (Lp .. Lp + 1) := Hex.Integer_To_Hex (Byte_Val, 2, '0');
            Line (Lp + 2) := ' ';
            Lp := Lp + 3;
        end loop;

        Finish_Line;
        Text_Io.Put_Line (Line (1 .. Lp));
    end loop;
end Raw_Dump_W_Addr;

E3 Meta Data

    nblk1=5
    nid=0
    hdr6=a
        [0x00] rec0=19 rec1=00 rec2=01 rec3=048
        [0x01] rec0=22 rec1=00 rec2=02 rec3=02c
        [0x02] rec0=25 rec1=00 rec2=03 rec3=000
        [0x03] rec0=20 rec1=00 rec2=04 rec3=036
        [0x04] rec0=0e rec1=00 rec2=05 rec3=001
    tail 0x21750ba20868435d15620 0x42a00088462060003