Newbie to emulation questions

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

I planned to fetch and handle input whenever the game strobed the controller, I don't know how realistic this is however.
mattmatteh
Posts: 345
Joined: Fri Jul 29, 2005 3:40 pm
Location: near chicago

Post by mattmatteh »

i was going to do this. i kinda put that on hold for now. i was looking into different controller and keyboard input libs.

right now i have 2 threads, the nes core thread and the main thread for input. the main thread will set the nes controller variables when changed, then the nes core reads them. its even driven. not sure if this is a good way to code, but works for the time being.

matt
User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

Are there any drawbacks to running one CPU instruction, then 3*(last instruction's cycles) PPU cycles?

Can anything other than CPU writes alter rendering?

Is there a benefit to synching the CPU to PPU cycles?

I don't plan to support MMC2/MMC4/MMC5 initially but what should I be building into the framework so in case I do later on, I don't burn my bridges?

Thanks!
Last edited by kyuusaku on Thu Sep 21, 2006 4:09 pm, edited 1 time in total.
mattmatteh
Posts: 345
Joined: Fri Jul 29, 2005 3:40 pm
Location: near chicago

Post by mattmatteh »

i think you mean cpu cycle ? a cpu instruction is at least 2 cpu cycles

the emu would be more accurate that way. however that would probably cause alot of cache misses and extra funciton calls. this is how nintendulator works (quietust can comment more on his emu).

mine does the catch up method, in the cpu i count the cpu cycles and catch up the ppu to the cycle read. this works for now. i will try to improve it later.

matt
User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

You're fast, this isn't the first time I've edited my post to have it already replied to ;)

I don't understand your question. I mean running 3 PPU cycles for every CPU cycle that was in the last instruction.
mattmatteh
Posts: 345
Joined: Fri Jul 29, 2005 3:40 pm
Location: near chicago

Post by mattmatteh »

yes there are 3 ppu cycles in one cpu cycle (for ntsc, not pal)

a cpu instruction has more than one cpu cycle. i think you got it right.

so you dont burn your bridges, i wouldnt hard code 1 cpu cycle to 3 ppu cycles. you wont be able to add pal supppor later on.

what do you have started now ?
User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

Right now I've got pseudocode and flowcharts ;)
mattmatteh
Posts: 345
Joined: Fri Jul 29, 2005 3:40 pm
Location: near chicago

Post by mattmatteh »

then i suggest start with the cpu. and the memory functions. and i would update the cpu clock cycles for each cpu cycle needed. get the cpu working.

i think there is a link at the bottom of the cpu page on the wiki, the new wiki.

mine is a double switch statement. i would also suggest this too, as there is less redunant code. you can keep all the addressing modes together and the keep all the instructions together

matt
User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

New questions:

- Are the R,G,B, black background colors from the palette or different entirely? Will something other than $0,1,2,4 really damage the PPU? What do these bits do in monochrome mode? (conflicting information)

-Is it: color mode = background colors, monochrome = emphasis or the opposite or neither?

- I plan to render in real time, pixel by pixel. What would would be the best way for me then to implement a pattern table/nametable viewer? Should I decode the tiles beforehand (ie not render pixel by pixel) and copy them both to the screen buffer and viewer? Would pixel rendering to each be stupidly slow?

-What's the fastest way to fetch pixels?

pixel0 = *palette[((atthi & 0x80)>>4)|((attlo & 0x80)>>5)|((tilehi & 0x80)>>6)|((tilelo & 0x80)>>7)] ?

I notice some emulators use tables to merge bits, could someone please describe a table method?


Thanks
mattmatteh
Posts: 345
Joined: Fri Jul 29, 2005 3:40 pm
Location: near chicago

Post by mattmatteh »

could you start a new thread instead of using a general newbie one? :)
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers »

The damaging PPU thing is a myth, as far as I know. More than a few games used combinations of it (Super Spy Hunter comes to mind, as one that uses all 3 bits at once).
Post Reply