示例#1
0
 public RestoreCommand(WD1797 w, StepRate rate, bool hld, bool verify)
 {
     _w      = w;
     _rate   = rate;
     _hld    = hld;
     _verify = verify;
 }
示例#2
0
 public ReadSectorCommand(WD1797 w, bool updateSSO, bool delay, bool swapSectorLength, bool multipleRecords)
 {
     _w                = w;
     _updateSSO        = updateSSO;
     _delay            = delay;
     _swapSectorLength = swapSectorLength;
     _multipleRecords  = multipleRecords;
 }
示例#3
0
 public StepCommand(WD1797 w, StepRate rate, bool hld, bool verify, bool updateReg, StepDirection stepDir)
 {
     _w         = w;
     _rate      = rate;
     _hld       = hld;
     _verify    = verify;
     _updateReg = updateReg;
     _stepDir   = stepDir;
 }
示例#4
0
 public InterruptCommand(WD1797 w)
 {
     _w = w;
 }
示例#5
0
        public void Initialize()
        {
            AllocConsole();
            Console.BufferHeight = 32766;
            Console.WriteLine("z100emu");
            //Console.WriteLine("IMD Version: " + _disk.ImdVersion);
            //Console.WriteLine("IMD Date:    " + _disk.ImdDate);
            //Console.WriteLine("IMD Comment: " + _disk.ImdComment);

            _rom = ZenithRom.GetRom("mtr.bin");

            _slavePic  = new Intel8259();
            _masterPic = new Intel8259(_slavePic);
            _timer     = new Intel8253(_masterPic);
            Ram        = new ZenithRam(512 * 1024, _masterPic);
            _video     = new ZenithVideo(_masterPic);
            //_disk = new RawFloppy(File.ReadAllBytes("zdos4-1.img"));
            _disk = new RawFloppy(File.ReadAllBytes("bios402-msdos401-1.img"));
            //_disk = new RawFloppy(File.ReadAllBytes("zdos31-diag.img"));
            //_disk = new RawFloppy(File.ReadAllBytes("zdos31-1.img"));
            //_disk = new ImdFloppy(File.ReadAllBytes("msdosv11.imd"));

            _cpu = new Cpu8086(Ram, _masterPic);
            _cpu.DebugLineEmitted += DebugLine;

            Keyboard = new Zenith8041a(_masterPic);

            _masterStatus = new StatusPort(_slavePic, 0xB5);
            _masterFloppy = new WD1797(_masterStatus, 0xB0, _disk);
            _masterCl     = new ControlLatch(0xB4);
            _slaveStatus  = new StatusPort(_slavePic, 0xBD);
            _slaveFloppy  = new WD1797(_slaveStatus, 0xB8, _disk);
            _slaveCl      = new ControlLatch(0xBC);

            _steps      = 0;
            _totalUs    = 0;
            _totalTicks = 0;
            _sw         = new Stopwatch();


            Ram.MapBank(_rom);
            Ram.MapBank(_video);

            _cpu.AttachPortDevice(_timer);

            _cpu.AttachPortDevice(_masterPic);
            _cpu.AttachPortDevice(_slavePic);

            _cpu.AttachPortDevice(new ZenithMemControl(Ram, _rom));
            _cpu.AttachPortDevice(new ZenithReserved());

            _cpu.AttachPortDevice(Keyboard);
            _cpu.AttachPortDevice(new ZenithParallel());
            _cpu.AttachPortDevice(new ZenithSerial(0xE8));
            _cpu.AttachPortDevice(new ZenithSerial(0xEC));
            _cpu.AttachPortDevice(new ZenithExpansion());

            _cpu.AttachPortDevice(new ZenithDIP());

            _cpu.AttachPortDevice(new ZenithWinchester());

            _cpu.AttachPortDevice(_masterFloppy);
            _cpu.AttachPortDevice(_masterCl);
            _cpu.AttachPortDevice(_masterStatus);
            _cpu.AttachPortDevice(_slaveFloppy);
            _cpu.AttachPortDevice(_slaveCl);
            _cpu.AttachPortDevice(_slaveStatus);

            _cpu.AttachPortDevice(_video);

            Breakpoints = new List <Breakpoint>();

            Status = SystemStatus.Paused;
            RefreshProps();

            //AddBreakpoint(0x51B9);
            //AddBreakpoint(0x40 * 0x10 + 0x4424); // timer
            //AddBreakpoint(0x40 * 0x10 + 0x44B6); // mem
            AddBreakpoint(0x40 * 0x10 + 0x450D); // mem
            AddBreakpoint(0x8716);               // ?
        }
示例#6
0
        private static void Main()
        {
            Console.BufferHeight = 32766;
            Console.WriteLine("z100emu");

            var rom = ZenithRom.GetRom("v1-2.bin");

            var slave8259  = new Intel8259();
            var master8259 = new Intel8259(slave8259);

            var video = new ZenithVideo(master8259);
            var ram   = new ZenithRam(1024 * 1024, master8259);

            ram.MapBank(rom);

            var disk = new ImdFloppy(File.ReadAllBytes("msd2131.imd"));

            Console.WriteLine("IMD Version: " + disk.ImdVersion);
            Console.WriteLine("IMD Date:    " + disk.ImdDate);
            Console.WriteLine("IMD Comment: " + disk.ImdComment);

            ICpu cpu = new Cpu8086(ram, master8259);

            var timer = new Intel8253(master8259);

            cpu.AttachPortDevice(timer);

            cpu.AttachPortDevice(master8259);
            cpu.AttachPortDevice(slave8259);

            cpu.AttachPortDevice(new ZenithMemControl(ram, rom));
            cpu.AttachPortDevice(new ZenithReserved());

            var kb = new Zenith8041a(master8259);

            cpu.AttachPortDevice(kb);
            cpu.AttachPortDevice(new ZenithParallel());
            cpu.AttachPortDevice(new ZenithSerial(0xE8));
            cpu.AttachPortDevice(new ZenithSerial(0xEC));
            cpu.AttachPortDevice(new ZenithExpansion());

            cpu.AttachPortDevice(new ZenithDIP());

            cpu.AttachPortDevice(new ZenithWinchester());

            var masterStatus = new StatusPort(slave8259, 0xB5);
            var masterFloppy = new WD1797(masterStatus, 0xB0, disk);
            var masterCl     = new ControlLatch(0xB4);
            var slaveStatus  = new StatusPort(slave8259, 0xBD);
            var slaveFloppy  = new WD1797(slaveStatus, 0xB8, disk);
            var slaveCl      = new ControlLatch(0xBC);

            cpu.AttachPortDevice(masterFloppy);
            cpu.AttachPortDevice(masterCl);
            cpu.AttachPortDevice(masterStatus);
            cpu.AttachPortDevice(slaveFloppy);
            cpu.AttachPortDevice(slaveCl);
            cpu.AttachPortDevice(slaveStatus);

            ram.MapBank(video);
            cpu.AttachPortDevice(video);


            var debug = false;

            double cpuHertz = 4.77 * 1000000;

            Stopwatch sw = new Stopwatch();

            var quit = false;

            while (!quit)
            {
                sw.Restart();
                double clocks = cpu.ProcessSingleInstruction(debug);
                sw.Stop();
                double realUs = sw.ElapsedTicks * TimeSpan.TicksPerMillisecond * 1000;
                double us     = (clocks / cpuHertz) * 1000000;
                timer.Step(us);
                video.Step(us);
                master8259.Step();
                slave8259.Step();
                masterFloppy.Step(us);
                slaveFloppy.Step(us);
            }
        }
示例#7
0
 public ReadAddrCommand(WD1797 w, bool updateSSO)
 {
     _w         = w;
     _updateSSO = updateSSO;
 }