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

⟦9966403ab⟧ Ada Source

    Length: 7168 (0x1c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Iop, seg_002fde

Derivation

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

E3 Source Code



with Device_Independent_Io;
with Io;
with Log;
with Profile;
with System;
--
package body Iop is

    package Dio renames Device_Independent_Io;

    subtype Byte is Enp_Driver.Byte;

    function "+" (L, R : Byte) return Byte renames System."+";
    function "/" (L, R : Byte) return Byte renames System."/";
    function "mod" (L, R : Byte) return Byte renames System."mod";

    function "<=" (L, R : Address) return Boolean renames Enp_Driver."<=";

    Radix : constant := 16;
    subtype Nybble is Byte range 0 .. 15;

    Digit : constant array (Nybble) of Character :=
       ('0', '1', '2', '3', '4', '5', '6', '7',
        '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');

    function Image (B : Byte_String) return String is
        S : String (1 .. B'Length * 2);
        Si : Positive := S'First;
    begin
        for Bi in B'Range loop
            S (Si .. Si + 1) := (Digit (B (Bi) / Radix),
                                 Digit (B (Bi) mod Radix));
            Si := Si + 2;
        end loop;
        return S;
    end Image;

    function Image (A : Address) return String is
        N : Long_Integer := Long_Integer (A);
        S : String (1 .. 8);
    begin
        for Si in reverse S'Range loop
            S (Si) := Digit (Nybble (N mod Radix));
            N := N / Radix;
        end loop;
        return S;
    end Image;

    procedure Read (First : Address;
                    Quanta : Natural := 16;
                    Quantum : Iop_Quanta := Iop.Bytes) is
        Data : Byte_String (1 .. Quanta * Enp_Driver.Quantum_Length (Quantum));
        Count : Natural;
    begin
        Enp_Driver.Read (First, Data, Count, Quantum);
        if Count > 0 then
            Log.Put_Line (Image (First) & ": " &
                          Image (Data (Data'First .. Data'First + Count - 1)));
        end if;
        -- if Count < Length then
        --     Log.Put_Line ("actually read" & Natural'Image (Count) & " bytes",
        --                   Profile.Warning_Msg);
        -- end if;
    end Read;

    procedure Write (First : Address;
                     Data : Byte_String;
                     Quantum : Iop_Quanta := Iop.Bytes) is
        Count : Natural;
    begin
        Enp_Driver.Write (First, Data, Count, Quantum);
        if Count > 0 then
            Log.Put_Line (Image (First) & ":=" &
                          Image (Data (Data'First .. Data'First + Count - 1)));
        end if;
        -- if Count < Data'Length then
        --     Log.Put_Line ("actually wrote" & Natural'Image (Count) & " bytes",
        --                   Profile.Warning_Msg);
        -- end if;
    end Write;

    procedure Scan (First : Address := Iop.Address'First;
                    Last : Address := Iop.Address'Last;
                    Quanta : Positive := 1;
                    Quantum : Iop_Quanta := Iop.Words) is
        A : Address := First;
        Ok : Boolean := True;
        Step : constant Positive := Quanta *
                                       Enp_Driver.Quantum_Length (Quantum);
        Data : Byte_String (1 .. Step);
        Count : Natural;
    begin
        while A <= Last loop
            Enp_Driver.Read (A, Data, Count, Quantum);
            if Count = Data'Length then
                if not Ok then
                    Log.Put_Line (Image (A), Profile.Positive_Msg);
                    Ok := True;
                end if;
            else
                if Ok then
                    Log.Put_Line (Image (A + Address (Count)),
                                  Profile.Negative_Msg);
                    Ok := False;
                end if;
            end if;
            if Count > 0 then
                A := A + Address (Count);
            else
                A := A + Address (Step);
            end if;
        end loop;
    end Scan;

    procedure Dump (File_Name : String := "$iop_dump";
                    First : Address := Iop.Address'First;
                    Last : Address := Iop.Address (2 ** 19 - 1);
                    Quanta : Positive := 512;
                    Quantum : Iop_Quanta := Iop.Words) is
        Quantum_Length : constant Positive :=
           Enp_Driver.Quantum_Length (Quantum);
        Step : constant Positive := Quanta * Quantum_Length;
        File : Dio.File_Type;
        A : Address := First;
        Data : Byte_String (1 .. Step);
        Count : Natural;
    begin
        begin
            Dio.Open (File, Dio.Out_File, Name => File_Name);
        exception
            when Dio.Name_Error =>
                Dio.Create (File, Name => File_Name);
        end;
        while A <= Last loop
            if Address (Data'Length) <= Last - A + 1 then
                Enp_Driver.Read (A, Data, Count, Quantum);
            else
                Enp_Driver.Read (A, Data (1 .. Positive (Last - A + 1)),
                                 Count, Quantum);
            end if;
            exit when Count = 0;
            Dio.Write (File, Data (1 .. Count));
            A := A + Address (Count);
        end loop;
        Dio.Close (File);
    end Dump;

end Iop;

E3 Meta Data

    nblk1=6
    nid=0
    hdr6=c
        [0x00] rec0=21 rec1=00 rec2=01 rec3=066
        [0x01] rec0=1d rec1=00 rec2=02 rec3=068
        [0x02] rec0=19 rec1=00 rec2=03 rec3=03a
        [0x03] rec0=1d rec1=00 rec2=04 rec3=040
        [0x04] rec0=17 rec1=00 rec2=05 rec3=090
        [0x05] rec0=0b rec1=00 rec2=06 rec3=000
    tail 0x20f001376000806b0ea8a 0x42a00088462060003