(06-25-2009, 01:02 AM)gergep Wrote: Sorry for all the annoying questions but i still dont get how the people who make the open source emulators know where to put the opcodes... and also if the is 1NNN how come all of the docs say that is the opcode in hexadecimal and if thats true, how would i get the value
Hexadecimal is just a base-16 number system. You can represent hex humbers in, say, decimal, or better yet - binary.
You take the opcodes from the file 2 bytes (hint: a short) at a time.
The "& 0x0FFF" gets the last three nibbles (4 bits, half a byte) of the opcode. This is the NNN part. Remember, all Chip8 opcodes are 2 bytes long.
The first nibble of the opcode is taken from the first nibble, then some are taken from other parts (like ones from the same set - such as 8XY0 and 8XY1.)
I'm definitely not an expert, but go stare at the documentation, or find some code that names things. In my code, it names things like "op_firstnibble"
I still can't get mine to draw things right though.
I think I'm going to make one in another language for right now.