It is currently Sun Nov 19, 2017 12:04 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Tue Sep 12, 2006 3:43 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3075
Location: Brazil
Let me "teach" something cool. I checked the PC address where the test begins, plus the LDA instruction (yes, the exact moment). Once LDA #$03 (for test 3, as example) is triggered, so I start my CPU log (disassembling and a few things, as IRQs, NMIs and PPU timing are logged). You can add log to a few PPU rendering events, plus log its registers (2000,2002,etc). Man... it was wonderful. I could check WHY my emu wasn't OK, in which TIME it fails, what things are being triggered or not, and when. Asking for "theory only" might fail after all, because you WON'T understand the internal thing in deep meaning. ^_^;;

_________________
Zepper
RockNES developer


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 12, 2006 5:18 pm 
Offline

Joined: Wed Mar 22, 2006 8:00 am
Posts: 354
If an interrupt (IRQ or NMI) occurs during the last cycle of an instruction, the CPU will execute one more instruction, then process the interrupt. If an interrupt occurs during any other cycle of an instruction (from the first cycle through the second-to-last), the CPU will finish executing that instruction, then process the interrupt.

LDA #1
LDA #2

If an interrupt occurs during the first cycle of LDA #1, the accumulator will contain a 1 when the interrupt code begins executing, and the PC on the stack will point to the start of LDA #2. If, however, an interrupt occurs during the second cycle of LDA #1 (this instruction is 2 cycles long), the accumulator will contain a 2 when the interrupt code begins execution, and the PC on the stack will point to the first instruction after LDA #2. You can think of it as a 1-cycle latency (where one cycle passes after an interrupt occurs before the CPU sees it).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 12, 2006 5:54 pm 
Offline

Joined: Tue Jul 11, 2006 10:12 am
Posts: 60
oh its bit hard to understand..but is like this: I should check when the last instruction is executed if its overflow the 'num of cycles per frame' by only one CPU cycle, if this is true, the next opcode should be executed as well?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 5:32 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3075
Location: Brazil
Quote:
If an interrupt (IRQ or NMI) occurs during the last cycle of an instruction, the CPU will execute one more instruction, then process the interrupt. If an interrupt occurs during any other cycle of an instruction (from the first cycle through the second-to-last), the CPU will finish executing that instruction, then process the interrupt.


Quite interesting. This might fix a few things here, thanks.

_________________
Zepper
RockNES developer


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 5:34 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19227
Location: NE Indiana, USA (NTSC)
By "last", you mean e.g. the second cycle of INX or the fifth cycle of LSR $30, not the (pipelined) writeback + next instruction fetch, right?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 8:56 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
tepples wrote:
By "last", you mean e.g. the second cycle of INX or the fifth cycle of LSR $30, not the (pipelined) writeback + next instruction fetch, right?

Ugh, yes, this issue has been growing in my mind lately. We really need to clarify the conceptual model on this aspect. In reality, execution of INX occurs during three cycles, but only increases total execution time by two cycles. What do we do? Currently it seems we say that INX takes two cycles, but then confusingly refer to the third cycle of the instruction and call the second cycle the last cycle?!?

Could we say last visible cycle of an instruction? The last non-overlapped cycle? Seems we need to upgrade the shared conceptual model and terminology, or these things will remain confusing due to our inability to refer to things without long phrases.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 5:59 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19227
Location: NE Indiana, USA (NTSC)
I'd say use whatever terminology MOS Technology and Western Design Center use.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group