vgbc/memory/device.cpp

15 lines
283 B
C++
Raw Normal View History

#include <memory/device.h>
2023-08-27 22:19:02 +02:00
void Mem_device::write16(u16 addr, u16 data)
{
write8(addr, (u8)(data & 0xFF));
write8(addr+1, (u8)((data >> 8) & 0xFF));
}
u16 Mem_device::read16(u16 addr)
{
u8 lsb = read8(addr);
u8 msb = read8(addr+1);
return ((u16)msb << 8) | (u16)lsb;
}