Emulator: Add register sharing to processing units

This commit is contained in:
Riyyi
2022-08-19 02:56:46 +02:00
parent 68f78a0299
commit 0e67e7e2cc
6 changed files with 36 additions and 10 deletions
+10 -1
View File
@@ -3,13 +3,17 @@
#include "cpu.h"
#include "emu.h"
#include "ppu.h"
#include "ruc/format/print.h"
#include "ruc/timer.h"
int main(int argc, char* argv[])
{
(void)argc;
(void)argv;
ruc::Timer t;
printf("%fms\n", t.elapsedNanoseconds() / 1000000.0);
print("{}ms\n", t.elapsedNanoseconds() / 1000000.0);
Emu::the().init(8000000);
@@ -24,6 +28,11 @@ int main(int argc, char* argv[])
Emu::the().addMemorySpace("ROM", 1024);
Emu::the().addMemorySpace("CARDROM", 1024);
// Get shared register
Emu::the().processingUnit("cpu")->update();
print("{}\n", *Emu::the().processingUnit("cpu")->sharedRegister("a"));
print("{}\n", *Emu::the().processingUnit("cpu")->sharedRegister("bc"));
while (true) {
Emu::the().update();
}