diff --git a/src/emu.cpp b/src/emu.cpp index 7214a5d..fed9ff3 100644 --- a/src/emu.cpp +++ b/src/emu.cpp @@ -1,13 +1,16 @@ #include // uint32_t +#include #include "cpu.h" #include "emu.h" +#include "ruc/file.h" #include "ruc/format/print.h" -void Emu::init(uint32_t frequency) +void Emu::init(uint32_t frequency, std::string_view bootrom) { m_frequency = frequency; m_timestep = 1.0 / m_frequency * 1000000; + m_bootrom = ruc::File(bootrom.data()).data(); } void Emu::update() diff --git a/src/emu.h b/src/emu.h index dd7556d..9d0ccfe 100644 --- a/src/emu.h +++ b/src/emu.h @@ -1,6 +1,7 @@ #pragma once #include // uint32_t +#include #include #include @@ -12,7 +13,7 @@ class Emu final : public ruc::Singleton { public: Emu(s) {} - void init(uint32_t frequency); + void init(uint32_t frequency, std::string_view bootrom); void update(); @@ -37,4 +38,6 @@ private: std::unordered_map m_processing_units; std::unordered_map> m_memory_spaces; + + std::string_view m_bootrom; }; diff --git a/src/main.cpp b/src/main.cpp index b494b76..08c2c7c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,7 +15,7 @@ int main(int argc, char* argv[]) print("{}ms\n", t.elapsedNanoseconds() / 1000000.0); - Emu::the().init(8000000); + Emu::the().init(8000000, "gbc_bios.bin"); CPU cpu(8000000); PPU ppu(4000000);