Welcome to Emulationworld

Forum Index | FAQ | New User | Login | Search

Make a New PostPrevious ThreadView All ThreadsNext ThreadShow in Flat Mode*


SubjectRe: NES Emulator: Where does the instruction pointer start in a ROM? Reply to this message
Posted byBart T.
Posted on01/26/08 05:09 PM



I think you need to distinguish between the ROM file, which is essentially a dump of the ROM chips on the cartridge plus a header tacked on, and the 6502 address space, which is only 64KB total. Obviously, some of that 64KB has to be mapped to RAM and hardware registers and only a fraction to ROM. Therefore, the cartridges often provide a hardware mechanism (so-called "mappers") to change (or "map") the chunk of ROM that is visible to the 6502.

According to the documentation I'm looking at, for a MOS 65CE02, the reset vector is at FFFC. The low 8 bits of the program counter are loaded from there, and the high 8 bits from FFFD. From what I recall, the cartridge ROM space appears somewhere in the upper address space of the 6502, which would cover these vectors. Therefore, you should ensure that you are mapping the cartridge appropriately here.

You'll have to consult more documentation on the NES as well as the mapper that the game(s) in question use.


> I have a NES emu project in its beginning stages, I can read the 16byte headeer
> correctly and find out how many pages of prg and chr rom it has, and I can setup
> the 2 prg rom banks and all that. But where do I start reading opcodes from? I
> know its in the PRG-ROM somewhere. I was told FFFEh? But that is outside of the
> allocated PRG-ROM memory range. I'm just trying to fetch the first opcode, which
> i'm having trouble doing. If someone could tell me the default Program
> counter/instruction counter address, it would be greatly appreciated!
>


----
Bart

-
Entire Thread
Subject  Posted byPosted On
*NES Emulator: Where does the instruction pointer start in a ROM?  klipseracer01/26/08 01:44 PM
..Re: NES Emulator: Where does the instruction pointer start in a ROM?  Bart T.01/26/08 05:09 PM
..*Re: NES Emulator: Where does the instruction pointer start in a ROM?  klipseracer02/01/08 00:24 AM
...*Re: NES Emulator: Where does the instruction pointer start in a ROM?  Bart T.02/01/08 02:57 AM