Virtue of converting ASM source to C?

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

lordgalbalan wrote:I thought it already was.
Next join an SNES dev team, and you'll see we're still doing a ton of research.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Nightcrawler
Romhacking God
Posts: 922
Joined: Wed Jul 28, 2004 11:27 pm
Contact:

Post by Nightcrawler »

If the SNES was so well documented you wouldn't be able to write crappy code and have it run in ZSNES when what you wrote was not allowed on the real hardware.
[url=http://transcorp.romhacking.net]TransCorp[/url] - Home of the Dual Orb 2, Cho Mahou Tairyku Wozz, and Emerald Dragon SFC/SNES translations.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.
Kagerato
Lurker
Posts: 153
Joined: Mon Aug 09, 2004 1:40 am
Contact:

Post by Kagerato »

Even if we ignore oddities in the system itself, too many games for the SNES carried add-on chips in the carts for emulation to know exactly how the execution worked. The nice thing about optical disc-based systems is that the disc cannot contain hardware, only software.

Many, if not all, of these damn additional chips have no published specifications. The original documentation for the hardware immensely, immensely helps and it's simply not available.

Sometimes I wonder what it would cost to bribe either Nintendo or the original producer of the hardware for these decade+ old specs. That is, if Nintendo is the type of company to hold onto that kind of information (seems to me Nintendo is).
tcaudilllg

Post by tcaudilllg »

How do you research a cart that you know nothing about? >_<
neviksti
Lurker
Posts: 122
Joined: Thu Jul 29, 2004 6:15 am

Post by neviksti »

lordgalbalan wrote:How do you research a cart that you know nothing about? >_<
?? Are you asking how people reverse-engineer stuff?
That doesn't have a short answer (but I can try if you really are curious). However, I may be misunderstanding your question.
tcaudilllg

Post by tcaudilllg »

Well I have a basic understanding of the concepts of reverse-engineering. Although, I'm not seeing how you can easily trace the operations of as many chips as lie on a SNES cart even with electrical wiring and analysis.
neviksti
Lurker
Posts: 122
Joined: Thu Jul 29, 2004 6:15 am

Post by neviksti »

Usually the major details can be found fairly quickly.
Do the data lines from the ROM go to the connector edge, or through a special chip? This tells you if the special chip is placed between the ROM and SNES, which doesn't have much purpose unless the special chip uses data from the ROM (like the SA-1 which can run code from it)... as opposed to the DSP-1,2,3,4 which isn't between the ROM and SNES, so it can only get data by the software sending data to it.

Similarly other details can be found without too much trouble. The SNES carts really don't have that many chips on them.

Looking at the hardware just gives you a rough over view of what it can possibly do. Which narrows the software search to see what it is actually being used for. Then you check assumptions by accessing the hardware, etc.

There's often a bouncing between the hardware and software point of view to check that assumptions are reasonable, and to eventually confirm ideas. Reverse-engineering isn't just tracing out a circuit board. Even with full schematics you need to be able to home in on the important parts otherwise you get lost in the details instead of learning how the system works.
Dmog
Lurker
Posts: 192
Joined: Tue Aug 31, 2004 6:03 pm

Post by Dmog »

Nightcrawler wrote:We discussed this recently in another topic which slips my mind at this time.

Most people are in agreement that ZSNES's source code has lack of commenting and questionable organization.

The design choice of using assembly was a very good one at ZSNES's concepton. Remember, this was many years ago now.

The problem is what to do about it now. Porting ZSNES to C is like creating an entirely new emulator. That's why current plans only really call for porting a few things such as the GUI.

If you try and port the entire source to C, you are in fact creating an entirely new emulator. That would be an awful lot of work to start a new C based emulator and get it to match what ZSNES is now in terms of accuracy and compatibility and features. No one really wants to spend several years on that project, thus it's continued on in it's current form..
Wouldn't it take quite a bit less time than -several years-? I'm not saying it wouldn't represent a great deal of works, but several years? I mean, the Snes emulation "community" have quite a bit more experience and knowledge than they did when they first started out,no? They're not starting from nothing I mean.

Edit: Of course, if your intend is to make a new -accurate- snes emu, that could take a while indeed. But just creating a "new" zsnes (in C), with all the imperfections and inaccuracies it presently have...well I dunno. I'm not a programmer.
Kagerato
Lurker
Posts: 153
Joined: Mon Aug 09, 2004 1:40 am
Contact:

Post by Kagerato »

ZSNES is a hobby and an interest at best. There's no team of programmers working on it every day. Changes get implemented approximately "whenever the devs feel like it".

It would take years. Extract and examine the zsnes source sometime if you don't believe this.
tcaudilllg

Post by tcaudilllg »

As this discussion appears to have demonstrated, no one wants to rewrite ZSNES in C, and maybe that's not such a bad thing. What would help is a regularly scheduled release of the ZSNES dev team's research work about the workings of the SNES to the public. With this data people who want to program their own SNES emulator wherever or however they want to can, while making sure that they have the latest info about the hardware.
Nightcrawler
Romhacking God
Posts: 922
Joined: Wed Jul 28, 2004 11:27 pm
Contact:

Post by Nightcrawler »

Yes, we definitely could use some updated documents in the scene. Many documents are outdated if not most all of them to some degree.
[url=http://transcorp.romhacking.net]TransCorp[/url] - Home of the Dual Orb 2, Cho Mahou Tairyku Wozz, and Emerald Dragon SFC/SNES translations.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.
Dmog
Lurker
Posts: 192
Joined: Tue Aug 31, 2004 6:03 pm

Post by Dmog »

Kagerato wrote:ZSNES is a hobby and an interest at best. There's no team of programmers working on it every day. Changes get implemented approximately "whenever the devs feel like it".

It would take years. Extract and examine the zsnes source sometime if you don't believe this.
I understand it's a hobby.I didn't say or implied the contrary. But I thought about an emulator like Kega, which got completely rewritten in (unless I'm mistaken) no more than a few months.

I guess it all depends on how much hours a week/months the coder(s) are willing to invest in the project/hobby.
illegal eagle
Savestate Pimp
Posts: 129
Joined: Thu Jul 29, 2004 2:15 pm
Contact:

Post by illegal eagle »

Dmog wrote:I thought about an emulator like Kega, which got completely rewritten in (unless I'm mistaken) no more than a few months.
By the same author? Because that's a big difference...
"Other people can give you more suggestions as I just lost all my motivation to respond further to this post."
[i] - Nightcrawler[/i]

[url=http://www.geocities.com/illegal_eagle_2003/]vSNES v2.00[/url]: My SNES savestate viewer.
Dmog
Lurker
Posts: 192
Joined: Tue Aug 31, 2004 6:03 pm

Post by Dmog »

illegal eagle wrote:
Dmog wrote:I thought about an emulator like Kega, which got completely rewritten in (unless I'm mistaken) no more than a few months.
By the same author? Because that's a big difference...
I believe both Kega and Kega fusion were written by the same author,Steve Snake.
Post Reply