WolPSX
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
RAM Class Reference

Class to emulate the RAM. More...

#include <ram.hpp>

Public Member Functions

 RAM (uint32_t size)
 Construct a new RAM:: RAM object.
 
uint32_t read32_cpu (uint32_t offset)
 Reads a 32-bit word from the RAM.
 
void write32_cpu (uint32_t offset, uint32_t data)
 Writes a 32-bit word to the RAM.
 
uint16_t read16_cpu (uint32_t offset)
 Reads a 16-bit word from the RAM.
 
void write16_cpu (uint32_t offset, uint16_t data)
 Writes a 16-bit word to the RAM.
 
uint8_t read8_cpu (uint32_t offset)
 Reads a byte from the RAM.
 
void write8_cpu (uint32_t offset, uint8_t data)
 Writes a byte to the RAM.
 

Private Attributes

std::vector< uint8_t > data
 Data of the RAM.
 

Detailed Description

Class to emulate the RAM.

Implements the RAM of the PSX.

Definition at line 12 of file ram.hpp.

Constructor & Destructor Documentation

◆ RAM()

RAM::RAM ( uint32_t size)

Construct a new RAM:: RAM object.

Initializes the RAM with 0xca.

Parameters
sizeSize of the RAM in bytes

Definition at line 13 of file ram.cpp.

Member Function Documentation

◆ read16_cpu()

uint16_t RAM::read16_cpu ( uint32_t offset)

Reads a 16-bit word from the RAM.

Parameters
offsetOffset to read from
Returns
uint16_t Data read
Exceptions
std::runtime_errorIf the offset is unaligned
std::runtime_errorIf the offset is out of bounds

Definition at line 117 of file ram.cpp.

◆ read32_cpu()

uint32_t RAM::read32_cpu ( uint32_t offset)

Reads a 32-bit word from the RAM.

Parameters
offsetOffset to read from
Returns
uint32_t Data read
Exceptions
std::runtime_errorIf the offset is unaligned
std::runtime_errorIf the offset is out of bounds

Definition at line 27 of file ram.cpp.

◆ read8_cpu()

uint8_t RAM::read8_cpu ( uint32_t offset)

Reads a byte from the RAM.

Parameters
offsetOffset to read from
Returns
uint16_t Data read
Exceptions
std::runtime_errorIf the offset is out of bounds

Definition at line 78 of file ram.cpp.

◆ write16_cpu()

void RAM::write16_cpu ( uint32_t offset,
uint16_t data )

Writes a 16-bit word to the RAM.

Parameters
offsetOffset to write to
dataData to write
Exceptions
std::runtime_errorIf the offset is unaligned
std::runtime_errorIf the offset is out of bounds

Definition at line 143 of file ram.cpp.

◆ write32_cpu()

void RAM::write32_cpu ( uint32_t offset,
uint32_t data )

Writes a 32-bit word to the RAM.

Parameters
offsetOffset to write to
dataData to write
Exceptions
std::runtime_errorIf the offset is unaligned
std::runtime_errorIf the offset is out of bounds

Definition at line 53 of file ram.cpp.

◆ write8_cpu()

void RAM::write8_cpu ( uint32_t offset,
uint8_t data )

Writes a byte to the RAM.

Parameters
offsetOffset to write to
dataData to write
Exceptions
std::runtime_errorIf the offset is out of bounds

Definition at line 97 of file ram.cpp.

Member Data Documentation

◆ data

std::vector<uint8_t> RAM::data
private

Data of the RAM.

Definition at line 28 of file ram.hpp.


The documentation for this class was generated from the following files: