vgbc/memory/device.cpp

14 lines
283 B
C++

#include <memory/device.h>
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;
}