Skip to content
Snippets Groups Projects
  • Geo Ster's avatar
    327c71d0
    Ignore unrecognized reads/writes · 327c71d0
    Geo Ster authored
    * Currently the BIOS only writes to scratchpad and some very few mysterious
    addresses that don't seem to do anything. However it is important to know
    when it will try to write to DMAC for example so we can implement it. So
    instead of writing anything and uncontrollably into a single large buffer
    let's make an if-else with all the known addresses and how to handle them.
    When the BIOS tries to write somewhere new we will be notified immediately.
    
    * Also rework the disassembly logger to use C FILE* since these are faster
    then std::ofstream. Normally I wouldn't care about this but in our usecase
    which is very performance sensitive, it makes a noticeable difference.
    327c71d0
    History
    Ignore unrecognized reads/writes
    Geo Ster authored
    * Currently the BIOS only writes to scratchpad and some very few mysterious
    addresses that don't seem to do anything. However it is important to know
    when it will try to write to DMAC for example so we can implement it. So
    instead of writing anything and uncontrollably into a single large buffer
    let's make an if-else with all the known addresses and how to handle them.
    When the BIOS tries to write somewhere new we will be notified immediately.
    
    * Also rework the disassembly logger to use C FILE* since these are faster
    then std::ofstream. Normally I wouldn't care about this but in our usecase
    which is very performance sensitive, it makes a noticeable difference.
manager.hpp 607 B
#pragma once
#include <memory>
#include <vector>
#include <cpu/ee.hpp>

/* This class act as the "motherboard" of sorts */
class ComponentManager {
public:
    ComponentManager();
    ~ComponentManager();

    void tick();

    /* Memory operations */
    template <typename T>
    T read(uint32_t addr);

    template <typename T>
    void write(uint32_t addr, T data);

protected:
    void read_bios();

public:
    /* Components */
    std::unique_ptr<EmotionEngine> ee;
    
    /* Memory - Registers */
    uint8_t* ram, * bios;

    uint32_t MCH_RICM = 0, MCH_DRD = 0;
    uint8_t rdram_sdevid = 0;
};