How hard would be to code a NES/SMS emulator

Ask anything your want about Mega/SegaCD programming.

Moderator: Mask of Destiny

tomaitheous
Very interested
Posts: 256
Joined: Tue Sep 11, 2007 9:10 pm

Post by tomaitheous » Fri Sep 14, 2007 1:06 am

I don't think you could use the square-wave channels to do the NES's pulse channels for two reasons: one, the NES has adjustable pulse width where the Genesis's chip does not, and two, the Genesis's chip, in the grand Yamaha tradition, uses logarithmic volume levels where everybody else, NES included, uses gradiated volume levels.
I was referring to using the SegaCD's PCM audio system, not the Yamaha chip for square and triangle.

The NES only has 4 square wave duty cycles and it's easy to simulate then as wave samples. As for the NES volume being not logarithmic, I had run into this problem when emulating it on a logarithmic volume audio unit and used a simple lookup table for the differences.

Basic emulating of sweep, envelope, count length (and the linear one for triangle channel) isn't very hard or resource intensive either. Some of the clocks for those effects are twice per frame(1/60) but I had no problem doing them once per frame (skipping a clock cycle like frame skipping).

ElBarto
Very interested
Posts: 160
Joined: Wed Dec 13, 2006 10:29 am
Contact:

Post by ElBarto » Wed Feb 27, 2008 4:07 pm

Little bump of the thread.
Was talking with a friend and he told me that back in the day he wrote a 6502 emu in 68k asm.
He say that on his atari 1040 he emulate an Apple ][ a 50% speed.
I don't know if it can motivate you but here is the code : http://www.db.net/~db/EMUL.S
As long as you keep the copyright you can use it.

This is what he told me :
16:58 <@Dianora> elbarto: on a live ATARI 1040 it was about 50% of a real Apple][
16:58 <@Dianora> 33% to 50%
16:59 <@Dianora> I can't honestly remember
16:59 <@Dianora> I used a lot of tricks
16:59 <@Dianora> and I was just starting to look into two byte emulation when I had to give up
16:59 <@Dianora> i.e. I had an interest in binary compilation
16:59 <@Dianora> It might be fun to get into that again, but I am sure it has been done to death by now. ;-/
17:00 <@Dianora> basically, analysing the actual op codes to do prediction of the proper higher level code to perform
17:00 <@Dianora> what I did here is basically a TIL
17:01 <@Dianora> instead of a subroutine on each opcode decode
17:01 <@Dianora> I jump directly to the next "word" or op code emulation
17:01 <@Dianora> you see what I did here?
17:01 <@Dianora> I jump from one "word" to the next, each "word" is the result of an op code lookup

Post Reply