NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext Thread*Show in Threaded Mode


SubjectVblank new  
Posted byEjdolf
Posted on11/6/01 8:11 PM
From IP130.239.145.212  



Dumb question
As I have understood things, the PPU draws the screen. At each end of a
scanline a Hblank occurs and when the screen is completely drawn, Vblank occurs.
Meaning the PPU sends a signal to the processor like: "Hej you,Vblank occured".
A Vblank is a NMI which makes the processor jump to a certain address, and then
returns to its original address when reading an RTI. Since PAL-standard frequency is 50Hz, Vblank occurs 50 times / second.

What happens if the program hasnt reach the NMI in 1/50 of a second?
is there anything such as "nested interrupts"?

There maybe a lot of mistakes in may way of thinking, please correct me on
everything that is wrong in the text!





SubjectRe: Vblank new  
Posted byzero soul
Posted on11/7/01 11:21 AM



that's correct, for the most part:

1) The PPU doesn't 'tell' the processor that VBlank occured. what it does is it raises a 'flag' (bit) in register $2002 (bit 000000) when VBlank occurs. it is up to the program (ie., you) to read this information and react accordingly.

2) yes, an interrupt can occur before the previous one has ended. the CPU doesn't 'know' that it's doing an interrupt routine; as soon as it's done handling the NMI interrupt, it's all the same to it. if such a situation (one NMI occuring before the previous NMI routine has ended) were to occur, it'd probably result in a lockup or would otherwise make your game not work. ;)

3) The PPU has no way to indicate that HBlank has taken place (it does not raise or lower any flags on HBlank, thus you cannot systematically check for the presence of HBlank). I figure you probably knew that already, though.

besides that, your interpretation is correct to my knowledge.


...just another vision...


SubjectRe: Vblank new  
Posted byEjdolf
Posted on11/8/01 12:05 PM
From IP130.239.145.212  



A few more questions about the Vblank subject:

1) If the CPU doesnt jump automatically when the vblank occur, what is
the purpose of the NMI jump vector? ($FFFA-$FFFB)

2) How many clockcycles takes a Vblank, a Hblank and and an actual drawing of
a scanline?




SubjectRe: Vblank  
Posted byzero soul
Posted on11/10/01 9:20 PM



1) assuming you have the PPU generate an NMI on VBlank (you can enable/disable this in the high bit of $2000, if I remember correctly), the CPU *will* jump to the NMI vector. if not, no big deal. the NMI vector's *value* contains the address to which to jump when NMI is triggered. it is equivelant to JMP ($FFFA)

2) I don't know all the clock cycle bits, although I have heard that it takes "7 cycles to move in and out of an interrupt"; whether that means it takes seven cycles to enter and seven to leave, or seven *total*, I dunno. you'll have to talk to Chris Covell or Memblers or someone else for more info on this.


...just another vision...


SubjectRe: Vblank new  
Posted bykoitsu
Posted on11/12/01 09:18 AM
From IP24.5.220.183  



An NMI is an interrupt. NMI is generated every VBlank on the NES, assuming you have the internal NES register set up to generate an NMI on every VBlank. I don't remember which register this is.

If you don't configure this register, VBlank won't cause an NMI.

The CPU itself doesn't know anything about VBlank.




Previous ThreadView All ThreadsNext Thread*Show in Threaded Mode
Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo