From bb1aa5958d1b67707dcf0f6b08bfaf0b408bd46e Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Fri, 19 Sep 2025 13:17:14 +1200 Subject: Massive rewrite This commit rewrites the emulator halfway from scratch to make it easier to change and maintain in the future. The emulator core was rewritten to adhere to the released Bedrock specification (earlier versions implemented an older prototype specification, which is no longer relevant). This commit also adds proper support for running multiple concurrent Bedrock instances. This was previously supported in a limited manner for the on-screen keyboard, but now works for any regular program as well, with switching being performed by pressing the L or R bumper buttons. This is disabled by default, as programs will still need to be baked into the emulator and hand-loaded. --- arm9/source/dev.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 arm9/source/dev.h (limited to 'arm9/source/dev.h') diff --git a/arm9/source/dev.h b/arm9/source/dev.h new file mode 100644 index 0000000..272baea --- /dev/null +++ b/arm9/source/dev.h @@ -0,0 +1,49 @@ +#ifndef DEV_H_ + #define DEV_H_ + + #include "devices/system.h" + #include "devices/memory.h" + #include "devices/math.h" + #include "devices/clock.h" + #include "devices/input.h" + #include "devices/screen.h" + #include "devices/stream.h" + #include "devices/file.h" + + + // Signals that can be emitted by a device. + typedef enum { + SIG_NONE = 0, + SIG_HALT, + SIG_DB1, + SIG_DB2, + SIG_DB3, + SIG_DB4, + SIG_DB5, + SIG_DB6, + SIG_SLEEP, + SIG_RESET, + SIG_FORK, + } Signal; + + // Bedrock device bus. + typedef struct { + SystemDevice system; + MemoryDevice memory; + MathDevice math; + ClockDevice clock; + InputDevice input; + ScreenDevice screen; + StreamDevice stream; + FileDevice file; + } DeviceBus; + + // Methods. + void dev_reset(DeviceBus *d); + u8 dev_read(DeviceBus *d, u8 port); + Signal dev_write(DeviceBus *d, u8 port, u8 v); + + // Duplicate declarations from main. + void open_keyboard(void); + void close_keyboard(void); +#endif -- cgit v1.2.3-70-g09d2