nesdev.com
http://forums.nesdev.com/

Initial Reset Vector not a valid opcode?
http://forums.nesdev.com/viewtopic.php?f=3&t=15888
Page 1 of 1

Author:  PolarBITS [ Mon May 01, 2017 4:15 pm ]
Post subject:  Initial Reset Vector not a valid opcode?

When I load a rom into memory, I mirror it to fit into the whole Cartridge space as per usual. The reset vector at $FFFC points to $9EC7 which is value 0x2B. As far as I can tell this is not a valid opcode. Can someone help me with this? (Btw the rom is Donkey Kong).

Author:  Sour [ Mon May 01, 2017 4:37 pm ]
Post subject:  Re: Initial Reset Vector not a valid opcode?

You're interpreting the bytes in the wrong order - the reset vector points to $C79E, not $9EC7.
The 6502, like x86 CPUs, uses little endian encoding.

Author:  PolarBITS [ Mon May 01, 2017 6:38 pm ]
Post subject:  Re: Initial Reset Vector not a valid opcode?

Sour wrote:
You're interpreting the bytes in the wrong order - the reset vector points to $C79E, not $9EC7.
The 6502, like x86 CPUs, uses little endian encoding.


I completely forgot, lol. Thanks!

Author:  PolarBITS [ Mon May 01, 2017 6:39 pm ]
Post subject:  Re: Initial Reset Vector not a valid opcode?

the opcode is 78 now. is that still valid? I'm not entirely sure.

Author:  tokumaru [ Mon May 01, 2017 6:44 pm ]
Post subject:  Re: Initial Reset Vector not a valid opcode?

If you mean $78, that's SEI, the first instruction in 99.9% of all 6502 programs, so yeah, it's valid. :D

Author:  PolarBITS [ Mon May 01, 2017 6:49 pm ]
Post subject:  Re: Initial Reset Vector not a valid opcode?

I think I just now understood what the opcode matrix on the wiki means. I found another table that just lists values and their opcodes, and I realize that the table columns are just offsets from the rows, and the opcode is the row+column added together. Sorry, this is my first time doing emulation of this scale so I'm learning as I go along.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/