Thread: CHIP8 thread
View Single Post
Old March 26th, 2009   #86 (permalink)
Dax
ライチュウ
 
Dax's Avatar
 
Join Date: Nov 2006
Location: USA
Posts: 3,292
I need some help with fetching opcodes. For some reason, my emulator reads the first 4 opcodes of Pong fine, but the fifth is seen as FFEA, when it should be A2EA.

Here's how I fetch opcodes:
Code:
regs.OP = (unsigned short)( (RAM[regs.PC] << 8) | RAM[regs.PC + 1] );
Here's how I do the classic case/switch statement:
Code:
switch( ((regs.OP & 0xF000) >> 12) )
The emu loads the ROM fine, and in RAM, the contents are correct. So it's not a loading issue.
Dax is offline   Reply With Quote