summaryrefslogtreecommitdiff
path: root/bus.cpp
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2022-08-30 16:49:38 +0300
committerOxore <oxore@protonmail.com>2022-08-30 16:49:38 +0300
commited3cf413dfe5f874f203f8b6a696af29cfc47dcd (patch)
tree9d9c181a568cf1833218444c0d2b26b33063435e /bus.cpp
parent026894023fa53fa32fd342d18e05f55743cf6c4b (diff)
Impl emulator stepping with GDB
Diffstat (limited to 'bus.cpp')
-rw-r--r--bus.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/bus.cpp b/bus.cpp
index caff07c..aef20a4 100644
--- a/bus.cpp
+++ b/bus.cpp
@@ -3,6 +3,7 @@
#include "bus.hpp"
#include "musashi-m68k/m68k.h"
+#include "utils.hpp"
#include <cassert>
#include <cstdarg>
@@ -62,34 +63,35 @@ static inline unsigned int memory_read_concrete(
(base[address + 2] << 8) |
base[address + 3];
}
- __builtin_unreachable();
+ UNREACHABLE();
}
static inline struct read_result memory_read(
enum bitness bitness,
unsigned int address)
{
- if (is_in_range(address, ROM_START, ROM_SIZE))
- return (struct read_result){
+ if (is_in_range(address, ROM_START, ROM_SIZE)) {
+ return read_result{
memory_read_concrete(bitness, g_rom, address - ROM_START),
true,
};
- else if (is_in_range(address, RAM_START, RAM_SIZE))
- return (struct read_result){
+ } else if (is_in_range(address, RAM_START, RAM_SIZE)) {
+ return read_result{
memory_read_concrete(bitness, g_ram, address - RAM_START),
true,
};
- else if (is_in_range(address, IO1_START, IO1_SIZE))
- return (struct read_result){
+ } else if (is_in_range(address, IO1_START, IO1_SIZE)) {
+ return read_result{
memory_read_concrete(bitness, g_io1, address - IO1_START),
true,
};
- else if (is_in_range(address, IO2_START, IO2_SIZE))
- return (struct read_result){
+ } else if (is_in_range(address, IO2_START, IO2_SIZE)) {
+ return read_result{
memory_read_concrete(bitness, g_io2, address - IO2_START),
true,
};
- return (struct read_result){0, false};
+ }
+ return read_result{0, false};
}
static inline void memory_write_concrete(