Page 2 of 25 FirstFirst 123412 ... LastLast
Results 11 to 20 of 245

Thread: Nes

  1. #11
    EmuTalk Member BGNG's Avatar
    Join Date
    Jun 2004
    Posts
    198
    Mentioned
    0 Post(s)
    The bit is stored in the PPU status register, so you just set it after the last scanline is drawn in the video rendering. No biggie. The memory handler of any emulator should just read memory address $2002 as that byte anyways, which the programs do. It will thusly be such a "Wait for VBlank" in that event. (Although reading the register will reset the BGScroll values. I'll have to look up a better way to poll for VBlank.)



    Triggering the interrupt is almost identical to that of the code used for the BRK instruction, with the exception that the vector is at $FFFA instead of $FFFE.

  2. #12
    EmuTalk Member hap's Avatar
    Join Date
    Jan 2005
    Posts
    188
    Mentioned
    0 Post(s)
    Chip8 was fun, proving to myself emulator programming is an enjoyable waste of time. I moved on to something a bit more challenging; yeah, the NES. Currently the only thing that's done is the CPU, it's complete, and completely untested ;p .. all I get on screen right now is BRK BRK BRK BRK BRK, etc, which looks alright, since the memory is filled with zeroes, and BRK is opcode 0.

    I mainly used the official datasheet, 1st one in this list: http://www.6502.org/documents/datasheets/rockwell/

  3. #13
    EmuTalk Member BGNG's Avatar
    Join Date
    Jun 2004
    Posts
    198
    Mentioned
    0 Post(s)
    Ah. I was about to correct you, but I was thinking NOP was 0, which it isn't. Indeed, BRK is 0.

    I myself have been forced to leave my project alone for a time, so I'm still in the process of porting things to DLL format. I may not be able to assist you in your work if you have questions.

  4. #14
    EmuTalk Member
    Join Date
    Feb 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Quote Originally Posted by BGNG
    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)

    I dont recall the nes having a abort interrupt. The nes has only 3 interrupt types and function as follows:

    RESET:
    Is only used during power up after the rom has been loaded into memory, then the cpu jumps to the interrupt vector.

    IRQ/BRK:
    This can either be triggered by software or hardware. But as far as i know no nes rom is known to use the BRK instruction so this mainly leaves hardware left. There are several mappers that generate IRQ, usaly after a given number of scanlines or each scanline. The sound generator can also trigger IRQ, but very few games are dependent of this.
    (and this interrupt is maskable, through the I flag on the cpu)

    NMI:
    This interrupt is only executed when 0x2000.7 is set. Then the PPU will give the CPU a NMI at the start of Vblank.
    (this interrupt is ofcourse non-maskable)

    The problem with the nes is that games often uses some nasty trick to get things done in time with the limited prossesor power it got. This means clk timing the nes is VERY important (and causes a big problem with interrupts), some games even crash if your emu is of by only a few clk.

  5. #15
    EmuTalk Member BGNG's Avatar
    Join Date
    Jun 2004
    Posts
    198
    Mentioned
    0 Post(s)
    Quote Originally Posted by BGNG
    Abort needs not be emulated, as it's part of the hardware configuration and has no effect on the programming.
    ()

  6. #16
    EmuTalk Member
    Join Date
    Feb 2005
    Posts
    2
    Mentioned
    0 Post(s)
    ah, i saw now where you got the abort interrupt from, since its mention in the docs you posted.

    Just as a note.
    I skimmed through the doc telling about the nes and it is missing some vital info along with some of it not beeing correct.
    i.e the ppu does not genereate NMI on sprite #0 hit, this bit isnt even used on the nes

    oh and btw that cpu 6502 doc is not very accurate too, it has some incorrect timings and flag settings errors.
    (but its tells the basics though, and should be sufficient to get a working emu)

  7. #17
    EmuTalk Member hap's Avatar
    Join Date
    Jan 2005
    Posts
    188
    Mentioned
    0 Post(s)
    Neat, first time it's showing something ungarbaged. Pacman even goes to the demo, making dots vanish with ghost-pacman no sprites yet.

  8. #18
    EmuTalk Member hap's Avatar
    Join Date
    Jan 2005
    Posts
    188
    Mentioned
    0 Post(s)
    this is MMC2, punch out. I'm surprised it's getting this far.
    I should really enhance the PPU emulation, all it's doing now is draw 4-colour tiles on the screen.

    Is anyone else actively working on a new NES emu ?

    *edit* hmm, the background looks better, but mike's not waiting for my challenge anymore :p
    Last edited by hap; February 24th, 2005 at 07:18.

  9. #19
    EmuTalk Member BGNG's Avatar
    Join Date
    Jun 2004
    Posts
    198
    Mentioned
    0 Post(s)
    I've got one in the works, but not actively. Life threw a curveball and it'll take a while to get back to the project. Even when I DO get back to it, it'll take a while to get to testing it in the real world because I'm doing just about everything seperately before connecting them all together. I'm engineering the code to be easily updatable and work as fast as possible by eliminating extrenuous function calls. Not an easy task, but it's fun.

    It's also being constructed in a Windows DLL so it can be used from ANY programming language given nothing but an hDC and input map.

  10. #20
    EmuTalk Member hap's Avatar
    Join Date
    Jan 2005
    Posts
    188
    Mentioned
    0 Post(s)
    aprentice: will you ever continue with your NES emu ?

    these are the basics for when to hit vblank.

    dummy scanline (341 ppu cycles)
    240 visible scanlines (341*240 ppu cycles)
    dummy scanline (256 ppu cycles, so no hblank here), then hit vblank, and let the cpu run out of cycles before starting a new frame

    1 cpu cycle=3 ppu cycles
    cpu cycles start at ~1789773/60, so vblank hits at cycle (1789773/60)-((256+341+(240*341))/3)=~2350

Page 2 of 25 FirstFirst 123412 ... 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
  •