Fix font indexing offset incorrectly pitching ptr

This commit is contained in:
Doyle Thai 2017-04-07 15:41:04 +10:00
parent 1a3ce032ac
commit f96394dde0
2 changed files with 6 additions and 7 deletions

View File

@ -287,7 +287,7 @@ void dchip8_update(PlatformRenderBuffer renderBuffer, PlatformInput input,
if (cpu.state == chip8state_load_file)
{
PlatformFile file = {};
if (platform_open_file(L"roms/brix", &file))
if (platform_open_file(L"roms/pong", &file))
{
DQNT_ASSERT((cpu.INIT_ADDRESS + file.size) <=
memory.permanentMemSize);
@ -721,12 +721,11 @@ void dchip8_update(PlatformRenderBuffer renderBuffer, PlatformInput input,
DQNT_ASSERT(hexCharFromFontSet >= 0x00 &&
hexCharFromFontSet <= 0x0F);
const u8 BITS_IN_BYTE = 8;
u8 fontSizeInMem = BITS_IN_BYTE * 5;
u16 startMemAddrOfFontSet = 0;
const u32 START_ADDR_OF_FONT = 0;
const u32 BYTES_PER_FONT = 5;
cpu.I = startMemAddrOfFontSet +
(hexCharFromFontSet * fontSizeInMem);
cpu.I = START_ADDR_OF_FONT +
(hexCharFromFontSet * BYTES_PER_FONT);
}
// LD B, Vx - Fx33 - Store BCD representations of Vx in memory
// locations I, I+1 and I+2

View File

@ -299,7 +299,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
platformBuffer.memory = globalRenderBitmap.memory;
platformBuffer.height = globalRenderBitmap.height;
platformBuffer.width = globalRenderBitmap.width;
platformBuffer.bytesPerPixel = globalRenderBitmap.bytesPerPixel;
platformBuffer.bytesPerPixel = globalRenderBitmap.bytesPerPixel;
dchip8_update(platformBuffer, platformInput, platformMemory);
for (i32 i = 0; i < DQNT_ARRAY_COUNT(platformInput.key); i++)