Пример #1
0
        public Terminal(VGA vga)
        {
            _vga         = vga;
            _inputBuffer = string.Empty;

            InputHistory = new List <string>();
        }
Пример #2
0
        static public void WritePort(int port, int val)
        {
            if ((port & 0xC000) == 0x04000)
            {
                VGA.Write(val);
            }

            if ((port & 0x4000) == 0)
            {
                CRTC.Write(port, val);
            }

            if ((port & 0x2000) == 0)
            {
                VGA.WriteROM(val);
            }

            if ((port & 0x0800) == 0)
            {
                PPI.Write(port, val);
            }

            if ((port & 0x0480) == 0)
            {
                UPD.Write(port, val);
            }
        }
Пример #3
0
        private void InitializeVgaAdapter()
        {
            if (Vga == null)
            {
                Vga = new VGA(Font);

                Vga.InitialSetupComplete = () =>
                {
                    try
                    {
                        Task.Run(VGA_InitialSetUpComplete, InteractionCancellation.Token);
                    }
                    catch (OperationCanceledException)
                    {
                        Console.WriteLine("lol..");
                    }
                };
                Vga.FailsafeTriggered += VGA_FailsafeTriggered;
            }
            else
            {
                Vga.ResetInitialization();
                Vga.ClearScreen(false);
            }
        }
Пример #4
0
 // draw bitmap - colored
 public static void DrawBitmap(Rectangle bounds, uint[] data, uint color, uint transCol, bool transparency)
 {
     for (int i = 0; i < bounds.width * bounds.height; i++)
     {
         int xx = bounds.x + (i % bounds.width);
         int yy = bounds.y + (i / bounds.width);
         if (transparency)
         {
             if (data[i] != transCol)
             {
                 if (driverMode == 0)
                 {
                     SVGA.SetPixel(xx, yy, color);
                 }
                 else if (driverMode == 1)
                 {
                     VGA.SetPixel(xx, yy, Color.ToARGB(color));
                 }
             }
         }
         else
         {
             SVGA.SetPixel(xx, yy, color);
         }
     }
 }
Пример #5
0
        public SHARPDX(Form uiForm, VGA device)
            : base(uiForm, device)
        {
            UIForm = uiForm;
            //UIForm.Close();
            UIForm.Show();

            Memory = new byte[Width * Height * 4]; // BGRA
        }
Пример #6
0
        public XNAUI(Form UIForm, VGA device)
            : base(UIForm, device)
        {
            Panel panel = new Panel();

            panel.Location   = new System.Drawing.Point(0, 0);
            panel.ClientSize = UIForm.ClientSize;
            UIForm.Controls.Add(panel);
            renderControl    = panel;
            oldKeyboardState = Keyboard.GetState();
            UIForm.Show();
        }
Пример #7
0
        public Machine(Form uiForm)
        {
            picDevice     = new PIC8259();
            vgaDevice     = new VGA();
            FloppyDrive   = new Floppy();
            dmaController = new DMAController();
            keyboard      = new KeyboardDevice();
            ataDevice     = new ATA();

            if (SystemConfig.Machine.Floppies.Count > 0)
            {
                FloppyDrive.MountImage(SystemConfig.Machine.Floppies[0].Image);
            }

            switch (Settings.Default.graphics.ToUpper())
            {
                //case "XNA":
                //    throw new Exception("XNA not supported OwO");
                //    //gui = new XNAUI(uiForm, vgaDevice);
                //    break;
                //case "SDL":
                //    gui = new SDLUI(uiForm, vgaDevice);
                //    break;
            }

            gui = new SHARPDX(uiForm, vgaDevice); // SharpDX it is
            //gui = new ASCII(uiForm, vgaDevice); // ASCII test

            Application.Idle += new System.EventHandler(ApplicationIdle);

            gui.KeyDown += new EventHandler <UIntEventArgs>(GUIKeyDown);
            gui.KeyUp   += new EventHandler <UIntEventArgs>(GUIKeyUp);

            gui.Init();

            devices = new IDevice[]
            {
                FloppyDrive, new CMOS(ataDevice), new Misc(), new PIT8253(), picDevice, keyboard, dmaController, vgaDevice, ataDevice
            };

            CPU = new CPU.CPU();

            picDevice.Interrupt += PicDeviceInterrupt;

            SetupSystem();

            CPU.IORead  += CPUIORead;
            CPU.IOWrite += CPUIOWrite;
        }
Пример #8
0
        protected override void Run()
        {
            Console.Write("Input: ");
            var input = Console.ReadLine();

            Console.Write("Text typed: ");
            Console.WriteLine(input);
            int Hr  = (int)Cosmos.Hardware.RTC.Hour;
            int Min = (int)Cosmos.Hardware.RTC.Minute;
            int Sec = (int)Cosmos.Hardware.RTC.Second;

            Console.WriteLine(Hr.ToString() + ":" + Min.ToString() + ":" + Sec.ToString());
            VGA.Mode();
            VGA.Clear(3);
            VGA.Plot(23, 56, 8);
        }
Пример #9
0
 // fill rectangle
 public static void FillRectangle(Rectangle bounds, uint c)
 {
     for (int i = 0; i < bounds.width * bounds.height; i++)
     {
         int xx = i % bounds.width;
         int yy = i / bounds.width;
         if (bounds.width > 0 && bounds.height > 0)
         {
             if (driverMode == 0)
             {
                 SVGA.SetPixel(bounds.x + xx, bounds.y + yy, c);
             }
             else if (driverMode == 1)
             {
                 VGA.SetPixel(bounds.x + xx, bounds.y + yy, Color.ToARGB(c));
             }
         }
     }
 }
Пример #10
0
        // NOTE: Detect all ASCII characters based on its pixel values and print text in a default console window?

        public ASCII(Form uiForm, VGA device)
            : base(uiForm, device)
        {
            UIForm = uiForm;
            UIForm.Close();

            // spawn console window
            ProcessStartInfo psi = new ProcessStartInfo("cmd.exe")
            {
                RedirectStandardError  = true,
                RedirectStandardInput  = true,
                RedirectStandardOutput = true,
                UseShellExecute        = false
            };

            Process p = Process.Start(psi);

            StreamWriter sw = p.StandardInput;
            StreamReader sr = p.StandardOutput;

            sw.WriteLine("Initialising ASCII UI..");
            sr.Close();
        }
Пример #11
0
        public ushort SetLigne(ushort Adr, ref string Buffer)
        {
            int    Instr, Inst2 = 0, Inst3, Ad16, Ad8;
            string Chaine, Inst;

            Buffer  = Adr.ToString("X4") + "    ";
            Instr   = VGA.PEEK8(Adr++);
            Buffer += " " + Instr.ToString("X2");
            Chaine  = TabInstr[Instr];
            if (Instr == 0xCB)
            {
                Inst2   = VGA.PEEK8(Adr++);
                Buffer += " " + Inst2.ToString("X2");
                Chaine  = TabInstrCB[Inst2];
            }
            else
            if (Instr == 0xED)
            {
                Inst2   = VGA.PEEK8(Adr++);
                Buffer += " " + Inst2.ToString("X2");
                Chaine  = TabInstrED[Inst2];
            }
            else
            if (Instr == 0xDD || Instr == 0xFD)
            {
                Inst2   = VGA.PEEK8(Adr++);
                Buffer += " " + Inst2.ToString("X2");
                if (Inst2 == 0xCB)
                {
                    Inst3  = VGA.PEEK8((ushort)(Adr + 1));
                    Chaine = TabInstrXXCB[Inst3];
                }
                else
                {
                    Chaine = TabInstrXX[Inst2];
                }
            }

            if (Chaine == null)
            {
                Chaine = "????";
            }

            Inst = Chaine;
            if (Instr == 0xFD)
            {
                Inst.Replace("IX", "IY");
            }

            Ad8  = VGA.PEEK8(Adr);
            Ad16 = Ad8 + VGA.PEEK8((ushort)(Adr + 1)) << 8;
            if (Ad8 > 127)
            {
                Ad8 -= 256;
            }
            if (Inst.Contains("nnnn"))
            {
                Inst = Inst.Replace("nnnn", Ad16.ToString("X4"));
                Adr += 2;
            }
            else
            {
                if (Inst.Contains("nn"))
                {
                    Inst = Inst.Replace("nn", Ad8.ToString("X2"));
                    Adr++;
                    if (Inst2 == 0xCB)
                    {
                        Inst = Inst.Replace("nn", (Ad16 >> 8).ToString("X2"));
                        Adr++;
                    }
                    if (Inst.Contains("nn"))
                    {
                    }
                }
                else
                {
                    if (Inst.Contains("eeee"))
                    {
                        Inst = Inst.Replace("eeee", (++Adr + Ad8).ToString("X4"));
                    }
                }
            }
            Buffer += " " + Inst;
            return(Adr);
        }
Пример #12
0
Файл: UI.cs Проект: hmyit/VM86CS
 public UI(Form uiForm, VGA device)
 {
     vgaDevice = device;
 }
Пример #13
0
 public SDLUI(Form uiForm, VGA device)
     : base(uiForm, device)
 {
     UIForm = uiForm;
     UIForm.Close();
 }
Пример #14
0
 public Laptop(Model model, Manufacturer manufacturer, Processor processor, sbyte ram, VGA graphicsCard, ushort hdd, double screen, Battery battery, double batteryLife, double price)
 {
     this.Model        = model;
     this.Manufacturer = manufacturer;
     this.Processor    = processor;
     this.RAM          = ram;
     this.GraphicsCard = graphicsCard;
     this.HDD          = hdd;
     this.Screen       = screen;
     this.Battery      = battery;
     this.BatteryLife  = batteryLife;
     this.Price        = price;
 }
Пример #15
0
 public Laptop(Model model, Manufacturer manufacturer, Processor processor, sbyte ram, VGA graphicsCard, double price)
 {
     this.Model        = model;
     this.Manufacturer = manufacturer;
     this.Processor    = processor;
     this.RAM          = ram;
     this.GraphicsCard = graphicsCard;
     this.Price        = price;
 }