Page 1 of 1

Where to find the instruction pointer in NES roms? Thanks!

Posted: Tue Oct 27, 2009 8:58 am
by happymaomao
I've been troubled by this problem a long time. I searched the web and some one said the starting value can be found at 0xfffe. However it's already out of the rom size (the size of rom is only 24k).

So can anyone help to tell me where to find this starting value in roms?

Thanks for your help!!

:D :D

Posted: Tue Oct 27, 2009 9:22 am
by Rid
When the guy said you to look à 0xFFFE, I think I was weaning an CPU address and not a ROM offset.

In other word, just look at the adresse $FFFE in debug mode, when playing your ROM with FCEUXD SP :)

Posted: Tue Oct 27, 2009 9:26 am
by happymaomao
Thx, my friend~! I took it wrongly.

If the PRG rom is only 16k, it would be saved at both $8000 and $c000

So I can find the instruction pointer at $FFFE.

However, I saw some of the code do this at $FFFC. Is there any difference between these two ways?

Thanks again!!

Posted: Tue Oct 27, 2009 9:35 am
by Rid
I'm not an expert but I think that the CPU reserved three adresses :
$FFFA : NMI vector - address to go when NMI (Non Maskable Interrupt) occurs
$FFFC : RESET vector - address to go when starting or resetting the NES
$FFFE : IRQ/BRK vector - don't know when it is useful

Anyway, you shall look at the Nesdev Wiki to find your answer, and more specifically here to see the NES architecture.

Posted: Tue Oct 27, 2009 9:38 am
by happymaomao
Thanks my friend. Thanks for your patience. :-}

Two great helpful pages!!

Thanks again!

Posted: Tue Oct 27, 2009 3:06 pm
by Zepper
- Nope. Firstly, you must know the mapper number and which PRG banks are loaded at CPU 8000-FFFF on startup. Once you know the PRG number at E000-FFFF (an 8k page), so yes, use FFFC and FFFD as the RESET address, or entry point as you asked.

Posted: Tue Oct 27, 2009 4:41 pm
by Rid
As the game has only 16Ko of PRG, I thought there was no mapper...

Posted: Tue Oct 27, 2009 5:05 pm
by tepples
If the PRG ROM is 16 KiB, then I'm 99% sure the board is NROM. But check bits 7-4 of bytes 6 and 7 of the header to be sure.

Posted: Wed Oct 28, 2009 8:12 am
by happymaomao
The size of rom is only 24k, and here is the header
78 69 83 26 1 1 0 0 0 0 0 0 0 0 0 0

So, I think no mapper.. :oops:

I just want to start with a simple rom so I use battle city as it. ^__^

Posted: Wed Oct 28, 2009 8:44 am
by tepples
happymaomao wrote:The size of rom is only 24k, and here is the header
78 69 83 26 1 1 0 0 0 0 0 0 0 0 0 0
78 69 83 26: Present at start of all headers
1: 1*16384 byte PRG
1: 1*8192 byte CHR
0 0: If both of these are under 16, you're right that you have a board with no mapper, such as NROM.

Posted: Wed Oct 28, 2009 8:53 am
by happymaomao
Thanks tepples :D

I'm just a newbie of emu but loving NES very much. So I determine to implment a simple NES emulator using java. I may get lots of questions future. Thanks for helps from every superior in advanced.

^___^