|
Joined: Mar 2001
Posts: 17,215 Likes: 234
Very Senior Member
|
OP
Very Senior Member
Joined: Mar 2001
Posts: 17,215 Likes: 234 |
|
|
|
|
Joined: Feb 2008
Posts: 107
Senior Member
|
Senior Member
Joined: Feb 2008
Posts: 107 |
Long story short: my bad. Both AO and Makaron will produce misaligned reads, it's just I take advantage of Intel CPUs being able to read any memory location for any data size. That means the LSB is always correct, whether you read as-is or align and rotate - and this is what counts for ARM programs. And RBOD will not rotate twice, because it masks address bits before it calls arm7_read_32, so the IF in there is always false. The problem was, I was trying to be smart and since arm7_read_32 does rotation I thought I could kick RBOD out. Bad move. There was a bug in arm7_read_32, it was rotating all right but was not masking the adddress for the read... Didn't notice it at all. Anyway, RBOD is back and stays, arm7_read_32 is fixed just in case. Everything seems to work again. I'll send you new sources via mail because the diff would be bigger then the file itself. Keep a copy though, somehow I no longer feel so confident about this stuff
|
|
|
|
Joined: Mar 2001
Posts: 17,215 Likes: 234
Very Senior Member
|
OP
Very Senior Member
Joined: Mar 2001
Posts: 17,215 Likes: 234 |
Yeah, working with ARM emulation gives me that feeling too Thanks!
|
|
|
|
Joined: Jan 2006
Posts: 3,691
Very Senior Member
|
Very Senior Member
Joined: Jan 2006
Posts: 3,691 |
oh well, at least having two independent source code bases allowed to compare all this stuff and to improve both where needed... it's a win-win situation (even if sometimes a bit frustrating when you keep rewriting small bits and testing tons of instruction on the CPU...)
|
|
|
|
Joined: Sep 2007
Posts: 56
Member
|
Member
Joined: Sep 2007
Posts: 56 |
Right, but the real Gunbird 2 game may not use the same sound driver program as the DSF rip[1]. That would presumably affect if unaligned access occured or not. Try this: boot GB2, dump AICA RAM once it starts playing, and check for the driver version string near the top of RAM. Or alternatively, have AOSDK dump a RAM image, load that into Makaron, and see if unaligned accesses occur.
[1] Most DSF rips use version 2.50 because it's known where to patch that version so it doesn't clear the SH4 command buffer before reading it, and it's assumed the sequence data remained compatible. In order to be more accurate games should probably be ripped with the real driver they shipped with, but in practice that hasn't turned out to make much difference (Neill Corlett's Skies of Arcadia test DSF using the game's driver does seem to sound subtly different from KS's full rip using 2.50 but I could be hallucinating ;-) I can confirm that the Gunbird 2 rip uses the same sound driver as the game. The sound formats it uses are actually incompatible with the ver. 2.50 driver. Byte 4 in the 0x20-byte music data headers is an indicator of the sound data format, so there shouldn't be any major incompatibility issues using a different driver version as long as this value is same. The driver checks this value with what it expects and will reject loading sound data if it is different. Other than Gunbird 2, all of the Dreamcast games I've seen have a value of 2 for this byte (Gunbird 2 has value 1). I've disassembled enough of the manatee driver so that I know how to modify the patches so that they work with different versions. I'll try Skies of Arcadia using the original driver and see if that helps things. The Skies of Arcadia driver is named bonito.drv, so there may be a significant enough difference from manatee.drv 2.50 even though they have the same sound format indicator.
|
|
|
|
Joined: Mar 2001
Posts: 17,215 Likes: 234
Very Senior Member
|
OP
Very Senior Member
Joined: Mar 2001
Posts: 17,215 Likes: 234 |
Yeah, it turns out there was no behavior difference after all between AO and Makaron with Gunbird anyway, so it was all a false alarm on that front. Kinda weird that the DC driver changed that much given how relatively similar all the Saturn SDDRVS.TSK versions were. And I still could be hallucinating re: SoA
|
|
|
|
Joined: Feb 2008
Posts: 107
Senior Member
|
Senior Member
Joined: Feb 2008
Posts: 107 |
Sakura Wars for Dreamcast has some sequenced music too. I've just ripped the files from bonus GD and will send them to KS in a moment. This should be interesting, as it was originally Saturn game but got remade for DC. I assume the music was converted too and wonder what the difference would be.
The MANATEE is 2000.03.03 ver.2.02.05.00.
|
|
|
|
Joined: Mar 2001
Posts: 17,215 Likes: 234
Very Senior Member
|
OP
Very Senior Member
Joined: Mar 2001
Posts: 17,215 Likes: 234 |
I got MAME's ARM core to write correct DISDL/DIPAN values now - unaligned 32-bit reads weren't masking the low bits before issuing the read to do the rotation on, and manatee.drv relies on it. (On the GBA side, that gets Ashita No Joe to boot and play instead of crashing).
Last edited by R. Belmont; 02/17/08 10:04 PM.
|
|
|
|
Joined: Feb 2008
Posts: 107
Senior Member
|
Senior Member
Joined: Feb 2008
Posts: 107 |
So it's the same one that creeped into arm7_read_32? I tested that SUB PC,4 again and found out I got the opcode wrong. In the end this instruction takes 3 cycles just as any jump would. Also, barrel shifter should add .5 to any instruction using register count.
diff -Nru old/arm7i.c new/arm7i.c
--- old/arm7i.c 2008-02-18 00:47:09.000000000 +0100
+++ new/arm7i.c 2008-02-18 00:48:03.000000000 +0100
@@ -335,6 +335,7 @@
if (ARM7.kod & (1 << 4))
{
+ s_cykle++;
// shift count in Rs (8 lowest bits)
if (Rm != ARM7_PC)
w = ARM7.Rx [Rm];
@@ -890,7 +891,7 @@
{
if (Rd == ARM7_PC)
{
- s_cykle++;
+ s_cykle += 4;
// copy current SPSR to CPSR
ARM7_SetCPSR (ARM7.Rx [ARM7_SPSR]);
}
This needs to be patched against the source I've sent via mail. I think there were some Polish leftovers in that code, but just a line or two. I had double definitions and it didn't throw an error on compile. Let me just remind you that ARM7_Execute now needs to be fed with twice the number of cycles you want to run. This is to allow for all those .5 differences.
|
|
|
|
Joined: Mar 2001
Posts: 17,215 Likes: 234
Very Senior Member
|
OP
Very Senior Member
Joined: Mar 2001
Posts: 17,215 Likes: 234 |
Yeah New interesting thing - I put the AICA into MAME and the Naomi BIOS sound test is generating weird values - it's keying on a sample with OCT=0 FNS=0 for the left speaker test, which obviously makes no noise. That's *got* to be an ARM7 bug I would think. The Naomi boot logo plays the appropriate sounds though :-)
|
|
|
2 members (Kale, 1 invisible),
233
guests, and
1
robot. |
Key:
Admin,
Global Mod,
Mod
|
|
Forums9
Topics9,320
Posts121,923
Members5,074
|
Most Online1,283 Dec 21st, 2022
|
|
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!
|
|
|
|