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

⟦5ec2236ab⟧ Ada Source

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

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 Octet;
with Text_Io;

package body Mot is


    -- VARIABLES -------------------------------------------------------------


    -- PROCEDURES ------------------------------------------------------------


    --------------------------------------------------------------------------
    -- PROCEDURES D'AFFICHAGE ET DE LECTURE
    --------------------------------------------------------------------------


    procedure Afficher_Mot_Hexa (Mot : T_Mot) is
        Msb, Lsb : Octet.T_Octet;
    begin  
        Msb := Poids_Fort (Mot);
        Lsb := Poids_Faible (Mot);
        Octet.Afficher_Octet_Hexa (Msb);
        Octet.Afficher_Octet_Hexa (Lsb);
    end Afficher_Mot_Hexa;

    --------------------------------------------------------------------------

    function Lire_Mot_Hexa return T_Mot is
        Msb, Lsb : Octet.T_Octet;
    begin  
        Text_Io.Put ("MSB > ");
        Msb := Octet.Lire_Octet_Hexa;
        Text_Io.Put ("LSB > ");
        Lsb := Octet.Lire_Octet_Hexa;
        return (Construire (Msb, Lsb));
    end Lire_Mot_Hexa;


    -------------------------------------------------------------------------

    function Construire (Octet_1, Octet_2 : Octet.T_Octet) return T_Mot is
        Un_Mot : T_Mot := 0;
    begin
        Un_Mot := T_Mot (Octet_1) * 256 + T_Mot (Octet_2);
        return Un_Mot;
    end Construire;


    -------------------------------------------------------------------------

    function Poids_Fort (Mot : T_Mot) return Octet.T_Octet is
    begin
        return Octet.T_Octet (Mot / 256);
    end Poids_Fort;


    -------------------------------------------------------------------------

    function Poids_Faible (Mot : T_Mot) return Octet.T_Octet is
    begin
        return Octet.T_Octet (Mot mod 256);
    end Poids_Faible;


    -------------------------------------------------------------------------

    procedure Add_8_Bit_C (Octet_1 : in out Octet.T_Octet;
                           Octet_2 : Octet.T_Octet;
                           Carry : in out Boolean) is

        Bit_Octet_1 : Octet.T_Bit_Octet;
        Bit_Octet_2 : Octet.T_Bit_Octet;

    begin  
        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);
        Bit_Octet_2 := Octet.Convert_Bit (Octet_2);

        for I in Octet.Num_Bit loop
            Octet.Add_Bit_C (Bit_Octet_1 (I), Bit_Octet_2 (I), Carry);
        end loop;

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

    end Add_8_Bit_C;


    -------------------------------------------------------------------------

    function Add (Mot_1, Mot_2 : T_Mot) return T_Mot is

        Resultat : T_Mot := 0;
        Msb_2, Lsb_2, Msb_Resultat, Lsb_Resultat : Octet.T_Octet;
        Carry : Boolean := False;
    begin
        Msb_Resultat := Poids_Fort (Mot_1);
        Lsb_Resultat := Poids_Faible (Mot_1);
        Msb_2 := Poids_Fort (Mot_2);
        Lsb_2 := Poids_Faible (Mot_2);

        Add_8_Bit_C (Lsb_Resultat, Lsb_2, Carry);

        Add_8_Bit_C (Msb_Resultat, Msb_2, Carry);

        Resultat := Construire (Msb_Resultat, Lsb_Resultat);

        return Resultat;

    end Add;

    -------------------------------------------------------------------------

    function Neg (Mot : T_Mot) return T_Mot is
        Un_Mot : T_Mot;
    begin
        Un_Mot := not Mot;
        Un_Mot := Add (Un_Mot, 1);
        return Un_Mot;
    end Neg;

    -------------------------------------------------------------------------

    function Sub (Mot_1, Mot_2 : T_Mot) return T_Mot is

    begin
        return (Add (Mot_1, Neg (Mot_2)));
    end Sub;


    --------------------------------------------------

    function "not" (Mot : T_Mot) return T_Mot is

        Msb, Lsb : Octet.T_Octet;

    begin  
        Msb := Poids_Fort (Mot);
        Lsb := Poids_Faible (Mot);
        Msb := Octet."not" (Msb);
        Lsb := Octet."not" (Lsb);
        return (Construire (Msb, Lsb));
    end "not";

    -------------------------------------------------------------------------

    procedure Convert_Mot_Ascii
                 (Un_Mot : Mot.T_Mot;
                  Car_1, Car_2, Car_3, Car_4 : in out Character) is

        Msb, Lsb : Octet.T_Octet;
    begin
        Msb := Mot.Poids_Fort (Un_Mot);  
        Lsb := Mot.Poids_Faible (Un_Mot);
        Octet.Convert_Octet_Ascii (Msb, Car_1, Car_2);
        Octet.Convert_Octet_Ascii (Lsb, Car_3, Car_4);
    end Convert_Mot_Ascii;

    ------------------------------------------------------------------------

    function Convert_Ascii_Mot
                (Car_1, Car_2, Car_3, Car_4 : Character) return Mot.T_Mot is

        Msb, Lsb : Octet.T_Octet;
        Le_Mot : Mot.T_Mot;
    begin
        Msb := Octet.Convert_Ascii_Octet (Car_1, Car_2);
        Lsb := Octet.Convert_Ascii_Octet (Car_3, Car_4);
        Le_Mot := Mot.Construire (Msb, Lsb);  
        return Le_Mot;
    end Convert_Ascii_Mot;

end Mot;

E3 Meta Data

    nblk1=6
    nid=0
    hdr6=c
        [0x00] rec0=23 rec1=00 rec2=01 rec3=02a
        [0x01] rec0=22 rec1=00 rec2=05 rec3=02e
        [0x02] rec0=1f rec1=00 rec2=02 rec3=008
        [0x03] rec0=28 rec1=00 rec2=03 rec3=01a
        [0x04] rec0=1c rec1=00 rec2=04 rec3=064
        [0x05] rec0=06 rec1=00 rec2=06 rec3=000
    tail 0x2150bff0a823061bba3b0 0x42a00088462060003