johnbaumann/ACC8I

Program Crash - BMP Viewer Test Rom

johnbaumann opened this issue · 1 comments

File: thirdparty\chip8-roms\programs\BMP Viewer - Hello (C8 example) [Hap, 2005].ch8

Crash at PC 538/0x21A
Instruction D211(DXYN), draw sprite function
Write access violation assigning bit to screen value array

VX(2) = 0
VY(1) = 255/0xFF
I = 560/0x230

The cause of this bug seems to be some inconsistency in the available documentation around the 8XY6(SHR) and 8XYE(SHL) instructions. Matthew Mikolay's documentation states this opcode is incorrectly documented elsewhere, but implementing the instruction as described leads to improper behavior when comparing to other emulators.

Changing code as follows allows this rom to run correctly.
VX >>= 1
versus
VX = VY >> 1