-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register numbering for dest1/source2 #1
Comments
Interesting. I don't really have enough data on hand to experiment with this but it does seem plausible. What did you use to get the other disassembly? If you want to experiment, the relevant code is in these places: ghidra-upd77016-lang/data/languages/uPD77016.slaspec Lines 152 to 158 in f812258
ghidra-upd77016-lang/data/languages/uPD77016.slaspec Lines 208 to 218 in f812258
ghidra-upd77016-lang/data/languages/uPD77016.slaspec Lines 761 to 788 in f812258
ghidra-upd77016-lang/data/languages/uPD77016.slaspec Lines 1037 to 1048 in f812258
I don't think I'll have the time to look into this much myself. |
Thanks for replying.
I wrote my own disassembler after the posts of mine that you already found on EEVBlog forum. It’s nothing official.
I achieved what I wanted back then, which was enabling SDHC support in the DSP code. The stock code, and firmware on the main navigation unit, only supported non-HC (4GB maximum) cards from factory.
Now I’ve returned to this to try and get some better performance out of data transfer to/from the DSP and host. It all uses PIO (no DMA for this it seems :/ ) and sometimes the unit chokes and the mp3 playback stutters. The DSP is doing double duty with SD access for the host and MP3 decode. It would be better if some of the PIO data transfer loops on the DSP were tighter. Anyway…What was your motivation for writing the Ghidra SLEIGH implementation? You’ve done an astounding job already.I’m modifying the SLASPEC right now and rearranging the register map.
I’ll probably do a pull request later, if that’s okay? This is the first stuff I’ve done with SLEIGH, so DO please point out my mistakes.
I can send you my binary if you want? I have some hand commented disassemblies as well, but I’m going to be moving to Ghidra now. Much better.
Thank you!
|
The Wii Speak microphone uses it, and some people working on Dolphin emulator wanted to look into it. I don't think anything particularly interesting came of it in the end, but the SLEIGH implementation now exists and it's nice that people are finding uses for it.
I don't think it'd be particularly useful for me, but thanks for the offer. (If there was a publicly available official disassembler or assembler then that'd be useful for determining encodings but it doesn't seem like that exists.) |
Cool. Agree an official assembler/disassembler would be the hold grail. I don't think one has escaped into the wild though. :( Okay, I'm testing dest1 values 0x00-0x1F with some test code...
And here's the dump of the registers I got...
First line seem like valid DP0-7 values. 0x5004 is certainly what we'd expect from the test code DP4 value as it executed the first iterration of the loop. However from our disassemblies we do see 0x10 and 0x14 used consistently, so we can be confident those are the official published register indexes for DMX and DMY. Now my attempt at a similar approach with "system" registers with indexes 0x20-0x3F was not successful. The DSP just crashed. Reading and writing the stack also pops and pushes, which would be fatal. I also tried writing the value back to the same register after reading it, but it didn't like that either. I'll work on a more subtle approach to test one register at a time... |
Okay, with this code I was able to test each register in turn by manipulating the contents of X[0x0AAA]...
And then with a few more tests I have...
A few changes here....
Not sure what registers at indexes 0x28, 0x29 and 0x2A are. But I could read write all the bits. |
Updated dest1 and source2 register mappings. See #1.
Good point. I didn’t actually think to test that. 🤨 The aliasing of 0x30-0x3F is a bit weird though. One might expect aliases of 0x20-0x2F, but instead I got repeats of the single register 0x2F for all 16 locations. I guess it’s could somehow be the fall through case of full decode of the 0x20-0x2E range? Thanks for the merge BTW. |
This is absolutely great work! Well done.
Just one issue I've spotted. and it's with dest1 in fig A-6. I think dmy is 0x14, and not 0x11?
I have this code...
...and it makes absolutely zero sense to be setting STK here, as it disassembles in Ghidra...
Which implies dest1/source2 in fig A-5 is also wrong. And that appears to be confirmed by this code which, from context, is clearly disabling/enabling the HOST IN IRQ in the SR...
...but we get this in Ghidra...
Seems to me the register mappings for dest1/source1 contain 2 completely separate sets of registers, because index 0 maps to both dp0 and sr (if you assume 5 bits)?
Which set of registers is accessed depends on if the instruction is conditional (accesses the various pointer registers), or unconditional (accesses system registers). Either that or you need to consider bit 22 is included as part of the register number for a total of 6 bits?
The text was updated successfully, but these errors were encountered: