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

A mock implementation of the Memory class. More...

#include <mock_memory.h>

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

Public Member Functions

 MOCK_CONST_METHOD1 (ReadByte, uint8_t(uint32_t address))
 
 MOCK_CONST_METHOD1 (ReadWord, uint16_t(uint32_t address))
 
 MOCK_CONST_METHOD1 (ReadWordLong, uint32_t(uint32_t address))
 
 MOCK_METHOD (std::vector< uint8_t >, ReadByteVector,(uint32_t address, uint16_t length),(const, override))
 
 MOCK_METHOD2 (WriteByte, void(uint32_t address, uint8_t value))
 
 MOCK_METHOD2 (WriteWord, void(uint32_t address, uint16_t value))
 
 MOCK_METHOD2 (WriteLong, void(uint32_t address, uint32_t value))
 
 MOCK_METHOD1 (PushByte, void(uint8_t value))
 
 MOCK_METHOD0 (PopByte, uint8_t())
 
 MOCK_METHOD1 (PushWord, void(uint16_t value))
 
 MOCK_METHOD0 (PopWord, uint16_t())
 
 MOCK_METHOD1 (PushLong, void(uint32_t value))
 
 MOCK_METHOD0 (PopLong, uint32_t())
 
 MOCK_CONST_METHOD0 (SP, uint16_t())
 
 MOCK_METHOD1 (SetSP, void(uint16_t value))
 
 MOCK_METHOD1 (SetMemory, void(const std::vector< uint8_t > &data))
 
 MOCK_METHOD1 (LoadData, void(const std::vector< uint8_t > &data))
 
 MOCK_METHOD0 (ClearMemory, void())
 
 MOCK_CONST_METHOD1 (at, uint8_t(int i))
 
uint8_t operator[] (int i) const override
 
 MOCK_METHOD0 (init_hdma_request, void())
 
 MOCK_METHOD0 (run_hdma_request, void())
 
 MOCK_METHOD1 (set_hdma_run_requested, void(bool value))
 
 MOCK_METHOD1 (set_hdma_init_requested, void(bool value))
 
 MOCK_CONST_METHOD0 (hdma_init_requested, bool())
 
 MOCK_CONST_METHOD0 (hdma_run_requested, bool())
 
 MOCK_METHOD1 (set_pal_timing, void(bool value))
 
 MOCK_CONST_METHOD0 (pal_timing, bool())
 
 MOCK_CONST_METHOD0 (h_pos, uint16_t())
 
 MOCK_CONST_METHOD0 (v_pos, uint16_t())
 
 MOCK_METHOD1 (set_h_pos, void(uint16_t value))
 
 MOCK_METHOD1 (set_v_pos, void(uint16_t value))
 
 MOCK_METHOD1 (set_open_bus, void(uint8_t value))
 
 MOCK_CONST_METHOD0 (open_bus, uint8_t())
 
void SetMemoryContents (const std::vector< uint8_t > &data)
 
void SetMemoryContents (const std::vector< uint16_t > &data)
 
void InsertMemory (const uint64_t address, const std::vector< uint8_t > &data)
 
void Initialize (const std::vector< uint8_t > &romData)
 
void Init ()
 
- Public Member Functions inherited from yaze::app::emu::memory::Memory
virtual ~Memory ()=default
 
virtual uint8_t ReadByte (uint32_t address) const =0
 
virtual uint16_t ReadWord (uint32_t address) const =0
 
virtual uint32_t ReadWordLong (uint32_t address) const =0
 
virtual std::vector< uint8_t > ReadByteVector (uint32_t address, uint16_t length) const =0
 
virtual void WriteByte (uint32_t address, uint8_t value)=0
 
virtual void WriteWord (uint32_t address, uint16_t value)=0
 
virtual void WriteLong (uint32_t address, uint32_t value)=0
 
virtual void PushByte (uint8_t value)=0
 
virtual uint8_t PopByte ()=0
 
virtual void PushWord (uint16_t value)=0
 
virtual uint16_t PopWord ()=0
 
virtual void PushLong (uint32_t value)=0
 
virtual uint32_t PopLong ()=0
 
virtual uint16_t SP () const =0
 
virtual void SetSP (uint16_t value)=0
 
virtual void ClearMemory ()=0
 
virtual uint8_t at (int i) const =0
 
virtual uint8_t open_bus () const =0
 
virtual void set_open_bus (uint8_t value)=0
 
virtual bool hdma_init_requested () const =0
 
virtual bool hdma_run_requested () const =0
 
virtual void init_hdma_request ()=0
 
virtual void run_hdma_request ()=0
 
virtual void set_hdma_run_requested (bool value)=0
 
virtual void set_hdma_init_requested (bool value)=0
 
virtual void set_pal_timing (bool value)=0
 
virtual void set_h_pos (uint16_t value)=0
 
virtual void set_v_pos (uint16_t value)=0
 
virtual auto h_pos () const -> uint16_t=0
 
virtual auto v_pos () const -> uint16_t=0
 
virtual auto pal_timing () const -> bool=0
 

Public Attributes

std::vector< uint8_t > memory_
 
uint16_t SP_ = 0x01FF
 

Detailed Description

A mock implementation of the Memory class.

This class is used for testing purposes and provides a mock implementation of the Memory class. It allows for reading and writing bytes, words, and longs to memory, as well as pushing and popping values onto and from the stack. It also provides methods for setting and getting the stack pointer, initializing memory with ROM data, and clearing memory.

The mock memory is represented by a vector of uint8_t values, where each element represents a byte of memory. The memory can be accessed using the [] operator, and its contents can be set using the SetMemoryContents() method.

Note
This class is intended for testing purposes only and should not be used in production code.

Definition at line 45 of file mock_memory.h.

Member Function Documentation

◆ MOCK_CONST_METHOD1() [1/4]

yaze::app::emu::memory::MockMemory::MOCK_CONST_METHOD1 ( ReadByte ,
uint8_t(uint32_t address)  )

◆ MOCK_CONST_METHOD1() [2/4]

yaze::app::emu::memory::MockMemory::MOCK_CONST_METHOD1 ( ReadWord ,
uint16_t(uint32_t address)  )

◆ MOCK_CONST_METHOD1() [3/4]

yaze::app::emu::memory::MockMemory::MOCK_CONST_METHOD1 ( ReadWordLong ,
uint32_t(uint32_t address)  )

◆ MOCK_METHOD()

yaze::app::emu::memory::MockMemory::MOCK_METHOD ( std::vector< uint8_t > ,
ReadByteVector ,
(uint32_t address, uint16_t length) ,
(const, override)  )

◆ MOCK_METHOD2() [1/3]

yaze::app::emu::memory::MockMemory::MOCK_METHOD2 ( WriteByte ,
void(uint32_t address, uint8_t value)  )

◆ MOCK_METHOD2() [2/3]

yaze::app::emu::memory::MockMemory::MOCK_METHOD2 ( WriteWord ,
void(uint32_t address, uint16_t value)  )

◆ MOCK_METHOD2() [3/3]

yaze::app::emu::memory::MockMemory::MOCK_METHOD2 ( WriteLong ,
void(uint32_t address, uint32_t value)  )

◆ MOCK_METHOD1() [1/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( PushByte ,
void(uint8_t value)  )

◆ MOCK_METHOD0() [1/6]

yaze::app::emu::memory::MockMemory::MOCK_METHOD0 ( PopByte ,
uint8_t()  )

◆ MOCK_METHOD1() [2/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( PushWord ,
void(uint16_t value)  )

◆ MOCK_METHOD0() [2/6]

yaze::app::emu::memory::MockMemory::MOCK_METHOD0 ( PopWord ,
uint16_t()  )

◆ MOCK_METHOD1() [3/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( PushLong ,
void(uint32_t value)  )

◆ MOCK_METHOD0() [3/6]

yaze::app::emu::memory::MockMemory::MOCK_METHOD0 ( PopLong ,
uint32_t()  )

◆ MOCK_CONST_METHOD0() [1/7]

yaze::app::emu::memory::MockMemory::MOCK_CONST_METHOD0 ( SP ,
uint16_t()  )

◆ MOCK_METHOD1() [4/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( SetSP ,
void(uint16_t value)  )

◆ MOCK_METHOD1() [5/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( SetMemory ,
void(const std::vector< uint8_t > &data)  )

◆ MOCK_METHOD1() [6/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( LoadData ,
void(const std::vector< uint8_t > &data)  )

◆ MOCK_METHOD0() [4/6]

yaze::app::emu::memory::MockMemory::MOCK_METHOD0 ( ClearMemory ,
void()  )

◆ MOCK_CONST_METHOD1() [4/4]

yaze::app::emu::memory::MockMemory::MOCK_CONST_METHOD1 ( at ,
uint8_t(int i)  )

◆ operator[]()

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

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

Definition at line 73 of file mock_memory.h.

References memory_.

◆ MOCK_METHOD0() [5/6]

yaze::app::emu::memory::MockMemory::MOCK_METHOD0 ( init_hdma_request ,
void()  )

◆ MOCK_METHOD0() [6/6]

yaze::app::emu::memory::MockMemory::MOCK_METHOD0 ( run_hdma_request ,
void()  )

◆ MOCK_METHOD1() [7/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( set_hdma_run_requested ,
void(bool value)  )

◆ MOCK_METHOD1() [8/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( set_hdma_init_requested ,
void(bool value)  )

◆ MOCK_CONST_METHOD0() [2/7]

yaze::app::emu::memory::MockMemory::MOCK_CONST_METHOD0 ( hdma_init_requested ,
bool()  )

◆ MOCK_CONST_METHOD0() [3/7]

yaze::app::emu::memory::MockMemory::MOCK_CONST_METHOD0 ( hdma_run_requested ,
bool()  )

◆ MOCK_METHOD1() [9/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( set_pal_timing ,
void(bool value)  )

◆ MOCK_CONST_METHOD0() [4/7]

yaze::app::emu::memory::MockMemory::MOCK_CONST_METHOD0 ( pal_timing ,
bool()  )

◆ MOCK_CONST_METHOD0() [5/7]

yaze::app::emu::memory::MockMemory::MOCK_CONST_METHOD0 ( h_pos ,
uint16_t()  )

◆ MOCK_CONST_METHOD0() [6/7]

yaze::app::emu::memory::MockMemory::MOCK_CONST_METHOD0 ( v_pos ,
uint16_t()  )

◆ MOCK_METHOD1() [10/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( set_h_pos ,
void(uint16_t value)  )

◆ MOCK_METHOD1() [11/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( set_v_pos ,
void(uint16_t value)  )

◆ MOCK_METHOD1() [12/12]

yaze::app::emu::memory::MockMemory::MOCK_METHOD1 ( set_open_bus ,
void(uint8_t value)  )

◆ MOCK_CONST_METHOD0() [7/7]

yaze::app::emu::memory::MockMemory::MOCK_CONST_METHOD0 ( open_bus ,
uint8_t()  )

◆ SetMemoryContents() [1/2]

void yaze::app::emu::memory::MockMemory::SetMemoryContents ( const std::vector< uint8_t > & data)
inline

Definition at line 90 of file mock_memory.h.

References memory_.

Referenced by yaze::test::emu::TEST_F().

◆ SetMemoryContents() [2/2]

void yaze::app::emu::memory::MockMemory::SetMemoryContents ( const std::vector< uint16_t > & data)
inline

Definition at line 97 of file mock_memory.h.

References memory_.

◆ InsertMemory()

void yaze::app::emu::memory::MockMemory::InsertMemory ( const uint64_t address,
const std::vector< uint8_t > & data )
inline

Definition at line 109 of file mock_memory.h.

References memory_.

◆ Initialize()

void yaze::app::emu::memory::MockMemory::Initialize ( const std::vector< uint8_t > & romData)
inline

Definition at line 123 of file mock_memory.h.

References memory_.

◆ Init()

Member Data Documentation

◆ memory_

std::vector<uint8_t> yaze::app::emu::memory::MockMemory::memory_

◆ SP_

uint16_t yaze::app::emu::memory::MockMemory::SP_ = 0x01FF

Definition at line 221 of file mock_memory.h.

Referenced by Init().


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