Exemple #1
0
        public void Test_POST_2()
        {
            // writes into each register

            i8086CPU cpu = GetCPU(new byte[] {
                0xb8, 0xff, 0xff,                           // mov ax,0xffff
                0xf9,                                       // stc
                /* C8 */ 0x8e, 0xd8,                        // mov ds, ax
                0x8c, 0xdb,                                 // mov bx, ds
                0x8e, 0xc3,                                 // mov es, bx
                0x8c, 0xc1,
                0x8e, 0xd1,
                0x8c, 0xd2,
                0x8b, 0xe2,
                0x8b, 0xec,
                0x8b, 0xf5,
                0x8b, 0xfe,
                0x73, 0x07,                  // jnc c9
                0x33, 0xc7,
                0x75, 0x07,                  // jnz err
                0xf8,                        // clc
                0xeb, 0xe3,                  // jmp c8
                /* C9 */ 0x0b, 0xc7,
                0xf4                         //hlt
            });

            cpu.Run();
            Assert.AreEqual(true, cpu.EU.CondReg.ZeroFlag, "POST 2: zero flag failed");
        }
Exemple #2
0
        static void DisplayMenu()
        {
            Console.WriteLine("[Enter]:step [R]:run [B]:run to break [Q]:quit");
            int  input;
            char ch = '0';

            input = Console.Read();
            ch    = Convert.ToChar(input);
            if (input == 13)
            {
                cpu.EU.Tick();
                input = Console.Read();  // throw away lf char
            }
            else if (ch == 'r' || ch == 'R')
            {
                sw.Restart();
                count = cpu.Run();
                sw.Stop();
            }
            else if (ch == 'b' || ch == 'B')
            {
                // flush CRLF
                input = Console.Read();
                input = Console.Read();
                // loop until we hit our breakpoint
                do
                {
                    cpu.EU.Tick();
                } while (cpu.Bus.IP != 0xE1D4);
            }


            if (ch == 'Q' || ch == 'q')
            {
                exit = true;
            }
        }