yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::app::emu::memory::MemoryImpl Class Reference

Implementation of the Memory interface for emulating memory in a SNES system. More...

#include <memory.h>

Inheritance diagram for yaze::app::emu::memory::MemoryImpl:
Collaboration diagram for yaze::app::emu::memory::MemoryImpl:

Public Member Functions

void Initialize (const std::vector< uint8_t > &romData, bool verbose=false)
 
uint16_t GetHeaderOffset ()
 
uint8_t cart_read (uint8_t bank, uint16_t adr)
 
void cart_write (uint8_t bank, uint16_t adr, uint8_t val)
 
uint8_t cart_readLorom (uint8_t bank, uint16_t adr)
 
void cart_writeLorom (uint8_t bank, uint16_t adr, uint8_t val)
 
uint8_t cart_readHirom (uint8_t bank, uint16_t adr)
 
uint8_t cart_readExHirom (uint8_t bank, uint16_t adr)
 
void cart_writeHirom (uint8_t bank, uint16_t adr, uint8_t val)
 
uint8_t ReadByte (uint32_t address) const override
 
uint16_t ReadWord (uint32_t address) const override
 
uint32_t ReadWordLong (uint32_t address) const override
 
std::vector< uint8_t > ReadByteVector (uint32_t address, uint16_t length) const override
 
void WriteByte (uint32_t address, uint8_t value) override
 
void WriteWord (uint32_t address, uint16_t value) override
 
void WriteLong (uint32_t address, uint32_t value) override
 
void PushByte (uint8_t value) override
 
uint8_t PopByte () override
 
void PushWord (uint16_t value) override
 
uint16_t PopWord () override
 
void PushLong (uint32_t value) override
 
uint32_t PopLong () override
 
uint16_t SP () const override
 
auto mutable_sp () -> uint16_t &
 
void SetSP (uint16_t value) override
 
void ClearMemory () override
 
uint8_t at (int i) const override
 
uint8_t operator[] (int i) const override
 
auto size () const
 
auto begin () const
 
auto end () const
 
auto data () const
 
void set_open_bus (uint8_t value) override
 
auto open_bus () const -> uint8_t override
 
auto hdma_init_requested () const -> bool override
 
auto hdma_run_requested () const -> bool override
 
void init_hdma_request () override
 
void run_hdma_request () override
 
void set_hdma_run_requested (bool value) override
 
void set_hdma_init_requested (bool value) override
 
void set_pal_timing (bool value) override
 
void set_h_pos (uint16_t value) override
 
void set_v_pos (uint16_t value) override
 
auto h_pos () const -> uint16_t override
 
auto v_pos () const -> uint16_t override
 
auto pal_timing () const -> bool override
 
auto dma_state () -> uint8_t &
 
void set_dma_state (uint8_t value)
 
auto dma_channels () -> DmaChannel *
 
- Public Member Functions inherited from yaze::app::emu::memory::Memory
virtual ~Memory ()=default
 

Public Attributes

std::vector< uint8_t > rom_
 
std::vector< uint8_t > ram_
 

Private Member Functions

uint32_t GetMappedAddress (uint32_t address) const
 

Private Attributes

bool verbose_ = false
 
bool hdma_run_requested_ = false
 
bool hdma_init_requested_ = false
 
bool pal_timing_ = false
 
uint32_t rom_size_
 
uint32_t sram_size_
 
uint16_t h_pos_ = 0
 
uint16_t v_pos_ = 0
 
uint8_t dma_state_ = 0
 
uint8_t open_bus_ = 0
 
uint16_t SP_ = 0
 
uint8_t type_ = 1
 
DmaChannel channel [8]
 
std::vector< uint8_t > memory_
 

Detailed Description

Implementation of the Memory interface for emulating memory in a SNES system.

Definition at line 102 of file memory.h.

Member Function Documentation

◆ Initialize()

void yaze::app::emu::memory::MemoryImpl::Initialize ( const std::vector< uint8_t > & romData,
bool verbose = false )

◆ GetHeaderOffset()

uint16_t yaze::app::emu::memory::MemoryImpl::GetHeaderOffset ( )
inline

Definition at line 106 of file memory.h.

◆ cart_read()

uint8_t yaze::app::emu::memory::MemoryImpl::cart_read ( uint8_t bank,
uint16_t adr )

Definition at line 54 of file memory.cc.

References cart_readExHirom(), cart_readHirom(), cart_readLorom(), open_bus_, and type_.

Referenced by yaze::app::emu::SNES::Rread().

Here is the call graph for this function:

◆ cart_write()

void yaze::app::emu::memory::MemoryImpl::cart_write ( uint8_t bank,
uint16_t adr,
uint8_t val )

Definition at line 68 of file memory.cc.

References cart_writeHirom(), cart_writeLorom(), and type_.

Referenced by yaze::app::emu::SNES::Write().

Here is the call graph for this function:

◆ cart_readLorom()

uint8_t yaze::app::emu::memory::MemoryImpl::cart_readLorom ( uint8_t bank,
uint16_t adr )

Definition at line 84 of file memory.cc.

References open_bus_, ram_, rom_, rom_size_, and sram_size_.

Referenced by cart_read().

◆ cart_writeLorom()

void yaze::app::emu::memory::MemoryImpl::cart_writeLorom ( uint8_t bank,
uint16_t adr,
uint8_t val )

Definition at line 98 of file memory.cc.

References ram_, and sram_size_.

Referenced by cart_write().

◆ cart_readHirom()

uint8_t yaze::app::emu::memory::MemoryImpl::cart_readHirom ( uint8_t bank,
uint16_t adr )

Definition at line 106 of file memory.cc.

References open_bus_, ram_, rom_, rom_size_, and sram_size_.

Referenced by cart_read().

◆ cart_readExHirom()

uint8_t yaze::app::emu::memory::MemoryImpl::cart_readExHirom ( uint8_t bank,
uint16_t adr )

Definition at line 119 of file memory.cc.

References open_bus_, ram_, rom_, rom_size_, and sram_size_.

Referenced by cart_read().

◆ cart_writeHirom()

void yaze::app::emu::memory::MemoryImpl::cart_writeHirom ( uint8_t bank,
uint16_t adr,
uint8_t val )

Definition at line 134 of file memory.cc.

References ram_, and sram_size_.

Referenced by cart_write().

◆ ReadByte()

uint8_t yaze::app::emu::memory::MemoryImpl::ReadByte ( uint32_t address) const
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 138 of file memory.h.

◆ ReadWord()

uint16_t yaze::app::emu::memory::MemoryImpl::ReadWord ( uint32_t address) const
inlineoverridevirtual

◆ ReadWordLong()

uint32_t yaze::app::emu::memory::MemoryImpl::ReadWordLong ( uint32_t address) const
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 147 of file memory.h.

◆ ReadByteVector()

std::vector< uint8_t > yaze::app::emu::memory::MemoryImpl::ReadByteVector ( uint32_t address,
uint16_t length ) const
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 153 of file memory.h.

◆ WriteByte()

void yaze::app::emu::memory::MemoryImpl::WriteByte ( uint32_t address,
uint8_t value )
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 160 of file memory.h.

◆ WriteWord()

void yaze::app::emu::memory::MemoryImpl::WriteWord ( uint32_t address,
uint16_t value )
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 164 of file memory.h.

◆ WriteLong()

void yaze::app::emu::memory::MemoryImpl::WriteLong ( uint32_t address,
uint32_t value )
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 169 of file memory.h.

◆ PushByte()

void yaze::app::emu::memory::MemoryImpl::PushByte ( uint8_t value)
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 177 of file memory.h.

◆ PopByte()

uint8_t yaze::app::emu::memory::MemoryImpl::PopByte ( )
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 187 of file memory.h.

◆ PushWord()

void yaze::app::emu::memory::MemoryImpl::PushWord ( uint16_t value)
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 197 of file memory.h.

References yaze::app::emu::memory::Memory::PushByte().

Here is the call graph for this function:

◆ PopWord()

uint16_t yaze::app::emu::memory::MemoryImpl::PopWord ( )
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 202 of file memory.h.

References yaze::app::emu::memory::Memory::PopByte().

Here is the call graph for this function:

◆ PushLong()

void yaze::app::emu::memory::MemoryImpl::PushLong ( uint32_t value)
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 208 of file memory.h.

References yaze::app::emu::memory::Memory::PushByte().

Here is the call graph for this function:

◆ PopLong()

uint32_t yaze::app::emu::memory::MemoryImpl::PopLong ( )
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 214 of file memory.h.

References yaze::app::emu::memory::Memory::PopByte().

Here is the call graph for this function:

◆ SP()

uint16_t yaze::app::emu::memory::MemoryImpl::SP ( ) const
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 223 of file memory.h.

◆ mutable_sp()

auto yaze::app::emu::memory::MemoryImpl::mutable_sp ( ) -> uint16_t&
inline

Definition at line 224 of file memory.h.

◆ SetSP()

void yaze::app::emu::memory::MemoryImpl::SetSP ( uint16_t value)
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 225 of file memory.h.

◆ ClearMemory()

void yaze::app::emu::memory::MemoryImpl::ClearMemory ( )
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 226 of file memory.h.

◆ at()

uint8_t yaze::app::emu::memory::MemoryImpl::at ( int i) const
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 228 of file memory.h.

◆ operator[]()

uint8_t yaze::app::emu::memory::MemoryImpl::operator[] ( int i) const
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 229 of file memory.h.

◆ size()

auto yaze::app::emu::memory::MemoryImpl::size ( ) const
inline

Definition at line 237 of file memory.h.

◆ begin()

auto yaze::app::emu::memory::MemoryImpl::begin ( ) const
inline

Definition at line 238 of file memory.h.

◆ end()

auto yaze::app::emu::memory::MemoryImpl::end ( ) const
inline

Definition at line 239 of file memory.h.

◆ data()

auto yaze::app::emu::memory::MemoryImpl::data ( ) const
inline

Definition at line 240 of file memory.h.

◆ set_open_bus()

void yaze::app::emu::memory::MemoryImpl::set_open_bus ( uint8_t value)
inlineoverridevirtual

◆ open_bus()

auto yaze::app::emu::memory::MemoryImpl::open_bus ( ) const -> uint8_t
inlineoverridevirtual

◆ hdma_init_requested()

auto yaze::app::emu::memory::MemoryImpl::hdma_init_requested ( ) const -> bool
inlineoverridevirtual

◆ hdma_run_requested()

auto yaze::app::emu::memory::MemoryImpl::hdma_run_requested ( ) const -> bool
inlineoverridevirtual

◆ init_hdma_request()

void yaze::app::emu::memory::MemoryImpl::init_hdma_request ( )
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 249 of file memory.h.

Referenced by yaze::app::emu::SNES::RunCycle().

◆ run_hdma_request()

void yaze::app::emu::memory::MemoryImpl::run_hdma_request ( )
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 250 of file memory.h.

Referenced by yaze::app::emu::SNES::RunCycle().

◆ set_hdma_run_requested()

void yaze::app::emu::memory::MemoryImpl::set_hdma_run_requested ( bool value)
inlineoverridevirtual

◆ set_hdma_init_requested()

void yaze::app::emu::memory::MemoryImpl::set_hdma_init_requested ( bool value)
inlineoverridevirtual

◆ set_pal_timing()

void yaze::app::emu::memory::MemoryImpl::set_pal_timing ( bool value)
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 257 of file memory.h.

◆ set_h_pos()

void yaze::app::emu::memory::MemoryImpl::set_h_pos ( uint16_t value)
inlineoverridevirtual

◆ set_v_pos()

void yaze::app::emu::memory::MemoryImpl::set_v_pos ( uint16_t value)
inlineoverridevirtual

◆ h_pos()

auto yaze::app::emu::memory::MemoryImpl::h_pos ( ) const -> uint16_t
inlineoverridevirtual

◆ v_pos()

auto yaze::app::emu::memory::MemoryImpl::v_pos ( ) const -> uint16_t
inlineoverridevirtual

Implements yaze::app::emu::memory::Memory.

Definition at line 261 of file memory.h.

Referenced by yaze::app::emu::SNES::RunCycle().

◆ pal_timing()

auto yaze::app::emu::memory::MemoryImpl::pal_timing ( ) const -> bool
inlineoverridevirtual

◆ dma_state()

auto yaze::app::emu::memory::MemoryImpl::dma_state ( ) -> uint8_t&
inline

Definition at line 264 of file memory.h.

Referenced by yaze::app::emu::memory::dma::HandleDma().

◆ set_dma_state()

void yaze::app::emu::memory::MemoryImpl::set_dma_state ( uint8_t value)
inline

◆ dma_channels()

◆ GetMappedAddress()

uint32_t yaze::app::emu::memory::MemoryImpl::GetMappedAddress ( uint32_t address) const
private

Definition at line 142 of file memory.cc.

Member Data Documentation

◆ rom_

std::vector<uint8_t> yaze::app::emu::memory::MemoryImpl::rom_

Definition at line 269 of file memory.h.

Referenced by cart_readExHirom(), cart_readHirom(), cart_readLorom(), and Initialize().

◆ ram_

std::vector<uint8_t> yaze::app::emu::memory::MemoryImpl::ram_

◆ verbose_

bool yaze::app::emu::memory::MemoryImpl::verbose_ = false
private

Definition at line 275 of file memory.h.

Referenced by Initialize().

◆ hdma_run_requested_

bool yaze::app::emu::memory::MemoryImpl::hdma_run_requested_ = false
private

Definition at line 278 of file memory.h.

◆ hdma_init_requested_

bool yaze::app::emu::memory::MemoryImpl::hdma_init_requested_ = false
private

Definition at line 279 of file memory.h.

◆ pal_timing_

bool yaze::app::emu::memory::MemoryImpl::pal_timing_ = false
private

Definition at line 281 of file memory.h.

◆ rom_size_

uint32_t yaze::app::emu::memory::MemoryImpl::rom_size_
private

Definition at line 284 of file memory.h.

Referenced by cart_readExHirom(), cart_readHirom(), cart_readLorom(), and Initialize().

◆ sram_size_

uint32_t yaze::app::emu::memory::MemoryImpl::sram_size_
private

◆ h_pos_

uint16_t yaze::app::emu::memory::MemoryImpl::h_pos_ = 0
private

Definition at line 288 of file memory.h.

◆ v_pos_

uint16_t yaze::app::emu::memory::MemoryImpl::v_pos_ = 0
private

Definition at line 289 of file memory.h.

◆ dma_state_

uint8_t yaze::app::emu::memory::MemoryImpl::dma_state_ = 0
private

Definition at line 292 of file memory.h.

◆ open_bus_

uint8_t yaze::app::emu::memory::MemoryImpl::open_bus_ = 0
private

Definition at line 295 of file memory.h.

Referenced by cart_read(), cart_readExHirom(), cart_readHirom(), and cart_readLorom().

◆ SP_

uint16_t yaze::app::emu::memory::MemoryImpl::SP_ = 0
private

Definition at line 298 of file memory.h.

◆ type_

uint8_t yaze::app::emu::memory::MemoryImpl::type_ = 1
private

Definition at line 301 of file memory.h.

Referenced by cart_read(), cart_write(), and Initialize().

◆ channel

DmaChannel yaze::app::emu::memory::MemoryImpl::channel[8]
private

Definition at line 304 of file memory.h.

◆ memory_

std::vector<uint8_t> yaze::app::emu::memory::MemoryImpl::memory_
private

Definition at line 307 of file memory.h.

Referenced by Initialize().


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