Merge branch 'hardware-interface'
Conflicts: src/core/src/core.h
This commit is contained in:
commit
f446f79da2
34 changed files with 1786 additions and 168 deletions
|
@ -152,6 +152,8 @@
|
|||
<ClCompile Include="src\elf\elf_reader.cpp" />
|
||||
<ClCompile Include="src\file_sys\directory_file_system.cpp" />
|
||||
<ClCompile Include="src\file_sys\meta_file_system.cpp" />
|
||||
<ClCompile Include="src\hw\hw.cpp" />
|
||||
<ClCompile Include="src\hw\hw_lcd.cpp" />
|
||||
<ClCompile Include="src\loader.cpp" />
|
||||
<ClCompile Include="src\mem_map.cpp" />
|
||||
<ClCompile Include="src\mem_map_funcs.cpp" />
|
||||
|
@ -180,6 +182,8 @@
|
|||
<ClInclude Include="src\file_sys\directory_file_system.h" />
|
||||
<ClInclude Include="src\file_sys\file_sys.h" />
|
||||
<ClInclude Include="src\file_sys\meta_file_system.h" />
|
||||
<ClInclude Include="src\hw\hw.h" />
|
||||
<ClInclude Include="src\hw\hw_lcd.h" />
|
||||
<ClInclude Include="src\loader.h" />
|
||||
<ClInclude Include="src\mem_map.h" />
|
||||
<ClInclude Include="src\system.h" />
|
||||
|
|
|
@ -46,6 +46,12 @@
|
|||
<ClCompile Include="src\arm\interpreter\arm_interpreter.cpp">
|
||||
<Filter>arm\interpreter</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\hw\hw.cpp">
|
||||
<Filter>hw</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\hw\hw_lcd.cpp">
|
||||
<Filter>hw</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="arm">
|
||||
|
@ -69,6 +75,9 @@
|
|||
<Filter Include="arm\interpreter">
|
||||
<UniqueIdentifier>{cca8b763-8a80-4478-9bcc-3c979293c357}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="hw">
|
||||
<UniqueIdentifier>{d1158fc4-3e0f-431f-9d3b-f30bbfeb4ad5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\arm\disassembler\arm_disasm.h">
|
||||
|
@ -136,6 +145,12 @@
|
|||
<ClInclude Include="src\arm\interpreter\arm_interpreter.h">
|
||||
<Filter>arm\interpreter</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\hw\hw.h">
|
||||
<Filter>hw</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\hw\hw_lcd.h">
|
||||
<Filter>hw</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="CMakeLists.txt" />
|
||||
|
|
|
@ -24,24 +24,65 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
#include "common_types.h"
|
||||
|
||||
/// Generic ARM11 CPU interface
|
||||
class ARM_Interface {
|
||||
public:
|
||||
ARM_Interface() {
|
||||
num_instructions_ = 0;
|
||||
}
|
||||
|
||||
~ARM_Interface() {
|
||||
}
|
||||
|
||||
virtual void ExecuteInstruction() = 0;
|
||||
|
||||
virtual void SetPC(u32 pc) = 0;
|
||||
/// Step CPU by one instruction
|
||||
void Step() {
|
||||
ExecuteInstruction();
|
||||
num_instructions_++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Program Counter to an address
|
||||
* @param addr Address to set PC to
|
||||
*/
|
||||
virtual void SetPC(u32 addr) = 0;
|
||||
|
||||
/*
|
||||
* Get the current Program Counter
|
||||
* @return Returns current PC
|
||||
*/
|
||||
virtual u32 PC() = 0;
|
||||
|
||||
/**
|
||||
* Get an ARM register
|
||||
* @param index Register index (0-15)
|
||||
* @return Returns the value in the register
|
||||
*/
|
||||
virtual u32 Reg(int index) = 0;
|
||||
|
||||
virtual u32 CPSR() = 0;
|
||||
/**
|
||||
* Get the current CPSR register
|
||||
* @return Returns the value of the CPSR register
|
||||
*/
|
||||
virtual u32 CPSR() = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of clock ticks since the last rese
|
||||
* @return Returns number of clock ticks
|
||||
*/
|
||||
virtual u64 GetTicks() = 0;
|
||||
|
||||
/// Getter for num_instructions_
|
||||
u64 num_instructions() { return num_instructions_; }
|
||||
|
||||
private:
|
||||
|
||||
/// Execture next instruction
|
||||
virtual void ExecuteInstruction() = 0;
|
||||
|
||||
u64 num_instructions_; ///< Number of instructions executed
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ARM_Interface);
|
||||
};
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/**
|
||||
* Copyright (C) 2013 Citrus Emulator
|
||||
*
|
||||
* @file arm_interpreter.h
|
||||
* @author bunnei
|
||||
* @date 2014-04-04
|
||||
* @brief ARM interface instance for SkyEye interprerer
|
||||
*
|
||||
* @section LICENSE
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details at
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* Official project repository can be found at:
|
||||
* http://code.google.com/p/gekko-gc-emu/
|
||||
*/
|
||||
* Copyright (C) 2013 Citrus Emulator
|
||||
*
|
||||
* @file arm_interpreter.h
|
||||
* @author bunnei
|
||||
* @date 2014-04-04
|
||||
* @brief ARM interface instance for SkyEye interprerer
|
||||
*
|
||||
* @section LICENSE
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details at
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* Official project repository can be found at:
|
||||
* http://code.google.com/p/gekko-gc-emu/
|
||||
*/
|
||||
|
||||
#include "arm_interpreter.h"
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
#include "common_types.h"
|
||||
#include "arm/arm_interface.h"
|
||||
|
||||
|
@ -45,6 +46,12 @@ public:
|
|||
|
||||
u32 CPSR();
|
||||
|
||||
u64 GetTicks() {
|
||||
return ARMul_Time(state);
|
||||
}
|
||||
|
||||
private:
|
||||
ARMul_State* state;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ARM_Interpreter);
|
||||
};
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "log.h"
|
||||
#include "core.h"
|
||||
#include "mem_map.h"
|
||||
#include "hw/hw.h"
|
||||
#include "arm/disassembler/arm_disasm.h"
|
||||
#include "arm/interpreter/arm_interpreter.h"
|
||||
|
||||
|
@ -41,7 +42,8 @@ void RunLoop() {
|
|||
|
||||
/// Step the CPU one instruction
|
||||
void SingleStep() {
|
||||
g_app_core->ExecuteInstruction();
|
||||
g_app_core->Step();
|
||||
HW::Update();
|
||||
}
|
||||
|
||||
/// Halt the core
|
||||
|
@ -69,6 +71,8 @@ void Shutdown() {
|
|||
delete g_disasm;
|
||||
delete g_app_core;
|
||||
delete g_sys_core;
|
||||
|
||||
NOTICE_LOG(MASTER_LOG, "Core shutdown OK");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -55,6 +55,9 @@ void Stop();
|
|||
/// Initialize the core
|
||||
int Init();
|
||||
|
||||
/// Shutdown the core
|
||||
void Shutdown();
|
||||
|
||||
} // namespace
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
69
src/core/src/hw/hw.cpp
Normal file
69
src/core/src/hw/hw.cpp
Normal file
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* Copyright (C) 2013 Citrus Emulator
|
||||
*
|
||||
* @file hw.cpp
|
||||
* @author bunnei
|
||||
* @date 2014-04-04
|
||||
* @brief Hardware interface
|
||||
*
|
||||
* @section LICENSE
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details at
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* Official project repository can be found at:
|
||||
* http://code.google.com/p/gekko-gc-emu/
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
#include "hw/hw.h"
|
||||
#include "hw/hw_lcd.h"
|
||||
|
||||
namespace HW {
|
||||
|
||||
template <typename T>
|
||||
inline void Read(T &var, const u32 addr) {
|
||||
NOTICE_LOG(HW, "Hardware read from address %08X", addr);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void Write(u32 addr, const T data) {
|
||||
NOTICE_LOG(HW, "Hardware write to address %08X", addr);
|
||||
}
|
||||
|
||||
// Explicitly instantiate template functions because we aren't defining this in the header:
|
||||
|
||||
template void Read<u64>(u64 &var, const u32 addr);
|
||||
template void Read<u32>(u32 &var, const u32 addr);
|
||||
template void Read<u16>(u16 &var, const u32 addr);
|
||||
template void Read<u8>(u8 &var, const u32 addr);
|
||||
|
||||
template void Write<const u64>(u32 addr, const u64 data);
|
||||
template void Write<const u32>(u32 addr, const u32 data);
|
||||
template void Write<const u16>(u32 addr, const u16 data);
|
||||
template void Write<const u8>(u32 addr, const u8 data);
|
||||
|
||||
/// Update hardware
|
||||
void Update() {
|
||||
LCD::Update();
|
||||
}
|
||||
|
||||
/// Initialize hardware
|
||||
void Init() {
|
||||
LCD::Init();
|
||||
NOTICE_LOG(HW, "Hardware initialized OK");
|
||||
}
|
||||
|
||||
/// Shutdown hardware
|
||||
void Shutdown() {
|
||||
NOTICE_LOG(HW, "Hardware shutdown OK");
|
||||
}
|
||||
|
||||
}
|
44
src/core/src/hw/hw.h
Normal file
44
src/core/src/hw/hw.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* Copyright (C) 2013 Citrus Emulator
|
||||
*
|
||||
* @file hw.h
|
||||
* @author bunnei
|
||||
* @date 2014-04-04
|
||||
* @brief Hardware interface
|
||||
*
|
||||
* @section LICENSE
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details at
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* Official project repository can be found at:
|
||||
* http://code.google.com/p/gekko-gc-emu/
|
||||
*/
|
||||
|
||||
#include "common_types.h"
|
||||
|
||||
namespace HW {
|
||||
|
||||
template <typename T>
|
||||
inline void Read(T &var, const u32 addr);
|
||||
|
||||
template <typename T>
|
||||
inline void Write(u32 addr, const T data);
|
||||
|
||||
/// Update hardware
|
||||
void Update();
|
||||
|
||||
/// Initialize hardware
|
||||
void Init();
|
||||
|
||||
/// Shutdown hardware
|
||||
void Shutdown();
|
||||
|
||||
} // namespace
|
65
src/core/src/hw/hw_lcd.cpp
Normal file
65
src/core/src/hw/hw_lcd.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* Copyright (C) 2013 Citrus Emulator
|
||||
*
|
||||
* @file hw_lcd.cpp
|
||||
* @author bunnei
|
||||
* @date 2014-04-05
|
||||
* @brief Hardware LCD interface
|
||||
*
|
||||
* @section LICENSE
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details at
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* Official project repository can be found at:
|
||||
* http://code.google.com/p/gekko-gc-emu/
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
#include "core.h"
|
||||
#include "hw_lcd.h"
|
||||
#include "video_core.h"
|
||||
|
||||
namespace LCD {
|
||||
|
||||
static const u32 kFrameTicks = 268123480 / 60; ///< 268MHz / 60 frames per second
|
||||
|
||||
u64 g_last_ticks = 0; ///< Last CPU ticks
|
||||
|
||||
template <typename T>
|
||||
inline void Read(T &var, const u32 addr) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void Write(u32 addr, const T data) {
|
||||
}
|
||||
|
||||
/// Update hardware
|
||||
void Update() {
|
||||
u64 current_ticks = Core::g_app_core->GetTicks();
|
||||
|
||||
if ((current_ticks - g_last_ticks) >= kFrameTicks) {
|
||||
g_last_ticks = current_ticks;
|
||||
VideoCore::g_renderer->SwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
/// Initialize hardware
|
||||
void Init() {
|
||||
g_last_ticks = Core::g_app_core->GetTicks();
|
||||
NOTICE_LOG(LCD, "LCD initialized OK");
|
||||
}
|
||||
|
||||
/// Shutdown hardware
|
||||
void Shutdown() {
|
||||
NOTICE_LOG(LCD, "LCD shutdown OK");
|
||||
}
|
||||
|
||||
} // namespace
|
64
src/core/src/hw/hw_lcd.h
Normal file
64
src/core/src/hw/hw_lcd.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* Copyright (C) 2013 Citrus Emulator
|
||||
*
|
||||
* @file hw_lcd.h
|
||||
* @author bunnei
|
||||
* @date 2014-04-05
|
||||
* @brief Hardware LCD interface
|
||||
*
|
||||
* @section LICENSE
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details at
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* Official project repository can be found at:
|
||||
* http://code.google.com/p/gekko-gc-emu/
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common_types.h"
|
||||
|
||||
namespace LCD {
|
||||
|
||||
enum {
|
||||
TOP_ASPECT_X = 0x5,
|
||||
TOP_ASPECT_Y = 0x3,
|
||||
|
||||
TOP_HEIGHT = 240,
|
||||
TOP_WIDTH = 400,
|
||||
BOTTOM_WIDTH = 320,
|
||||
|
||||
FRAMEBUFFER_SEL = 0x20184E59,
|
||||
TOP_LEFT_FRAME1 = 0x20184E60,
|
||||
TOP_LEFT_FRAME2 = 0x201CB370,
|
||||
TOP_RIGHT_FRAME1 = 0x20282160,
|
||||
TOP_RIGHT_FRAME2 = 0x202C8670,
|
||||
SUB_FRAME1 = 0x202118E0,
|
||||
SUB_FRAME2 = 0x20249CF0,
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline void Read(T &var, const u32 addr);
|
||||
|
||||
template <typename T>
|
||||
inline void Write(u32 addr, const T data);
|
||||
|
||||
/// Update hardware
|
||||
void Update();
|
||||
|
||||
/// Initialize hardware
|
||||
void Init();
|
||||
|
||||
/// Shutdown hardware
|
||||
void Shutdown();
|
||||
|
||||
|
||||
} // namespace
|
|
@ -25,17 +25,23 @@
|
|||
#include "common.h"
|
||||
|
||||
#include "mem_map.h"
|
||||
#include "hw/hw.h"
|
||||
|
||||
namespace Memory {
|
||||
|
||||
template <typename T>
|
||||
inline void ReadFromHardware(T &var, const u32 addr) {
|
||||
inline void _Read(T &var, const u32 addr) {
|
||||
// TODO: Figure out the fastest order of tests for both read and write (they are probably different).
|
||||
// TODO: Make sure this represents the mirrors in a correct way.
|
||||
|
||||
// Could just do a base-relative read, too.... TODO
|
||||
|
||||
if ((addr & 0x3E000000) == 0x08000000) {
|
||||
// Hardware I/O register reads
|
||||
// 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
|
||||
if ((addr & 0xFF000000) == 0x10000000 || (addr & 0xFF000000) == 0x1E000000) {
|
||||
HW::Read<T>(var, addr);
|
||||
|
||||
// FCRAM virtual address reads
|
||||
} else if ((addr & 0x3E000000) == 0x08000000) {
|
||||
var = *((const T*)&g_fcram[addr & MEM_FCRAM_MASK]);
|
||||
|
||||
// Scratchpad memory
|
||||
|
@ -54,15 +60,20 @@ inline void ReadFromHardware(T &var, const u32 addr) {
|
|||
var = *((const T*)&g_fcram[addr & MEM_FCRAM_MASK]);
|
||||
|
||||
} else {
|
||||
_assert_msg_(MEMMAP, false, "unknown hardware read");
|
||||
// WARN_LOG(MEMMAP, "ReadFromHardware: Invalid addr %08x PC %08x LR %08x", addr, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
|
||||
_assert_msg_(MEMMAP, false, "unknown memory read");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void WriteToHardware(u32 addr, const T data) {
|
||||
inline void _Write(u32 addr, const T data) {
|
||||
|
||||
// Hardware I/O register writes
|
||||
// 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
|
||||
if ((addr & 0xFF000000) == 0x10000000 || (addr & 0xFF000000) == 0x1E000000) {
|
||||
HW::Write<const T>(addr, data);
|
||||
|
||||
// ExeFS:/.code is loaded here:
|
||||
if ((addr & 0xFFF00000) == 0x00100000) {
|
||||
} else if ((addr & 0xFFF00000) == 0x00100000) {
|
||||
// TODO(ShizZy): This is dumb... handle correctly. From 3DBrew:
|
||||
// http://3dbrew.org/wiki/Memory_layout#ARM11_User-land_memory_regions
|
||||
// The ExeFS:/.code is loaded here, executables must be loaded to the 0x00100000 region when
|
||||
|
@ -104,7 +115,7 @@ inline void WriteToHardware(u32 addr, const T data) {
|
|||
|
||||
// Error out...
|
||||
} else {
|
||||
_assert_msg_(MEMMAP, false, "unknown hardware write");
|
||||
_assert_msg_(MEMMAP, false, "unknown memory write");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,14 +137,21 @@ u8 *GetPointer(const u32 addr) {
|
|||
// TODO(bunnei): Just a stub for now... ImplementMe!
|
||||
if ((addr & 0x3E000000) == 0x08000000) {
|
||||
return g_fcram + (addr & MEM_FCRAM_MASK);
|
||||
}
|
||||
|
||||
// HACK(bunnei): There is no layer yet to translate virtual addresses to physical addresses.
|
||||
// Until we progress far enough along, we'll accept all physical address reads here. I think
|
||||
// that this is typically a corner-case from usermode software unless they are trying to do
|
||||
// bare-metal things (e.g. early 3DS homebrew writes directly to the FB @ 0x20184E60, etc.
|
||||
} else if (((addr & 0xF0000000) == MEM_FCRAM_PADDR) && (addr < (MEM_FCRAM_PADDR_END))) {
|
||||
return g_fcram + (addr & MEM_FCRAM_MASK);
|
||||
|
||||
//else if ((addr & 0x3F800000) == 0x04000000) {
|
||||
// return g_vram + (addr & MEM_VRAM_MASK);
|
||||
//}
|
||||
//else if ((addr & 0x3F000000) >= 0x08000000 && (addr & 0x3F000000) < 0x08000000 + g_MemorySize) {
|
||||
// return m_pRAM + (addr & g_MemoryMask);
|
||||
//}
|
||||
else {
|
||||
} else {
|
||||
//ERROR_LOG(MEMMAP, "Unknown GetPointer %08x PC %08x LR %08x", addr, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
|
||||
ERROR_LOG(MEMMAP, "Unknown GetPointer %08x", addr);
|
||||
static bool reported = false;
|
||||
|
@ -151,25 +169,25 @@ u8 *GetPointer(const u32 addr) {
|
|||
|
||||
u8 Read8(const u32 addr) {
|
||||
u8 _var = 0;
|
||||
ReadFromHardware<u8>(_var, addr);
|
||||
_Read<u8>(_var, addr);
|
||||
return (u8)_var;
|
||||
}
|
||||
|
||||
u16 Read16(const u32 addr) {
|
||||
u16_le _var = 0;
|
||||
ReadFromHardware<u16_le>(_var, addr);
|
||||
_Read<u16_le>(_var, addr);
|
||||
return (u16)_var;
|
||||
}
|
||||
|
||||
u32 Read32(const u32 addr) {
|
||||
u32_le _var = 0;
|
||||
ReadFromHardware<u32_le>(_var, addr);
|
||||
_Read<u32_le>(_var, addr);
|
||||
return _var;
|
||||
}
|
||||
|
||||
u64 Read64(const u32 addr) {
|
||||
u64_le _var = 0;
|
||||
ReadFromHardware<u64_le>(_var, addr);
|
||||
_Read<u64_le>(_var, addr);
|
||||
return _var;
|
||||
}
|
||||
|
||||
|
@ -182,19 +200,19 @@ u32 Read16_ZX(const u32 addr) {
|
|||
}
|
||||
|
||||
void Write8(const u32 addr, const u8 data) {
|
||||
WriteToHardware<u8>(addr, data);
|
||||
_Write<u8>(addr, data);
|
||||
}
|
||||
|
||||
void Write16(const u32 addr, const u16 data) {
|
||||
WriteToHardware<u16_le>(addr, data);
|
||||
_Write<u16_le>(addr, data);
|
||||
}
|
||||
|
||||
void Write32(const u32 addr, const u32 data) {
|
||||
WriteToHardware<u32_le>(addr, data);
|
||||
_Write<u32_le>(addr, data);
|
||||
}
|
||||
|
||||
void Write64(const u32 addr, const u64 data) {
|
||||
WriteToHardware<u64_le>(addr, data);
|
||||
_Write<u64_le>(addr, data);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
*/
|
||||
|
||||
#include "core.h"
|
||||
#include "hw/hw.h"
|
||||
#include "core_timing.h"
|
||||
#include "mem_map.h"
|
||||
#include "system.h"
|
||||
#include "video_core.h"
|
||||
|
||||
namespace System {
|
||||
|
||||
|
@ -38,7 +40,9 @@ void UpdateState(State state) {
|
|||
void Init(EmuWindow* emu_window) {
|
||||
Core::Init();
|
||||
Memory::Init();
|
||||
HW::Init();
|
||||
CoreTiming::Init();
|
||||
VideoCore::Init(emu_window);
|
||||
}
|
||||
|
||||
void RunLoopFor(int cycles) {
|
||||
|
@ -49,9 +53,10 @@ void RunLoopUntil(u64 global_cycles) {
|
|||
}
|
||||
|
||||
void Shutdown() {
|
||||
Core::Shutdown();
|
||||
HW::Shutdown();
|
||||
VideoCore::Shutdown();
|
||||
g_ctr_file_system.Shutdown();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue