Page 1 of 25 12311 ... LastLast
Results 1 to 10 of 245

Thread: Nes

  1. #1
    EmuTalk Member BGNG's Avatar
    Join Date
    Jun 2004
    Posts
    198
    Mentioned
    0 Post(s)

    Nes

    Oh, what the hey? There's a Chip8 and Game Boy topic, why not NES?

    Let's see... A few good resources (I've attatched them to this post) for NES emulator programming would be YOSHi's NES TECH document and Firebug's Mappers document (for the expansion modules). Also in that ZIP is documentation on the NMOS 6502 Assembly.

    The NES runs on, as just mentioned, a custom NMOS 6502 microprocessor modified for use on the NES by integrating sound generation and assorted I/O registers, which was manufactured by Ricoh and is called RP2A03G. It's approx. 1.773MHz for PAL and 1.790MHz for NTSC.

    The NES has a couple of memory modules inaccessible directly by the processor. These would include the PPU memory and Sprite memory, which must be indirectly written to and read from by using registers $2003 & $2004, and $2006 & $2007, which is described in the tech document.

    The video system itself is a 256240-pixel display and is composed of two major parts: the background and the sprites. Both of these use image data from the same place in PPU memory called the Pattern Table. The Pattern Table consists of 88-pixel tile data, two bits per pixel. The background has a confusing structure. The lower two bits of the background color is its pattern map, called the Name Table. The upper two bits of the background come from the Attribute Table, which describes the colors for a 44-tile square on the screen in a method I will not describe in this post.

    By default, mirroring is applied to the Name Tables to allow for wrapping when memory is read from them, but expansion modules can be used to give the NES up to 4 Name/Attribute tables.

    The Sprites have a few functions to them which allow them to be flipped horizonally and vertically, and the upper two color bits of the sprites are stored in sprite memory themselves.



    The NES has two color palets of 16 colors each; one for Background and one for Sprites. There are 52 different colors these can be, the exact values of which are predefined in the NES (and varry for NTSC and PAL slightly)
    __________

    Meh. I'll stop there for now. If there's any interest, I'll say more.

  2. #2
    PCSX2 Coder refraction's Avatar
    Join Date
    Apr 2004
    Location
    Sheffield, UK
    Posts
    459
    Mentioned
    0 Post(s)
    i would say yes as NES is one of my favourite consoles from the past, but, i havent even made a GB emu yet, so ill keep it on hold till i do

  3. #3
    EmuTalk Member BGNG's Avatar
    Join Date
    Jun 2004
    Posts
    198
    Mentioned
    0 Post(s)
    Is that "yes" as in "Yes, I am interested in this topic"?
    __________

    Also, the NES processor does not allow for Binary-Coded Decimal like the standard form of the 6502 does. You can set or clear that flag in the Status register all you want, but all arithmetic (ADC and SBC) is done with normal byte arithmetic.

  4. #4
    PCSX2 Coder refraction's Avatar
    Join Date
    Apr 2004
    Location
    Sheffield, UK
    Posts
    459
    Mentioned
    0 Post(s)
    yes its an interesting topic, im sure it would be very handy for people to have pleanty of info on the NES system, as you said, GB and Chip8 are up there, why not put the next step up too

  5. #5
    EmuTalk Member BGNG's Avatar
    Join Date
    Jun 2004
    Posts
    198
    Mentioned
    0 Post(s)
    "Next step"? Well... With the exception of some old-fashioned inefficiencies and that mess of mappers, this thing is actually a little easier to emulate than the Game Boy; it's simply a lot weirder, which makes people skip over it. The whole issue with "mappers" is about as proprietary as you can get, and is up on the variation scale along with a lot of the SNES capability chips produced by third-party developers.

    But for the most part, if you can get a good grasp on all those ROM/RAM/VRAM/VROM banks in the NES carts and how different games access them, then the emulation will be fairly easy to implement.
    __________

    I'd have an example to show right now, except I keep changing how I want to make it, and things in real life keep popping up to distract me. I've finally decided to make a DLL that handles all aspects of emulation and needs only HDC for video output, an optional audio device (usually wave mapper), and input map. Any strange findings I make I'll post in this thread.

  6. #6
    Moderator aprentice's Avatar
    Join Date
    Nov 2001
    Posts
    1,337
    Mentioned
    0 Post(s)
    you missed a very important function, interrupts are sure to boggle most people on the nes

  7. #7
    EmuTalk Member BGNG's Avatar
    Join Date
    Jun 2004
    Posts
    198
    Mentioned
    0 Post(s)
    What do you mean? I'm not boggled, so I may be missing something.

    There are four kinds of interrupts on the NES: Abort, Software (IRQ/BRK), Non-Maskable and Reset. Abort needs not be emulated, as it's part of the hardware configuration and has no effect on the programming. The other three have vectors, or addresses to jump to, at the end of the ROM and each is called when approperiate.

    The Software interrupt is not much more than a, as far as analogy is concerned, really-low-level callback invoked by the BRK instruction.

    The Non-Maskable Interrupt, or NMI, is typically used by the programs to respond to PPU events such as VBlank or sprite hits (non-transparent pixels drawn to the screen).

    The Reset vector in NES is nothing more than the code entry point. It will execute code starting at the reset vector. (In the event there is a trainer, however, it will begin execution at the trainer itself)

  8. #8
    Moderator aprentice's Avatar
    Join Date
    Nov 2001
    Posts
    1,337
    Mentioned
    0 Post(s)
    the vblank interrupt and when it should be executed, at least thats the problem i had when i've given up on my nes emu and went back to my gameboy emu

  9. #9
    EmuTalk Member BGNG's Avatar
    Join Date
    Jun 2004
    Posts
    198
    Mentioned
    0 Post(s)
    The VBlank triggers a non-maskable interrupt after the last scanline is drawn to the screen... but only if the program enables it to do so when it sets up the PPU. Otherwise, the program can wait and constantly poll the VBlank bit to see if VBlank has occured.

  10. #10
    Moderator Cyberman's Avatar
    Join Date
    Nov 2001
    Posts
    1,930
    Mentioned
    1 Post(s)
    Quote Originally Posted by BGNG
    The VBlank triggers a non-maskable interrupt after the last scanline is drawn to the screen... but only if the program enables it to do so when it sets up the PPU. Otherwise, the program can wait and constantly poll the VBlank bit to see if VBlank has occured.
    Which of course means you have to be sure to find a good way to set this VBlank bit to be inspected by software synchronisely with the NES display. That can be a bit of a challenge. You should also 'trip' the interrupt if the intterupt is enabled when you set the bit.

    Cyb
    Progress (n.):
    The process through which the Internet has evolved from smart people in front of dumb terminals to dumb people in front of smart terminals.
    -------------------------------------------------------------------
    Recursive (adj):
    see Recursive

Page 1 of 25 12311 ... LastLast

Similar Threads

  1. How to make a Usb Nes controller.
    By Fender432 in forum Jnes
    Replies: 3
    Last Post: November 10th, 2004, 14:30
  2. Get 700+ games for nes
    By GlM in forum Jnes
    Replies: 5
    Last Post: July 23rd, 2004, 01:24
  3. Palm OS5 NES emulator?
    By jgyurkovitz in forum Jnes
    Replies: 0
    Last Post: January 5th, 2003, 08:53
  4. NES Emulation
    By mexican(Aus) in forum NES Emulation
    Replies: 4
    Last Post: September 8th, 2002, 02:25
  5. NES Gun Games
    By Tekken in forum NesterDC
    Replies: 0
    Last Post: January 1st, 2002, 18:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •