Beispiel #1
0
        public void ToggleBreakPoint(int address)
        {
            var breakpoint = Breakpoints[address];
            var memoryMap  = MemoryMapManager.GetMemoryMap(address);

            if (memoryMap != null && memoryMap.Type == RangeType.Data)
            {
                return;
            }

            if (breakpoint != null)
            {
                Breakpoints.Remove(breakpoint.Address);
            }
            else
            {
                Breakpoints.Add(address);
            }
        }
Beispiel #2
0
    void Awake()
    {
        instance = this;

        if (nativeLibraryPtr != IntPtr.Zero)
        {
            return;
        }

        nativeLibraryPtr = Native.LoadLibrary("UnityMemoryMapPlugin");
        if (nativeLibraryPtr == IntPtr.Zero)
        {
            Debug.LogError("Failed to load native library");
        }

        if (showPluginConsole)
        {
            Native.Invoke <openConsole>(nativeLibraryPtr);
        }
    }
Beispiel #3
0
        public Trainer(ET3400Settings settings, PictureBox displayTarget)
        {
            Memory            = new int[65536];
            Breakpoints       = new BreakpointCollection();
            Settings          = settings;
            Watches           = new List <Watch>();
            MemoryMapManager  = new MemoryMapManager();
            MemoryMapEventBus = new MemoryMapEventBus();


            _mc6820 = new MC6820();
            _debugConsoleAdapter       = new DebugConsoleAdapter();
            _mc6820.OnPeripheralWrite += OnPeripheralWrite;
            _mc6820.OnPeripheralRead  += OnPeripheralRead;

            Settings.SettingsUpdated += (sender, args) =>
            {
                Runner.Recalibrate();
            };

            State = new Cpu6800State();

            Emulator = new Cpu6800
            {
                State = State,

                ReadMem = address =>
                {
                    address = address & 0xFFFF;

                    if (address >= 0x1000 && address <= 0x1003)
                    {
                        //_mc6820.RegisterSelect(address & 3);
                        //return _mc6820.Get();
                        return(_mc6820.Get(address & 3));
                    }

                    //foreach (var watch in Watches.ToList())
                    //{
                    //    if (watch.EventType == EventType.Read)
                    //    {
                    //        //if (watch.Address == address)
                    //        //{

                    //        //}
                    //        watch.Action(new WatchEventArgs() { Address = address });
                    //    }
                    //}

                    return(Memory[address]);
                },

                WriteMem = (address, value) =>
                {
                    address = address & 0xFFFF;

                    foreach (var watch in Watches.ToList())
                    {
                        if (watch.EventType == EventType.Write)
                        {
                            //if (watch.Address == address)
                            //{

                            //}

                            watch.Action(new WatchEventArgs()
                            {
                                Address = address
                            });
                        }
                    }

                    if (address >= 0x1000 && address <= 0x1003)
                    {
                        //_mc6820.RegisterSelect(address & 3);
                        //_mc6820.Set(value);
                        _mc6820.Set(address & 3, value);
                        return;
                    }

                    if (address >= 0x1400 && address <= 0x1BFF)
                    {
                        // Prevent writing to ROM-mapped space
                        return;
                    }

                    if (address >= 0x1C00 && address <= 0x23FF)
                    {
                        // Prevent writing to ROM-mapped space
                        return;
                    }

                    if (address >= 0xFC00)
                    {
                        // Prevent writing to ROM-mapped space
                        return;
                    }

                    // Limit writing to RAM addresses only?
                    Memory[address] = value;
                }
            };

            //Runner = new StandardRunner(this);
            Runner = new CycleExactRunner(this);

            _display        = new LedDisplay(displayTarget, this);
            Runner.OnSleep += OnSleep;

            // Set keyboard mapped memory 'high'
            Memory[0xC003] = 0xFF;
            Memory[0xC005] = 0xFF;
            Memory[0xC006] = 0xFF;
        }
Beispiel #4
0
 // Update is called once per frame
 void Update()
 {
     MemoryMapManager.fillData(data);
 }