This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Using a software emulator's 6502 CPU model

Using a software emulator's 6502 CPU model
by on (#73737)
Does anyone here know of a past/present project that utilized any particular software emulator's 6502 model for another purpose (i.e. other than an nes emulator)? In other words, someone that chopped out, say, Nestopia's C++ 6502 model and used it for something else?

I realize the question is a bit strange, but I had an idea for using a software emulator's 6502 model to verify my own emulator's hardware model. Unfortunately, there are almost 0 comments in the nestopia code and it's hard to figure out exactly what specific files/classes I would need to just use the 6502 model alone and then write a kind of "wrapper" to interface to it and run some code on it. Then I could look at the software 6502's result and compare it to my hardware 6502's result.

Any insight or recommendations would be appreciated.

Thanks!

Jonathon

by on (#73740)
- I don't remember of any software using a NES 6502 emulator. Perhaps in a Commodore or Atari 2600 emulator..?

- Anyway, looks like you want to get a 6502 emulator to interface into your code, right? Well, I can provide my CPU emulator if you want. No unofficial opcodes are supported though.

by on (#73741)
Didn't some Nintendo-made arcade games use a 2A03 as a secondary sound chip?

by on (#73750)
Zepper wrote:
Anyway, looks like you want to get a 6502 emulator to interface into your code, right?

You got it. Essentially what I want to do is figure out a way to run them side-by-side and compare my hardware CPU to your software CPU cycle-by-cycle.

Zepper wrote:
Well, I can provide my CPU emulator if you want.

Really!? That would be awesome! I'm hoping your code has greater than 10 comments? :) Lol. Haha, even if not you would at least be providing me with the minimal files that I need to run your cpu emulator standalone. Figuring out which few files I need from an entire emulator is half the battle.

Thanks for the offer, look forward to hearing from you. :) I will PM you my email address.
Re: Using a software emulator's 6502 CPU model
by on (#73751)
jwdonal wrote:
Any insight or recommendations would be appreciated.


Mine isn't terribly well commented either, but I'd be glad to help if I can. I've been trying to go through and comment the thing. 8)

Anyway...the code is here if you want to take a look.

by on (#73754)
Thanks NESICIDE! And your model has comments - good job! haha

I'll take a look at this. I want to see Zepper's as well. I like how yours has an instruction cycle count and a ROM model that you interface to. I can see that making things easier to compare with my hardware model. I mean...that could be an incredibly common approach for modeling the CPU or just the way you happened to do it - again, I'm _not_ a software emulator guy so I'm just now semi-learning how all of you emu authors do this "black-magic" stuff. I write tons of C code in my professional job (for satellite and weapons applications mostly), but I seriously wouldn't have the first clue as to how to write an emulator in software. Writing the HDL however makes perfect sense to me. ;)

That's one reason I think it would be so cool to have a software and a hardware model running side-by-side. Then you could take that verification environment and, say, swap out the default hardware CPU model with your own personal hardware cpu model and verify it against the software model. Or, similarly, swap out the default software model with your software model and verify it against the hardware model. Pretty neato, eh? :)

by on (#73755)
jwdonal wrote:
Thanks NESICIDE! And your model has comments - good job! haha


Yes, hopefully someday soon even more comments.

jwdonal wrote:
I'll take a look at this. I want to see Zepper's as well. I like how yours has an instruction cycle count and a ROM model that you interface to. I can see that making things easier to compare with my hardware model.


I think in terms of objects when coding and I've also done Verilog -- I think objectifying things makes thinking about the problem that much easier.

jwdonal wrote:
I mean...that could be an incredibly common approach for modeling the CPU or just the way you happened to do it


Incredibly common, methink.

Anyway, if I can help PM me or find me on FreeNode #nesicide [though I'm frequently "on-but-away"].

by on (#73863)
@jwdonal

- I'm finishing a cleanup, files package and a crystal clear document (readme) about how to interface my CPU core. :)

by on (#73864)
SWEEEEET! :D