Ejemplo n.º 1
0
 private void WriteHook_SMP(uint addr, byte val)
 {
     if (MemoryCallbacks.HasWrites)
     {
         uint flags = (uint)MemoryCallbackFlags.AccessWrite;
         MemoryCallbacks.CallMemoryCallbacks(addr, val, flags, "SMP");
     }
 }
Ejemplo n.º 2
0
 public void ExecFetch(ushort addr)
 {
     if (MemoryCallbacks.HasExecutes)
     {
         uint flags = (uint)(MemoryCallbackFlags.CPUZero | MemoryCallbackFlags.AccessExecute);
         MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
     }
 }
Ejemplo n.º 3
0
 // TODO: move callbacks to cpu to avoid non-inlinable function call
 private void ExecFetch(ushort addr)
 {
     if (MemoryCallbacks.HasExecutes)
     {
         uint flags = (uint)MemoryCallbackFlags.AccessExecute;
         MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
     }
 }
Ejemplo n.º 4
0
 private void ReadHook_SMP(uint addr)
 {
     if (MemoryCallbacks.HasReads)
     {
         uint flags = (uint)MemoryCallbackFlags.AccessRead;
         MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "SMP");
     }
 }
Ejemplo n.º 5
0
        public byte ReadMemory(ushort addr)
        {
            uint flags = (uint)(MemoryCallbackFlags.AccessRead);

            MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");

            return(ReadMemoryMapper(addr));
        }
Ejemplo n.º 6
0
        public void WriteMemory(ushort addr, byte value)
        {
            WriteMemoryMapper(addr, value);

            uint flags = (uint)(MemoryCallbackFlags.AccessWrite);

            MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "System Bus");
        }
Ejemplo n.º 7
0
 private void ExecHook_SMP(uint addr)
 {
     if (MemoryCallbacks.HasExecutes)
     {
         uint flags = (uint)MemoryCallbackFlags.AccessExecute;
         MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "SMP");
     }
 }
Ejemplo n.º 8
0
        public void WriteMemoryWrapper(ushort addr, byte value)
        {
            if (MemoryCallbacks != null)
            {
                MemoryCallbacks.CallWrites(addr);
            }

            WriteMemory(addr, value);
        }
Ejemplo n.º 9
0
        public byte ReadMemoryWrapper(ushort addr)
        {
            if (MemoryCallbacks != null)
            {
                MemoryCallbacks.CallReads(addr);
            }

            return(ReadMemory(addr));
        }
Ejemplo n.º 10
0
        private void WriteHook(uint addr, byte val)
        {
            uint flags = (uint)(MemoryCallbackFlags.AccessWrite);

            MemoryCallbacks.CallMemoryCallbacks(addr, val, flags, "System Bus");
            // we RefreshMemoryCallbacks() after the trigger in case the trigger turns itself off at that point
            // EDIT: for now, theres some IPC re-entrancy problem
            // RefreshMemoryCallbacks();
        }
Ejemplo n.º 11
0
        public byte ReadMemory(ushort addr)
        {
            byte ret;

            if (addr >= 0x8000)
            {
                // easy optimization, since rom reads are so common, move this up (reordering the rest of these else ifs is not easy)
                ret = Board.ReadPrg(addr - 0x8000);
            }
            else if (addr < 0x0800)
            {
                ret = ram[addr];
            }
            else if (addr < 0x2000)
            {
                ret = ram[addr & 0x7FF];
            }
            else if (addr < 0x4000)
            {
                ret = Board.ReadReg2xxx(addr);
            }
            else if (addr < 0x4020)
            {
                ret = ReadReg(addr);                 // we're not rebasing the register just to keep register names canonical
            }
            else if (addr < 0x6000)
            {
                ret = Board.ReadExp(addr - 0x4000);
            }
            else
            {
                ret = Board.ReadWram(addr - 0x6000);
            }

            // handle cheats (currently cheats can only freeze read only areas)
            // there is no way to distinguish between a memory poke and a memory freeze
            if (num_cheats != 0)
            {
                for (int i = 0; i < num_cheats; i++)
                {
                    if (cheat_indexes[i] == addr)
                    {
                        ret = cheat_active[addr];
                    }
                }
            }

            if (MemoryCallbacks.HasReads)
            {
                uint flags = (uint)(MemoryCallbackFlags.CPUZero | MemoryCallbackFlags.AccessRead);
                MemoryCallbacks.CallMemoryCallbacks(addr, ret, flags, "System Bus");
            }

            DB = ret;
            return(ret);
        }
Ejemplo n.º 12
0
 void InitCallbacks()
 {
     padcb   = new LibVBANext.StandardCallback(() => InputCallbacks.Call());
     fetchcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallExecutes(addr));
     readcb  = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallReads(addr));
     writecb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallWrites(addr));
     tracecb = new LibVBANext.TraceCallback((addr, opcode) => Tracer.Put(Trace(addr, opcode)));
     _inputCallbacks.ActiveChanged  += SyncPadCallback;
     _memorycallbacks.ActiveChanged += SyncMemoryCallbacks;
 }
Ejemplo n.º 13
0
 private void ExecHook(uint addr)
 {
     if (MemoryCallbacks.HasExecutes)
     {
         uint flags = (uint)MemoryCallbackFlags.AccessExecute;
         MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
         // we RefreshMemoryCallbacks() after the trigger in case the trigger turns itself off at that point
         // EDIT: for now, theres some IPC re-entrancy problem
         // RefreshMemoryCallbacks();
     }
 }
Ejemplo n.º 14
0
        internal void WriteMemory(ushort addr, byte value)
        {
            if (addr != LastAddress)
            {
                DistinctAccessCount++;
                LastAddress = addr;
            }

            _mapper.WriteMemory((ushort)(addr & 0x1FFF), value);

            MemoryCallbacks.CallWrites(addr);
        }
Ejemplo n.º 15
0
        private void WriteMemory(ushort addr, byte value)
        {
            if (addr != _lastAddress)
            {
                DistinctAccessCount++;
                _lastAddress = addr;
            }

            _mapper.WriteMemory((ushort)(addr & 0x1FFF), value);

            MemoryCallbacks.CallWrites(addr, "System Bus");
        }
Ejemplo n.º 16
0
        private void WriteMemory(ushort addr, byte value)
        {
            if (addr != _lastAddress)
            {
                DistinctAccessCount++;
                _lastAddress = addr;
            }

            _mapper.WriteMemory((ushort)(addr & 0x1FFF), value);
            var flags = (uint)(MemoryCallbackFlags.AccessWrite);

            MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "System Bus");
        }
Ejemplo n.º 17
0
        public void WriteMemory(ushort addr, byte value)
        {
            uint flags = (uint)(MemoryCallbackFlags.AccessWrite);

            MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "System Bus");

            if (addr < 0x400)
            {
            }
            else
            {
                mapper.WriteMemory(addr, value);
            }
        }
Ejemplo n.º 18
0
        public byte FetchMemoryWrapper(ushort addr)
        {
            if (MemoryCallbacks != null)
            {
                MemoryCallbacks.CallReads(addr);
            }

            if (FetchMemory != null)
            {
                return(FetchMemory(addr, false));
            }

            return(ReadMemory(addr));
        }
Ejemplo n.º 19
0
        internal byte ReadMemory(ushort addr)
        {
            if (addr != LastAddress)
            {
                DistinctAccessCount++;
                LastAddress = addr;
            }

            _mapper.Bit13 = addr.Bit(13);
            var temp = _mapper.ReadMemory((ushort)(addr & 0x1FFF));

            MemoryCallbacks.CallReads(addr);

            return(temp);
        }
Ejemplo n.º 20
0
        public byte ReadMemory(ushort addr)
        {
            uint flags = (uint)(MemoryCallbackFlags.AccessRead);

            MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");

            if (addr < 0x400)
            {
                return(_bios[addr]);
            }
            else
            {
                return(mapper.ReadMemory((ushort)((addr - 0x400) | rom_bank)));
            }
        }
Ejemplo n.º 21
0
        public byte ReadMemory(ushort addr)
        {
            if (MemoryCallbacks.HasReads)
            {
                uint flags = (uint)MemoryCallbackFlags.AccessRead;
                MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
            }

            if (addr < 0x400)
            {
                return(_bios[addr]);
            }

            return(mapper.ReadMemory((ushort)((addr - 0x400) + bank_size * rom_bank)));
        }
Ejemplo n.º 22
0
        public byte ReadMemory(ushort addr)
        {
            byte ret;

            if (addr >= 0x8000)
            {
                ret = Board.ReadPRG(addr - 0x8000);                 //easy optimization, since rom reads are so common, move this up (reordering the rest of these elseifs is not easy)
            }
            else if (addr < 0x0800)
            {
                ret = ram[addr];
            }
            else if (addr < 0x2000)
            {
                ret = ram[addr & 0x7FF];
            }
            else if (addr < 0x4000)
            {
                ret = Board.ReadReg2xxx(addr);
            }
            else if (addr < 0x4020)
            {
                ret = ReadReg(addr);                 //we're not rebasing the register just to keep register names canonical
            }
            else if (addr < 0x6000)
            {
                ret = Board.ReadEXP(addr - 0x4000);
            }
            else
            {
                ret = Board.ReadWRAM(addr - 0x6000);
            }

            //handle breakpoints and stuff.
            //the idea is that each core can implement its own watch class on an address which will track all the different kinds of monitors and breakpoints and etc.
            //but since freeze is a common case, it was implemented through its own mechanisms
            if (sysbus_watch[addr] != null)
            {
                sysbus_watch[addr].Sync();
                ret = sysbus_watch[addr].ApplyGameGenie(ret);
            }

            MemoryCallbacks.CallReads(addr);

            DB = ret;

            return(ret);
        }
Ejemplo n.º 23
0
        private byte ReadMemory(ushort addr)
        {
            if (addr != _lastAddress)
            {
                DistinctAccessCount++;
                _lastAddress = addr;
            }

            _mapper.Bit13 = addr.Bit(13);
            var temp = _mapper.ReadMemory((ushort)(addr & 0x1FFF));

            _tia.BusState = temp;
            MemoryCallbacks.CallReads(addr);

            return(temp);
        }
Ejemplo n.º 24
0
        private byte ReadMemory(ushort addr)
        {
            if (addr != _lastAddress)
            {
                DistinctAccessCount++;
                _lastAddress = addr;
            }

            _mapper.Bit13 = addr.Bit(13);
            var temp = _mapper.ReadMemory((ushort)(addr & 0x1FFF));

            _tia.BusState = temp;
            var flags = (uint)(MemoryCallbackFlags.AccessRead);

            MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");

            return(temp);
        }
Ejemplo n.º 25
0
 private void InitMemCallbacks()
 {
     ExecCallback = new LibGPGX.mem_cb(a =>
     {
         uint flags = (uint)(MemoryCallbackFlags.AccessExecute);
         MemoryCallbacks.CallMemoryCallbacks(a, 0, flags, "M68K BUS");
     });
     ReadCallback = new LibGPGX.mem_cb(a =>
     {
         uint flags = (uint)(MemoryCallbackFlags.AccessRead);
         MemoryCallbacks.CallMemoryCallbacks(a, 0, flags, "M68K BUS");
     });
     WriteCallback = new LibGPGX.mem_cb(a =>
     {
         uint flags = (uint)(MemoryCallbackFlags.AccessWrite);
         MemoryCallbacks.CallMemoryCallbacks(a, 0, flags, "M68K BUS");
     });
     _memoryCallbacks.ActiveChanged += RefreshMemCallbacks;
 }
Ejemplo n.º 26
0
 private void SetCallbacks()
 {
     _machine.Memory.ReadCallback = (addr) =>
     {
         uint flags = (uint)(MemoryCallbackFlags.AccessRead);
         MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
     };
     _machine.Memory.WriteCallback = (addr) =>
     {
         uint flags = (uint)(MemoryCallbackFlags.AccessWrite);
         MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
     };
     _machine.Memory.ExecuteCallback = (addr) =>
     {
         uint flags = (uint)(MemoryCallbackFlags.AccessExecute);
         MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
     };
     _machine.Memory.InputCallback = InputCallbacks.Call;
 }
Ejemplo n.º 27
0
 void InitCallbacks()
 {
     padcb   = new LibVBANext.StandardCallback(() => InputCallbacks.Call());
     fetchcb = new LibVBANext.AddressCallback((addr) => {
         uint flags = (uint)(MemoryCallbackFlags.AccessExecute);
         MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
     });
     readcb = new LibVBANext.AddressCallback((addr) =>
     {
         uint flags = (uint)(MemoryCallbackFlags.AccessRead);
         MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
     });
     writecb = new LibVBANext.AddressCallback((addr) =>
     {
         uint flags = (uint)(MemoryCallbackFlags.AccessWrite);
         MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
     });
     tracecb = new LibVBANext.TraceCallback((addr, opcode) => Tracer.Put(Trace(addr, opcode)));
     _inputCallbacks.ActiveChanged  += SyncPadCallback;
     _memorycallbacks.ActiveChanged += SyncMemoryCallbacks;
 }
Ejemplo n.º 28
0
        public void WriteMemory(ushort addr, byte value)
        {
            if (addr < 0x0800)
            {
                ram[addr] = value;
            }
            else if (addr < 0x2000)
            {
                ram[addr & 0x7FF] = value;
            }
            else if (addr < 0x4000)
            {
                Board.WriteReg2xxx(addr, value);
            }
            else if (addr < 0x4020)
            {
                WriteReg(addr, value);                  //we're not rebasing the register just to keep register names canonical
            }
            else if (addr < 0x6000)
            {
                Board.WriteExp(addr - 0x4000, value);
            }
            else if (addr < 0x8000)
            {
                Board.WriteWram(addr - 0x6000, value);
            }
            else
            {
                Board.WritePrg(addr - 0x8000, value);
            }

            if (MemoryCallbacks.HasWrites)
            {
                uint flags = (uint)(MemoryCallbackFlags.CPUZero | MemoryCallbackFlags.AccessWrite | MemoryCallbackFlags.SizeByte);
                MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "System Bus");
            }
        }
        public byte ReadMemory(ushort addr)
        {
            if (MemoryCallbacks.HasReads)
            {
                uint flags = (uint)MemoryCallbackFlags.AccessRead;
                MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
            }

            if (addr < 0x8000)
            {
                return(mapper.ReadMemory(addr));
            }
            else if (addr < 0xC800)
            {
                return(0xFF);
            }
            else if (addr < 0xD000)
            {
                return(RAM[(addr - 0xC800) & 0x3FF]);
            }
            else if (addr < 0xD800)
            {
                return(Read_Registers(addr & 0xF));
            }
            else if (addr < 0xE000)
            {
                return(0xFF);
            }
            else if (addr < 0xF000)
            {
                return(minestorm[addr - 0xE000]);
            }
            else
            {
                return(_bios[addr - 0xF000]);
            }
        }
Ejemplo n.º 30
0
 private void ExecFetch(ushort addr)
 {
     MemoryCallbacks.CallExecutes(addr, "System Bus");
 }