bus: send a weak ptr to io

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2024-06-14 20:25:36 +05:30
parent d1df555a6a
commit bafd534671
8 changed files with 121 additions and 94 deletions

View File

@@ -87,12 +87,14 @@ main(int argc, const char* argv[]) {
matar::set_log_level(matar::LogLevel::Debug);
try {
std::shared_ptr<matar::Bus> bus(
new matar::Bus(std::move(bios), std::move(rom)));
std::shared_ptr<matar::Bus> bus =
matar::Bus::init(std::move(bios), std::move(rom));
matar::Cpu cpu(bus);
while (true) {
cpu.step();
std::this_thread::sleep_for(std::chrono::seconds(1));
// std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
} catch (const std::exception& e) {
std::cerr << "Exception: " << e.what() << std::endl;