DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦e70a4f55d⟧ TextFile

    Length: 23249 (0x5ad1)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Octet;
with Registres;
with Z80_Defs;


package body Alu_8_Bit is

    -- CONSTANTES ------------------------------------------------------------

    Un : constant Octet.T_Bit_Octet :=
       (True, False, False, False, False, False, False, False);

    Zero : constant Octet.T_Bit_Octet :=
       (False, False, False, False, False, False, False, False);

    Moins_Un : constant Octet.T_Bit_Octet :=
       (True, True, True, True, True, True, True, True);

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

    Operande_1, Operande_2, Flag : Octet.T_Octet := 0;

    Bit_Octet_1, Bit_Octet_2, Bit_Flag : Octet.T_Bit_Octet :=
       (False, False, False, False, False, False, False, False);

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

    procedure Inc_F (Octet_1, Flag : in out Octet.T_Octet);
    procedure Dec_F (Octet_1, Flag : in out Octet.T_Octet);
    procedure And_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet);
    procedure Or_F (Octet_1 : in out Octet.T_Octet;
                    Octet_2 : Octet.T_Octet;
                    Flag : in out Octet.T_Octet);
    procedure Xor_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet);
    procedure Neg_F (Octet_1, Flag : in out Octet.T_Octet);
    procedure Adc_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet);
    procedure Add_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet);
    procedure Sbc_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet);
    procedure Sub_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet);
    procedure Cp_F (Octet_1 : Octet.T_Octet;
                    Octet_2 : Octet.T_Octet;
                    Flag : in out Octet.T_Octet);
    procedure Rl_F (Octet_1 : in out Octet.T_Octet;
                    Flag : in out Octet.T_Octet;
                    Flag_P_Z_S_A_Modifier : Boolean);
    procedure Rlc_F (Octet_1 : in out Octet.T_Octet;
                     Flag : in out Octet.T_Octet;
                     Flag_P_Z_S_A_Modifier : Boolean);
    procedure Rr_F (Octet_1 : in out Octet.T_Octet;
                    Flag : in out Octet.T_Octet;
                    Flag_P_Z_S_A_Modifier : Boolean);
    procedure Rrc_F (Octet_1 : in out Octet.T_Octet;
                     Flag : in out Octet.T_Octet;
                     Flag_P_Z_S_A_Modifier : Boolean);

    procedure Sla_F (Octet_1 : in out Octet.T_Octet;
                     Flag : in out Octet.T_Octet);
    procedure Sra_F (Octet_1 : in out Octet.T_Octet;
                     Flag : in out Octet.T_Octet);
    procedure Srl_F (Octet_1 : in out Octet.T_Octet;
                     Flag : in out Octet.T_Octet);


    procedure Modif_Flag_Z_S (Bit_Octet : Octet.T_Bit_Octet;
                              Flag : in out Octet.T_Bit_Octet);
    procedure Modif_Flag_P_Z_S (Bit_Octet : Octet.T_Bit_Octet;
                                Flag : in out Octet.T_Bit_Octet);
    procedure Add_8_Bit_C_V_H (Bit_Octet_1 : in out Octet.T_Bit_Octet;
                               Bit_Octet_2 : Octet.T_Bit_Octet;
                               Carry : in out Boolean;
                               Over_Flow : in out Boolean;
                               Half_Carry : in out Boolean);


    --------------------------------------------------------------------------
    -- PUBLIC
    --------------------------------------------------------------------------


    procedure Fournir_Operande_1 (Op_1 : Octet.T_Octet) is
    begin
        Operande_1 := Op_1;
    end Fournir_Operande_1;

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

    procedure Fournir_Operande_2 (Op_2 : Octet.T_Octet) is
    begin
        Operande_2 := Op_2;
    end Fournir_Operande_2;


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

    function Executer (Operation : T_Operation) return Octet.T_Octet is
    begin

        Flag := Registres.Lire_Simple (Z80_Defs.F);

        case Operation is

            when Desassembleur.Inc =>
                Inc_F (Operande_1, Flag);

            when Desassembleur.Dec =>
                Dec_F (Operande_1, Flag);

            when Desassembleur.Z80_And =>
                And_F (Operande_1, Operande_2, Flag);

            when Desassembleur.Z80_Or =>
                Or_F (Operande_1, Operande_2, Flag);

            when Desassembleur.Z80_Xor =>
                Xor_F (Operande_1, Operande_2, Flag);

            when Desassembleur.Neg =>
                Neg_F (Operande_1, Flag);

            when Desassembleur.Adc =>
                Adc_F (Operande_1, Operande_2, Flag);

            when Desassembleur.Add =>
                Add_F (Operande_1, Operande_2, Flag);

            when Desassembleur.Sbc =>
                Sbc_F (Operande_1, Operande_2, Flag);

            when Desassembleur.Sub =>
                Sub_F (Operande_1, Operande_2, Flag);

            when Desassembleur.Cp =>
                Cp_F (Operande_1, Operande_2, Flag);

            when Desassembleur.Rl =>
                Rl_F (Operande_1, Flag, True);

            when Desassembleur.Rla =>
                Rl_F (Operande_1, Flag, False);

            when Desassembleur.Rlc =>
                Rlc_F (Operande_1, Flag, True);

            when Desassembleur.Rlca =>
                Rlc_F (Operande_1, Flag, False);

            when Desassembleur.Rr =>
                Rr_F (Operande_1, Flag, True);

            when Desassembleur.Rra =>
                Rr_F (Operande_1, Flag, False);

            when Desassembleur.Rrc =>
                Rrc_F (Operande_1, Flag, True);

            when Desassembleur.Rrca =>
                Rrc_F (Operande_1, Flag, False);

            when Desassembleur.Sla =>
                Sla_F (Operande_1, Flag);

            when Desassembleur.Sra =>
                Sra_F (Operande_1, Flag);

            when Desassembleur.Srl =>
                Srl_F (Operande_1, Flag);

            when others =>
                null;

        end case;

        -- sauvegarde flags + retour resultat de l'operation
        Registres.Ecrire_Simple (Z80_Defs.F, Flag);
        return Operande_1;

    end Executer;




    --------------------------------------------------------------------------
    -- PRIVE
    --------------------------------------------------------------------------

    procedure Inc_F (Octet_1, Flag : in out Octet.T_Octet) is

        Carry : Boolean := False;

    begin  
        Bit_Flag := Octet.Convert_Bit (Flag);

        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);
        Add_8_Bit_C_V_H (Bit_Octet_1, Un, Carry, Bit_Flag (2), Bit_Flag (4));
        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  (rq: half_carry et over_flow modifiee par add_8_bit_c_v_h)
        Bit_Flag (1) := False;
        Modif_Flag_Z_S (Bit_Octet_1, Bit_Flag);
        Flag := Octet.Convert_Octet (Bit_Flag);

    end Inc_F;

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

    procedure Dec_F (Octet_1, Flag : in out Octet.T_Octet) is

        Carry : Boolean := False;

    begin  
        Bit_Flag := Octet.Convert_Bit (Flag);

        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);
        Add_8_Bit_C_V_H (Bit_Octet_1, Moins_Un, Carry,
                         Bit_Flag (2), Bit_Flag (4));
        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  (rq: half_carry over_flow modifiee par add_8_bit_c_v_h)
        Bit_Flag (1) := True;  
        Bit_Flag (4) := not Bit_Flag (4);
        Modif_Flag_Z_S (Bit_Octet_1, Bit_Flag);
        Flag := Octet.Convert_Octet (Bit_Flag);

    end Dec_F;

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

    procedure And_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet) is
    begin
        Octet_1 := Octet."and" (Octet_1, Octet_2);
        Bit_Flag := Octet.Convert_Bit (Flag);
        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);

        -- flag
        Bit_Flag (0) := False;
        Bit_Flag (1) := False;  
        Bit_Flag (4) := True;
        Modif_Flag_P_Z_S (Bit_Octet_1, Bit_Flag);
        Flag := Octet.Convert_Octet (Bit_Flag);

    end And_F;

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

    procedure Or_F (Octet_1 : in out Octet.T_Octet;
                    Octet_2 : Octet.T_Octet;
                    Flag : in out Octet.T_Octet) is
    begin
        Octet_1 := Octet."or" (Octet_1, Octet_2);
        Bit_Flag := Octet.Convert_Bit (Flag);
        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);

        -- flag
        Bit_Flag (0) := False;
        Bit_Flag (1) := False;  
        Bit_Flag (4) := False;
        Modif_Flag_P_Z_S (Bit_Octet_1, Bit_Flag);
        Flag := Octet.Convert_Octet (Bit_Flag);
    end Or_F;

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

    procedure Xor_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet) is
    begin
        Octet_1 := Octet."xor" (Octet_1, Octet_2);
        Bit_Flag := Octet.Convert_Bit (Flag);
        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);

        -- flag
        Bit_Flag (0) := False;
        Bit_Flag (1) := False;  
        Bit_Flag (4) := False;
        Modif_Flag_P_Z_S (Bit_Octet_1, Bit_Flag);
        Flag := Octet.Convert_Octet (Bit_Flag);
    end Xor_F;

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

    procedure Neg_F (Octet_1, Flag : in out Octet.T_Octet) is

        Carry : Boolean := False;
    begin

        Octet_1 := Octet."not" (Octet_1);
        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);
        Bit_Flag := Octet.Convert_Bit (Flag);
        Add_8_Bit_C_V_H (Bit_Octet_1, Un, Carry, Bit_Flag (2), Bit_Flag (4));
        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  rq: carry, half_cary et over_flow modifiees ds add_8_bit_c_v_h

        Bit_Flag (0) := not Carry;
        Bit_Flag (1) := True;
        Bit_Flag (4) := not Bit_Flag (4);
        Modif_Flag_Z_S (Bit_Octet_1, Bit_Flag);
        Flag := Octet.Convert_Octet (Bit_Flag);

    end Neg_F;

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

    procedure Adc_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet) is
    begin

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

        Add_8_Bit_C_V_H (Bit_Octet_1, Bit_Octet_2, Bit_Flag (0),
                         Bit_Flag (2), Bit_Flag (4));

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  rq: carry , half_cary et over_flow modifiees ds add_8_bit_c_v_h

        Bit_Flag (1) := False;
        Modif_Flag_Z_S (Bit_Octet_1, Bit_Flag);
        Flag := Octet.Convert_Octet (Bit_Flag);

    end Adc_F;

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

    procedure Add_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet) is

        Carry : Boolean := False;

    begin

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

        Add_8_Bit_C_V_H (Bit_Octet_1, Bit_Octet_2, Carry,
                         Bit_Flag (2), Bit_Flag (4));

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  rq: carry et half_cary modifiees ds add_8_bit_c_v_h

        Bit_Flag (0) := Carry;
        Bit_Flag (1) := False;
        Modif_Flag_Z_S (Bit_Octet_1, Bit_Flag);

        Flag := Octet.Convert_Octet (Bit_Flag);
    end Add_F;

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

    procedure Sub_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet) is

        Carry : Boolean := False;

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

        Bit_Octet_2 := Octet."not" (Bit_Octet_2);
        Add_8_Bit_C_V_H (Bit_Octet_2, Un, Carry, Bit_Flag (2), Bit_Flag (4));

        Carry := False;
        Add_8_Bit_C_V_H (Bit_Octet_1, Bit_Octet_2, Carry,
                         Bit_Flag (2), Bit_Flag (4));

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  rq: carry, half_cary et over_flow modifiees ds add_8_bit_c_v_h

        Bit_Flag (0) := not Carry;
        Bit_Flag (1) := True;
        Bit_Flag (4) := not Bit_Flag (4);
        Modif_Flag_Z_S (Bit_Octet_1, Bit_Flag);
        Flag := Octet.Convert_Octet (Bit_Flag);

    end Sub_F;

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


    procedure Sbc_F (Octet_1 : in out Octet.T_Octet;
                     Octet_2 : Octet.T_Octet;
                     Flag : in out Octet.T_Octet) is

        Carry : Boolean := False;
    begin

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

        if Bit_Flag (0) then
            Add_8_Bit_C_V_H (Bit_Octet_2, Zero, Bit_Flag (0),
                             Bit_Flag (2), Bit_Flag (4));
        end if;

        Bit_Octet_2 := Octet."not" (Bit_Octet_2);
        Add_8_Bit_C_V_H (Bit_Octet_2, Un, Carry, Bit_Flag (2), Bit_Flag (4));


        Bit_Flag (0) := False;
        Add_8_Bit_C_V_H (Bit_Octet_1, Bit_Octet_2, Bit_Flag (0),
                         Bit_Flag (2), Bit_Flag (4));

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  rq: carry, half_cary et over_flow modifiees ds add_8_bit_c_v_h

        Bit_Flag (0) := not Bit_Flag (0);
        Bit_Flag (1) := True;
        Bit_Flag (4) := not Bit_Flag (4);
        Modif_Flag_Z_S (Bit_Octet_1, Bit_Flag);
        Flag := Octet.Convert_Octet (Bit_Flag);


    end Sbc_F;


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

    procedure Cp_F (Octet_1 : Octet.T_Octet;
                    Octet_2 : Octet.T_Octet;
                    Flag : in out Octet.T_Octet) is

        Carry : Boolean := False;

    begin

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

        Bit_Octet_2 := Octet."not" (Bit_Octet_2);
        Add_8_Bit_C_V_H (Bit_Octet_2, Un, Carry, Bit_Flag (2), Bit_Flag (4));

        Carry := False;
        Add_8_Bit_C_V_H (Bit_Octet_1, Bit_Octet_2, Carry,
                         Bit_Flag (2), Bit_Flag (4));



        -- flag  rq: carry, half_cary et over_flow modifiees ds add_8_bit_c_v_h

        Bit_Flag (0) := Octet_1 < Octet_2;
        Bit_Flag (1) := True;
        Bit_Flag (4) := not Bit_Flag (4);
        Modif_Flag_Z_S (Bit_Octet_1, Bit_Flag);
        Flag := Octet.Convert_Octet (Bit_Flag);
    end Cp_F;




    --------------------------------------------------
    -- DECALAGES
    --------------------------------------------------


    function Modif_Flag_Decalage
                (Bit_Octet_1 : Octet.T_Bit_Octet;
                 Bit_Flag : Octet.T_Bit_Octet;
                 Flag_P_Z_S_A_Modifier : Boolean) return Octet.T_Octet is

        Le_Bit_Flag : Octet.T_Bit_Octet := Bit_Flag;

    begin

        Le_Bit_Flag (1) := False;
        Le_Bit_Flag (4) := False;
        if Flag_P_Z_S_A_Modifier then
            Modif_Flag_P_Z_S (Bit_Octet_1, Le_Bit_Flag);
        end if;
        return Octet.Convert_Octet (Le_Bit_Flag);

    end Modif_Flag_Decalage;


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

    procedure Rl_F (Octet_1 : in out Octet.T_Octet;
                    Flag : in out Octet.T_Octet;
                    Flag_P_Z_S_A_Modifier : Boolean) is

        Sauv_Carry : Boolean;

    begin

        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);
        Bit_Flag := Octet.Convert_Bit (Flag);
        Sauv_Carry := Bit_Flag (0);

        Bit_Flag (0) := Bit_Octet_1 (7);
        for I in reverse 1 .. 7 loop
            Bit_Octet_1 (I) := Bit_Octet_1 (I - 1);
        end loop;
        Bit_Octet_1 (0) := Sauv_Carry;

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  (rq carry modifiee ds la boucle)

        Flag := Modif_Flag_Decalage
                   (Bit_Octet_1, Bit_Flag, Flag_P_Z_S_A_Modifier);
    end Rl_F;

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

    procedure Rlc_F (Octet_1 : in out Octet.T_Octet;
                     Flag : in out Octet.T_Octet;
                     Flag_P_Z_S_A_Modifier : Boolean) is

    begin

        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);
        Bit_Flag := Octet.Convert_Bit (Flag);

        Bit_Flag (0) := Bit_Octet_1 (7);

        for I in reverse 1 .. 7 loop
            Bit_Octet_1 (I) := Bit_Octet_1 (I - 1);
        end loop;
        Bit_Octet_1 (0) := Bit_Flag (0);

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag   (rq carry modifiee ds la boucle)
        Flag := Modif_Flag_Decalage
                   (Bit_Octet_1, Bit_Flag, Flag_P_Z_S_A_Modifier);
    end Rlc_F;

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

    procedure Rr_F (Octet_1 : in out Octet.T_Octet;
                    Flag : in out Octet.T_Octet;
                    Flag_P_Z_S_A_Modifier : Boolean) is

        Sauv_Carry : Boolean;

    begin

        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);
        Bit_Flag := Octet.Convert_Bit (Flag);
        Sauv_Carry := Bit_Flag (0);

        Bit_Flag (0) := Bit_Octet_1 (0);

        for I in 0 .. 6 loop
            Bit_Octet_1 (I) := Bit_Octet_1 (I + 1);
        end loop;
        Bit_Octet_1 (7) := Sauv_Carry;

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  (rq carry modifiee ds la boucle)

        Flag := Modif_Flag_Decalage
                   (Bit_Octet_1, Bit_Flag, Flag_P_Z_S_A_Modifier);
    end Rr_F;

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

    procedure Rrc_F (Octet_1 : in out Octet.T_Octet;
                     Flag : in out Octet.T_Octet;
                     Flag_P_Z_S_A_Modifier : Boolean) is

    begin
        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);
        Bit_Flag := Octet.Convert_Bit (Flag);

        Bit_Flag (0) := Bit_Octet_1 (0);

        for I in 0 .. 6 loop
            Bit_Octet_1 (I) := Bit_Octet_1 (I + 1);
        end loop;
        Bit_Octet_1 (7) := Bit_Flag (0);

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag   (rq carry modifiee ds la boucle)
        Flag := Modif_Flag_Decalage
                   (Bit_Octet_1, Bit_Flag, Flag_P_Z_S_A_Modifier);

    end Rrc_F;

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

    procedure Sla_F (Octet_1 : in out Octet.T_Octet;
                     Flag : in out Octet.T_Octet) is
    begin
        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);
        Bit_Flag := Octet.Convert_Bit (Flag);

        Bit_Flag (0) := Bit_Octet_1 (7);

        for I in reverse 1 .. 7 loop
            Bit_Octet_1 (I) := Bit_Octet_1 (I - 1);
        end loop;

        Bit_Octet_1 (0) := False;

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  (rq carry modifiee ds la boucle)

        Flag := Modif_Flag_Decalage (Bit_Octet_1, Bit_Flag, True);

    end Sla_F;

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

    procedure Sra_F (Octet_1 : in out Octet.T_Octet;
                     Flag : in out Octet.T_Octet) is

    begin
        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);
        Bit_Flag := Octet.Convert_Bit (Flag);

        Bit_Flag (0) := Bit_Octet_1 (0);

        for I in 0 .. 6 loop
            Bit_Octet_1 (I) := Bit_Octet_1 (I + 1);
        end loop;

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  (rq carry modifiee ds la boucle)

        Flag := Modif_Flag_Decalage (Bit_Octet_1, Bit_Flag, True);

    end Sra_F;

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

    procedure Srl_F (Octet_1 : in out Octet.T_Octet;
                     Flag : in out Octet.T_Octet) is
    begin
        Bit_Octet_1 := Octet.Convert_Bit (Octet_1);
        Bit_Flag := Octet.Convert_Bit (Flag);

        Bit_Flag (0) := Bit_Octet_1 (0);

        for I in 0 .. 6 loop
            Bit_Octet_1 (I) := Bit_Octet_1 (I + 1);
        end loop;

        Bit_Octet_1 (7) := False;

        Octet_1 := Octet.Convert_Octet (Bit_Octet_1);

        -- flag  (rq carry modifiee ds la boucle)


        Flag := Modif_Flag_Decalage (Bit_Octet_1, Bit_Flag, True);

    end Srl_F;



    --------------------------------------------------
    -- PROCEDURES INTERNES (privees)
    --------------------------------------------------

    procedure Add_8_Bit_C_V_H (Bit_Octet_1 : in out Octet.T_Bit_Octet;
                               Bit_Octet_2 : Octet.T_Bit_Octet;
                               Carry : in out Boolean;
                               Over_Flow : in out Boolean;
                               Half_Carry : in out Boolean) is

        -- ajoute 2 octets entre eux en tenant compte de la carry passee
        -- en parametre et en modifiant la carry, la half_carry et l'over_flow
        -- qui on ete passe en parametre
    begin
        for I in Octet.Num_Bit loop
            Octet.Add_Bit_C (Bit_Octet_1 (I), Bit_Octet_2 (I), Carry);
            if I = 3 then
                Half_Carry := Carry;
            end if;
            if I = 6 then  
                Over_Flow := Carry;
            end if;  
        end loop;  
        Over_Flow := Over_Flow xor Carry;
    end Add_8_Bit_C_V_H;


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


    procedure Modif_Flag_Z_S (Bit_Octet : Octet.T_Bit_Octet;
                              Flag : in out Octet.T_Bit_Octet) is

    begin

        -- flag Z
        Flag (6) := True;
        for I in Octet.Num_Bit loop
            if Bit_Octet (I) then
                Flag (6) := False;
                exit;
            end if;
        end loop;

        -- flag S
        Bit_Flag (7) := Bit_Octet (7);

    end Modif_Flag_Z_S;



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

    procedure Modif_Flag_P_Z_S (Bit_Octet : Octet.T_Bit_Octet;
                                Flag : in out Octet.T_Bit_Octet) is

        Nb_Bit_A_Un : Octet.T_Octet := 0;
    begin

        -- flag P
        for I in Octet.Num_Bit loop
            if Bit_Octet (I) then
                Nb_Bit_A_Un := Nb_Bit_A_Un + 1;
            end if;
        end loop;

        if (Nb_Bit_A_Un mod 2) = 1 then
            Flag (2) := False;
        else
            Flag (2) := True;
        end if;

        -- flag Z
        Flag (6) := (Nb_Bit_A_Un = 0);

        -- flag S
        Bit_Flag (7) := Bit_Octet (7);

    end Modif_Flag_P_Z_S;

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


end Alu_8_Bit;