253 float GetSingle(
int reg)
const;
254 double GetDouble(
int reg)
const;
255 void SetSingle(
int reg,
float value);
256 void SetDouble(
int reg,
double value);
267 bool m_stopped =
false;
The VR4300 processor and the RDRAM it runs from.
Definition mipscpu.h:35
MipsCpu(std::size_t ramSize)
Make a processor with zeroed RDRAM.
std::uint32_t fcr31
The control and status register of the floating-point unit.
Definition mipscpu.h:218
void Write32(std::uint32_t address, std::uint32_t value)
Write a big-endian word of memory.
void SetHook(std::uint32_t address, Hook hook)
Set the routine called before the instruction at an address of RDRAM.
std::uint32_t Argument(int index)
Read an argument of the routine a hook is on, from a0 to a3 and then from the stack.
std::uint16_t Read16(std::uint32_t address)
Read a big-endian half-word of memory.
std::uint32_t Read32(std::uint32_t address)
Read a big-endian word of memory.
std::uint64_t lo
The low word of a product or the quotient of a division.
Definition mipscpu.h:214
void SetDevices(DeviceRead read, DeviceWrite write)
Set the routines the registers of the console are read and written through.
void SetRom(std::span< const std::uint8_t > rom)
Set the cartridge image the physical addresses from 0x10000000 read.
std::uint64_t instructions
The instructions run.
Definition mipscpu.h:226
std::vector< std::uint8_t > ram
The RDRAM.
Definition mipscpu.h:208
void Write16(std::uint32_t address, std::uint16_t value)
Write a big-endian half-word of memory.
std::uint32_t npc
The address of the instruction after it, the target of a branch taken.
Definition mipscpu.h:224
std::function< void(std::uint32_t address, int size, std::uint64_t value)> DeviceWrite
A write to the registers of the console: the physical address, the size, and the value.
Definition mipscpu.h:55
void Return(std::uint32_t value)
Return from the routine a hook is on, as its last instruction would.
const std::string & Fault() const
Definition mipscpu.h:123
void Write8(std::uint32_t address, std::uint8_t value)
Write a byte of memory.
void Write64(std::uint32_t address, std::uint64_t value)
Write a big-endian double word of memory.
std::uint64_t Ticks() const
Definition mipscpu.h:231
HookResult
What a hook did.
Definition mipscpu.h:43
@ Jumped
Definition mipscpu.h:45
@ Continue
Definition mipscpu.h:44
std::uint32_t cop0[32]
The registers of the system control processor.
Definition mipscpu.h:220
std::uint32_t Count() const
Definition mipscpu.h:236
std::uint64_t hi
The high word of a product or the remainder of a division.
Definition mipscpu.h:212
float ReadFloat(std::uint32_t address)
Read a single-precision value of memory.
void Jump(std::uint32_t address)
Set the program counter, with no branch pending.
void SetIdle(std::function< void(MipsCpu &)> idle)
Set the routine called when the processor spins on a branch to itself, as an idle thread does.
std::function< std::uint64_t(std::uint32_t address, int size)> DeviceRead
A read of the registers of the console: the physical address and the size in bytes.
Definition mipscpu.h:52
void Stop()
Stop Run() before the next instruction.
std::uint8_t Read8(std::uint32_t address)
Read a byte of memory, through the map of the console.
std::uint64_t Read64(std::uint32_t address)
Read a big-endian double word of memory.
std::function< HookResult(MipsCpu &)> Hook
A routine called before the instruction at the address it is set on.
Definition mipscpu.h:49
std::uint64_t idleTicks
The ticks of Count added to those of the instructions, as time spent idle.
Definition mipscpu.h:228
std::uint32_t pc
The address of the next instruction.
Definition mipscpu.h:222
bool Run(std::uint64_t budget)
Run instructions until Stop() or a fault.
std::uint32_t fpr[32]
The floating-point registers, as 32-bit halves.
Definition mipscpu.h:216
std::uint64_t gpr[32]
The general registers.
Definition mipscpu.h:210
Definition assetimport.h:11
MipsRegister
The numbers of the general registers the calling convention gives a role.
Definition mipscpu.h:22
@ MIPS_A3
Definition mipscpu.h:29
@ MIPS_ZERO
Definition mipscpu.h:23
@ MIPS_V1
Definition mipscpu.h:25
@ MIPS_A0
Definition mipscpu.h:26
@ MIPS_V0
Definition mipscpu.h:24
@ MIPS_A2
Definition mipscpu.h:28
@ MIPS_RA
Definition mipscpu.h:31
@ MIPS_A1
Definition mipscpu.h:27
@ MIPS_SP
Definition mipscpu.h:30