vhelin / wla-dx

WLA DX - Yet Another GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX Multi Platform Cross Assembler Package
Other
548 stars 98 forks source link

Add support for Super FX #390

Closed vhelin closed 3 years ago

vhelin commented 3 years ago

The instruction set looks like it could be easily added to WLA:

https://en.wikibooks.org/wiki/Super_NES_Programming/Super_FX_tutorial

but there are some things that I don't currently understand:

I'm sure plenty of more questions come up if one starts to implement support for Super FX... Or are there any better documents out there?

cr1901 commented 3 years ago

@vhelin You'll want this: https://archive.org/details/SNESDevManual/book2

vhelin commented 3 years ago

Holy moly! Thanks for the link, I'll dig into these books this weekend!

cr1901 commented 3 years ago

Just FYI: SuperFX should support all directives the 65816 backend does- it has the same banking architecture. You could do a much better job than I adding it, but it would be fun to test :P.

vhelin commented 3 years ago

Perhaps we should add support also for DSP-1? I see there are chips called DSP-2, DSP-3 and DSP-4 as well. No docs about them? :)

Ramsis-SNES commented 3 years ago

Super FX support would be fantastic, Ville. :-) BTW, thanks for all of your recent development efforts, much appreciated!

In addition to the Wikibooks site and the dev manual, I'd also recommend Fullsnes, which has tons of information on the GSU-n chip (aka the "Super FX"): https://problemkaputt.de/fullsnes.htm#snescartgsunprogrammablerisccpuakasuperfxmariochip10games

There's also a section on the DSP-n series of chips in Fullsnes (here: https://problemkaputt.de/fullsnes.htm#snescartdspnst010st011preprogrammednecupd77c25cpu23games). Not sure how useful supporting those in WLA would be though, as each and every DSP-n chip is essentially a NEC uPD77C25 with embedded preprogrammed ROM (as well as some internal RAM).

vhelin commented 3 years ago

Thanks for the links, now my next weekends are booked. :D And yes, I'm taking the Super FX support implementation to myself...

cr1901 commented 3 years ago

Re: the DSP chips, @Ramsis-SNES is correct- SNES games access the DSP chip via an API on the 65816 side. Additionally, the DSP is, well, a DSP. It has only "4" instructions OP, RT, JP, and LDI, but each instruction embeds multiple instructions (VLIW).

This is a very long shot, but in principle, a DSP1/2, etc assembler may be valuable for experimentation. The firmware for the DSPs is dumped, and while I won't link them, they are not hard to find. WLA-DX's overlay could be used to compare revisions or try bug fixes/enhancements.

There's two issues I can think of w/ supporting the DSPs:

  1. You wouldn't want to only support "4" instructions, you'd want to support the "microinstructions" inside the "macroinstructions", and then once per line (or some other terminator, like a semicolon?) combine all the microinsns into a macroinsn to determine the opcode. See the "An assembly language OP" paragraph on page 13 of this datasheet: https://datasheetspdf.com/pdf-file/526540/NECElectronics/UPD77C25/1
  2. It's a Harvard Arch... data pointer 0 != code pointer 0.
vhelin commented 3 years ago

Is the Super FX support working as you guys would like it to work? Any changes that needs to be done?

vhelin commented 3 years ago

Hmm, I see some additional information in https://problemkaputt.de/fullsnes.htm#snescartgsunprogrammablerisccpuakasuperfxmariochip10games - I'll fix BGE/BLT etc tomorrow...

vhelin commented 3 years ago

It's been a month and no bug reports about the new Super FX support, so I'll close this...