[Memory] Add read16 (how did I never notice this was missing?)

This commit is contained in:
wheremyfoodat 2022-09-21 00:33:32 +03:00
parent 2088b59f10
commit 5bcdf4d063

View file

@ -63,7 +63,16 @@ u8 Memory::read8(u32 vaddr) {
}
u16 Memory::read16(u32 vaddr) {
Helpers::panic("Unimplemented 16-bit read, addr: %08X", vaddr);
const u32 page = vaddr >> pageShift;
const u32 offset = vaddr & pageMask;
uintptr_t pointer = readTable[page];
if (pointer != 0) [[likely]] {
return *(u16*)(pointer + offset);
}
else {
Helpers::panic("Unimplemented 16-bit read, addr: %08X", vaddr);
}
}
u32 Memory::read32(u32 vaddr) {