Initial Reset Vector not a valid opcode?

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
PolarBITS
Posts: 21
Joined: Mon May 01, 2017 4:11 pm

Initial Reset Vector not a valid opcode?

Post by PolarBITS »

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).
Sour
Posts: 890
Joined: Sun Feb 07, 2016 6:16 pm

Re: Initial Reset Vector not a valid opcode?

Post by Sour »

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.
PolarBITS
Posts: 21
Joined: Mon May 01, 2017 4:11 pm

Re: Initial Reset Vector not a valid opcode?

Post by PolarBITS »

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!
PolarBITS
Posts: 21
Joined: Mon May 01, 2017 4:11 pm

Re: Initial Reset Vector not a valid opcode?

Post by PolarBITS »

the opcode is 78 now. is that still valid? I'm not entirely sure.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Initial Reset Vector not a valid opcode?

Post by tokumaru »

If you mean $78, that's SEI, the first instruction in 99.9% of all 6502 programs, so yeah, it's valid. :D
PolarBITS
Posts: 21
Joined: Mon May 01, 2017 4:11 pm

Re: Initial Reset Vector not a valid opcode?

Post by PolarBITS »

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.
Post Reply