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

⟦3786495d5⟧ TextFile

    Length: 9908 (0x26b4)
    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 Ihm, Bus, Memoire, Z80, Erreur, Z80_Scr, Verif_Input, Text_Io;
with Acia_Pack, Ppi_Pack, Ptm_Pack, Point_D_Arret, Mot;

package body Simu is

    Err_Badvalue : constant Natural := 2;

    --TYPES---------
    type T_Kind_Win is (Z80_Main, Acia, Ppi, Ptm, Mem, None);
    type Win is
        record
            Kind_Win : T_Kind_Win := None;
            No : Natural := 0;
        end record;

    --VARIABLES-----
    Main_Wid : Ihm.Window_Id;
    Fin : Boolean := False;
    Tab_Win : array (1 .. Ihm.Window.Nb_Wid) of Win;
    Win_Mem_Open : Boolean := False;

    --PROCEDURES-------
    procedure Pushbutton is
        Wid : Ihm.Window_Id;  
    begin
        if Ihm.Event.Get_Field (Main_Wid) = "Quit" then
            Z80.Detruire;
            Bus.Detruire;
            Memoire.Detruire;
            Fin := True;
        elsif Ihm.Event.Get_Field (Main_Wid) = "Stop" then
            Z80.Stopper;
        elsif Ihm.Event.Get_Field (Main_Wid) = "Reset" then
            Z80.Reset;
        elsif Ihm.Event.Get_Field (Main_Wid) = "Go" then
            Z80.Lancer;
        elsif Ihm.Event.Get_Field (Main_Wid) = "Step" then
            Z80.Pas_A_Pas;
        elsif Ihm.Event.Get_Field (Main_Wid) = "Memory" then
            if not Win_Mem_Open then
                Win_Mem_Open := True;
                Wid := Ihm.Window.Open ("MEM");
                Memoire.Open_Window (Wid);
                Tab_Win (Wid).Kind_Win := Mem;
                Tab_Win (Wid).No := 0;
            else
                Ihm.Window.Put_Field (Main_Wid, "MW.BB.Message",
                                      "MEMORY ERROR : Memory already opened");
            end if;
        elsif Ihm.Event.Get_Field (Main_Wid) = "DeleteAllBrk" then
            Point_D_Arret.Reset;
        else
            Text_Io.Put_Line ("ERROR Pushbutton invalid");
        end if;
    end Pushbutton;

    procedure Close_Periph_Window is
    begin
        for I in Tab_Win'Range loop
            if Tab_Win (I).Kind_Win in Acia .. Ptm then
                Ihm.Window.Close (I);
                Tab_Win (I).Kind_Win := None;
            end if;
        end loop;
    end Close_Periph_Window;

    procedure Fieldenter is
        Wid : Ihm.Window_Id;  
        Int : Integer;
    begin
        if Ihm.Event.Get_Field (Main_Wid) = "ConfigFile" then
            Z80.Stopper;
            Close_Periph_Window;
            Bus.Initialisation (Ihm.Event.Get_Value (Main_Wid));
            if not Erreur.Presente then
                Ihm.Window.Put_Field (Main_Wid, "MW.BB.Message",
                                      "Config File loaded");
            end if;
        elsif Ihm.Event.Get_Field (Main_Wid) = "LoadFile" then
            Z80.Stopper;
            Memoire.Charger_Fichier (Ihm.Event.Get_Value (Main_Wid));
            if not Erreur.Presente then
                Ihm.Window.Put_Field (Main_Wid, "MW.BB.Message",
                                      "Executable File loaded");
            end if;
        elsif Ihm.Event.Get_Field (Main_Wid) = "ACIA_Number" then
            if Verif_Input.Is_Digit (Ihm.Event.Get_Value (Main_Wid)) then
                Int := Natural'Value (Ihm.Event.Get_Value (Main_Wid));
                if Acia_Pack.Open_Window (Int) then
                    Wid := Ihm.Window.Open ("ACIA");
                    Acia_Pack.Open_Window (Int, Wid);
                    Tab_Win (Wid).Kind_Win := Acia;
                    Tab_Win (Wid).No := Int;
                end if;
            else
                Erreur.Detectee (Err_Badvalue);
            end if;
        elsif Ihm.Event.Get_Field (Main_Wid) = "PPI_Number" then
            if Verif_Input.Is_Digit (Ihm.Event.Get_Value (Main_Wid)) then
                Int := Natural'Value (Ihm.Event.Get_Value (Main_Wid));
                if Ppi_Pack.Open_Window (Int) then
                    Wid := Ihm.Window.Open ("PPI");
                    Ppi_Pack.Open_Window (Int, Wid);
                    Tab_Win (Wid).Kind_Win := Ppi;
                    Tab_Win (Wid).No := Int;
                end if;
            else
                Erreur.Detectee (Err_Badvalue);
            end if;
        elsif Ihm.Event.Get_Field (Main_Wid) = "TIMER_Number" then
            if Verif_Input.Is_Digit (Ihm.Event.Get_Value (Main_Wid)) then
                Int := Natural'Value (Ihm.Event.Get_Value (Main_Wid));
                if Ptm_Pack.Open_Window (Int) then
                    Wid := Ihm.Window.Open ("PTM");
                    Ptm_Pack.Open_Window (Int, Wid);
                    Tab_Win (Wid).Kind_Win := Ptm;
                    Tab_Win (Wid).No := Int;
                end if;
            else
                Erreur.Detectee (Err_Badvalue);
            end if;
        elsif Ihm.Event.Get_Field (Main_Wid) = "AddBrk" then
            Point_D_Arret.Set (Mot.Convert_String_Mot
                                  (Ihm.Event.Get_Value (Main_Wid)));
        elsif Ihm.Event.Get_Field (Main_Wid) = "DeleteBrk" then
            Point_D_Arret.Remove (Mot.Convert_String_Mot
                                     (Ihm.Event.Get_Value (Main_Wid)));
        else
            Z80_Scr.Lecture_Ecran_Reg (Ihm.Event.Get_Field (Main_Wid),
                                       Ihm.Event.Get_Value (Main_Wid));
        end if;
    end Fieldenter;

    procedure Lancer is
    begin
        Main_Wid := Ihm.Window.Open ("Z80");
        Tab_Win (Main_Wid).Kind_Win := Z80_Main;
        Tab_Win (Main_Wid).No := 1;

        Memoire.Creer;
        Bus.Creer;
        Z80.Creer (Main_Wid);

        Ihm.Window.Put_Field (Main_Wid, "MW.BB.Message",
                              "Simulateur Z80, Copyright BMS Avril 1993");
        while not Fin loop
            delay (Duration'Small);
            Ihm.Xt.Process_Event;
            for I in Tab_Win'Range loop
                if not Ihm.Event.Empty (I) then
                    if Ihm.Event."=" (Ihm.Event.Get_Event (I),
                                      Ihm.Event.Putfield) then
                        Ihm.Window.Display_Field (I, Ihm.Event.Get_Field (I),
                                                  Ihm.Event.Get_Value (I));
                    else
                        case Tab_Win (I).Kind_Win is
                            when Z80_Main =>
                                case Ihm.Event.Get_Event (I) is
                                    when Ihm.Event.Pushbutton =>
                                        Pushbutton;
                                    when Ihm.Event.Fieldenter =>
                                        Fieldenter;
                                    when others =>
                                        Text_Io.Put_Line
                                           ("*** Event received is unknown");
                                end case;
                            when Acia =>
                                Acia_Pack.Dispatch_Event
                                   (Tab_Win (I).No, Ihm.Event.Get_Event (I),
                                    Ihm.Event.Get_Field (I),
                                    Ihm.Event.Get_Value (I));
                                if Ihm.Event."=" (Ihm.Event.Get_Event (I),
                                                  Ihm.Event.Pushbutton) and then
                                   Ihm.Event.Get_Field (I) = "Cancel" then
                                    Ihm.Window.Close (I);
                                    Tab_Win (I).Kind_Win := None;
                                end if;
                            when Ppi =>
                                Ppi_Pack.Dispatch_Event
                                   (Tab_Win (I).No, Ihm.Event.Get_Event (I),
                                    Ihm.Event.Get_Field (I),
                                    Ihm.Event.Get_Value (I));
                                if Ihm.Event."=" (Ihm.Event.Get_Event (I),
                                                  Ihm.Event.Pushbutton) and then
                                   Ihm.Event.Get_Field (I) = "Cancel" then
                                    Ihm.Window.Close (I);
                                    Tab_Win (I).Kind_Win := None;
                                end if;
                            when Ptm =>
                                Ptm_Pack.Dispatch_Event
                                   (Tab_Win (I).No, Ihm.Event.Get_Event (I),
                                    Ihm.Event.Get_Field (I),
                                    Ihm.Event.Get_Value (I));
                                if Ihm.Event."=" (Ihm.Event.Get_Event (I),
                                                  Ihm.Event.Pushbutton) and then
                                   Ihm.Event.Get_Field (I) = "Cancel" then
                                    Ihm.Window.Close (I);
                                    Tab_Win (I).Kind_Win := None;
                                end if;
                            when Mem =>
                                Memoire.Dispatch_Event
                                   (Ihm.Event.Get_Event (I),
                                    Ihm.Event.Get_Field (I),
                                    Ihm.Event.Get_Value (I));
                                if Ihm.Event."=" (Ihm.Event.Get_Event (I),
                                                  Ihm.Event.Pushbutton) and then
                                   Ihm.Event.Get_Field (I) = "Cancel" then
                                    Ihm.Window.Close (I);
                                    Tab_Win (I).Kind_Win := None;
                                    Win_Mem_Open := False;
                                end if;
                            when None =>
                                Text_Io.Put_Line
                                   ("*** Event received apart to none window");
                        end case;
                    end if;
                    Ihm.Event.Next (I);
                end if;
            end loop;
        end loop;
    end Lancer;

end Simu;