|
WolPSX
|
Class to implement the Bus. More...
#include <bus.hpp>
Public Member Functions | |
| Bus (std::string bios_path) | |
| Construct a new Bus:: Bus object. | |
| uint32_t | read32_cpu (uint32_t addr) |
| Reads a 32-bit word from the given address. | |
| void | write32_cpu (uint32_t addr, uint32_t data) |
| Writes a 32-bit word to the given address. | |
| uint16_t | read16_cpu (uint32_t addr) |
| Reads a 16-bit word from the given address. | |
| void | write16_cpu (uint32_t addr, uint16_t data) |
| Writes a 16-bit word to the given address. | |
| uint8_t | read8_cpu (uint32_t addr) |
| Reads a 8-bit word from the given address. | |
| void | write8_cpu (uint32_t addr, uint8_t data) |
| Writes a 8-bit word to the given address. | |
| void | clock () |
| Clocks the PSX. | |
Private Member Functions | |
| uint32_t | region_mask (uint32_t addr) |
| Returns the region mask for a given address. | |
Private Attributes | |
| CPU * | cpu |
| Pointer to the CPU object. | |
| BIOS * | bios |
| Pointer to the BIOS object. | |
| RAM * | ram |
| Pointer to the RAM object. | |
| Range | bios_range = Range(BIOS_RANGE) |
| Range of the BIOS. | |
| Range | mem_ctrl_range = Range(MEM_CTRL_RANGE) |
| Range of the Memory Control Registers. | |
| Range | ram_size_range = Range(RAM_SIZE_RANGE) |
| Range of the RAM Size Register. | |
| Range | cache_ctrl_range = Range(CACHE_CTRL_RANGE) |
| Range of the Cache Control Register. | |
| Range | ram_range = Range(RAM_RANGE) |
| Range of the RAM. | |
| Range | spu_range = Range(SPU_RANGE) |
| Range of the SPU (Sound Processing Unit) Registers. | |
| Range | expansion2_range = Range(EXPANSION2_RANGE) |
| Range of the Expansion 2. | |
| Range | expansion1_range = Range(EXPANSION1_RANGE) |
| Range of the Expansion 1. | |
| Range | interrupt_range = Range(INTERRUPT_RANGE) |
| Range of the Interrupt Registers. | |
| Range | timer_range = Range(TIMER_RANGE) |
| Range of the Timer Registers. | |
Class to implement the Bus.
Implements the Bus of the PSX. This is the central class that glues all the other components together. All communication between components (classes) is done through this class.
| Bus::Bus | ( | std::string | bios_path | ) |
Construct a new Bus:: Bus object.
| bios_path | Path to the BIOS file |
References: CPU::CPU BIOS::BIOS RAM::RAM CPU::connectBus
| void Bus::clock | ( | ) |
Clocks the PSX.
Clocks all the components of the PSX and serves as a synchronization point between the components.
Definition at line 47 of file bus_utils.cpp.
| uint16_t Bus::read16_cpu | ( | uint32_t | addr | ) |
Reads a 16-bit word from the given address.
TODO: Map all addresses.
| addr | Address to read from |
| std::runtime_error | If the address is unaligned |
| std::runtime_error | If the address is unmapped |
References: Range::contains Range::offset region_mask
| uint32_t Bus::read32_cpu | ( | uint32_t | addr | ) |
Reads a 32-bit word from the given address.
TODO: Map all addresses.
| addr | Address to read from |
| std::runtime_error | If the address is unaligned |
| std::runtime_error | If the address is unmapped |
References: BIOS::read32_cpu RAM::read32_cpu Range::contains Range::offset region_mask
| uint8_t Bus::read8_cpu | ( | uint32_t | addr | ) |
Reads a 8-bit word from the given address.
TODO: Implement Expansion Region 1. TODO: Map all addresses.
| addr | Address to read from |
| std::runtime_error | If the address is unmapped |
References: BIOS::read32_cpu RAM::read8_cpu Range::contains Range::offset region_mask
|
private |
Returns the region mask for a given address.
The regions are:
| addr | Address to get the region mask for |
Definition at line 15 of file bus_utils.cpp.
| void Bus::write16_cpu | ( | uint32_t | addr, |
| uint16_t | data ) |
Writes a 16-bit word to the given address.
TODO: Map all addresses.
| addr | Address to write to |
| data | Data to write to the address |
| std::runtime_error | If the address is unaligned |
| std::runtime_error | If the address is unmapped |
References: Range::contains Range::offset region_mask
| void Bus::write32_cpu | ( | uint32_t | addr, |
| uint32_t | data ) |
Writes a 32-bit word to the given address.
TODO: Map all addresses.
| addr | Address to write to |
| data | Data to write to the address |
| std::runtime_error | If the address is unaligned |
| std::runtime_error | If the address is unmapped |
| std::runtime_error | If the data written to any of the MEM_CTRL registers is invalid |
References: RAM::write32_cpu Range::contains Range::offset region_mask
| void Bus::write8_cpu | ( | uint32_t | addr, |
| uint8_t | data ) |
Writes a 8-bit word to the given address.
TODO: Implement Expansion Region 2. TODO: Map all addresses.
| addr | Address to write to |
| data | Data to write to the address |
| std::runtime_error | If the address is unmapped |
References: RAM::write8_cpu Range::contains Range::offset region_mask