Advertisement

I'm writing an NES emulator

Started by August 16, 2009 01:04 AM
34 comments, last by essial 15 years, 2 months ago
I am impressed.
Now if someone could just create an NES C++ compiler....*geeky drool*...
-----OpenEndedAdventure.com - The Adventure that Anyone Can Edit.
Yeah I'm sure it'd be great fun compiling programs on a 1.7mhz processor with a very small amount of registers and only a 512 byte stack *devil grin*. Although I must say, by the time I finish this emulator I should be well suited for any NES related programming :p I already know 6502 assembler like the back of my hand now for some reason :p
Advertisement
Quote: Original post by essial
Yeah I'm sure it'd be great fun compiling programs on a 1.7mhz processor with a very small amount of registers and only a 512 byte stack *devil grin*. Although I must say, by the time I finish this emulator I should be well suited for any NES related programming :p I already know 6502 assembler like the back of my hand now for some reason :p


Well, I was thinking that you'd write and compile them on a PC and then run them in a NES emulator. But yes, writing something for a small number of registers and a 512 byte stack DOES sound like fun. How does 6502 asm compare to x86 asm. Does it contain most of the same commands, etc?
-----OpenEndedAdventure.com - The Adventure that Anyone Can Edit.
Just have to pop in and write; This is some great reading, I'm looking forward to more!
-----------------------------------------------------www.agonyart.com
There are several 6502 compilers out there for the PC already. And x86 assembler is nothing like 6502 assembler as far as coding goes.

Here's a few things x86 processors have that 6502's (not counting later revisions) don't:
* Memory Protection
* Non buggy JMP instructions (indirect jumps can be screwy if you are dealing with a page boundary)
* Enough registers to not have to mess around with lots of external memory IO

Being an 8-bit processor, it's also missing amazing amounts of useful opcodes; and on the opcodes it does support, there are an extremely limited variety of operands that it can handle per-opcode. 6502 assembler makes x86 assembler feel a million times less restrictive.

Having said that, it sure does make the job of emulating it a bit easier :) And it aint all bad if it can run Super Mario 3, Final Fantasy, and Zelda :)

Oh, and a little tidbit about Final Fantasy on the NES. Apparently it doesn't RTI (return from interrupt) from NMIs. It instead manipulates the stack manually, and calls RSI (return from service routine). Talk about crazy.
Quote: Original post by eld
Just have to pop in and write; This is some great reading, I'm looking forward to more!


Yeah lets hope my first blog actually has people reading it :) Feel free to yell at me if I start getting slack. But theres enough going on to keep the content fresh hopefully. I already posted crap-piles of info today; and the process of writing the posts actually helps me think things through a little better; so maybe it will benefit me as well.
Advertisement
This looks great! I've bookmarked your blog.
It would be really cool that you also added some source code so people could be able to see examples on how emulation gets driven by a specific computer language.
[size="2"]I like the Walrus best.
I've already started doing that; more to come :)
Great!

I have thought about reinterpreting the tile pixel data to do enhanced shading effects or render them in a voxel engine. I would be very interested if the tile graphics renderer part of your or any emulator can be made more modular, free from NES specs, registers, and etc. I have much less interest in.

This topic is closed to new replies.

Advertisement