-
Notifications
You must be signed in to change notification settings - Fork 7
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
Testing for existence of the GTE #30
Comments
Came up with a very quick test case using the function you've provided (slightly modified to set bit 30 of COP0.r12):
And this yields the following result:
Which seems to indicate that the IOP has the GTE. I will push a branch with the code later. |
Very nice! Can you maybe test what happens if you don't set the COP0 bit, too? |
Well, that's interesting. I guess that means we need a set of tests for all the GTE ops. Do you know if there's any architecture docs for the GTE instructions? I'd probably want to create an "assembler" like with the VU. -[Unknown] |
@Kingcom If the bit is not set, the CPU throws a coprocessor unusable exception. |
Here's the code for reference purposes: https://github.com/jpd002/ps2autotests/tree/gte_test/tests/cpu/gte. For GTE instructions, there's this documentation that I know of, but I'm not sure about its completeness: http://psx.rules.org/gte.txt. |
Thanks a lot you guys :) |
@unknownbrackets I don't expect the IOP GTE to differ from a regular PSX. They use it in PSX mode, after all. People in the PSX dev scene would surely like it though. They're saying GTE isn't very well documented: http://www.psxdev.net/forum/viewtopic.php?f=70&t=551&start=40 |
Regarding the MDEC, it's prolly the upper left here: https://i.imgur.com/gsxPq5i.jpg :) |
Thank you for finding this out guys :) I was pretty sure this was the case, had no proof of it though and subsequently got my addition of it in PCSX2, now I have no reason not to put it back in again for the long quest of PSX emulation :) |
By the way is it already known if PS2 has MDEC or not? |
Yeh MDEC would be interesting to know or if that is fused to another unit in some way. |
Reading from I'm not quite familiar with the MDEC, but I'll see if I can come up with a better test. |
Thanks for the docs, @ADormant ! |
I messed with sending some data to the MDEC control register and MDEC data register, and aside from reset, garbage also affects it. The results are repeatable. For example, writing And, My test (using #include <stdio.h>
#include <tamtypes.h>
static volatile u32 *MDEC_DATA = (volatile u32 *)0x1F801820;
static volatile u32 *MDEC_CONTROL = (volatile u32 *)0x1F801824;
int _start(int argc, char **argv) {
printf("-- TEST BEGIN\n");
printf("Control: %08x\n", *MDEC_CONTROL);
printf("Data: %08x\n", *MDEC_DATA);
*MDEC_CONTROL = 0x40000000;
printf("Control: %08x\n", *MDEC_CONTROL);
for (int i = 0; i < 10000000; ++i) {
if (*MDEC_CONTROL != 0x80040000) {
printf("Control changed: %08x\n", *MDEC_CONTROL);
break;
}
}
*MDEC_DATA = 0x12345678;
printf("Control: %08x\n", *MDEC_CONTROL);
printf("Data: %08x\n", *MDEC_DATA);
printf("Control: %08x\n", *MDEC_CONTROL);
printf("-- TEST END\n");
return 0;
} -[Unknown] |
The GTE test works in PCSX2 now :) https://github.com/PCSX2/pcsx2/blob/master/pcsx2/ps2/Iop/IopHwRead.cpp#L310 DMAs are going to be for SIF2 to handle. You can invoke it with WriteFifoSingleWord() / ReadFifoSingleWord(); |
Some more PS1 hardware tests I don't know how feasible it is to run all of these on a PS2. But these tests have been used to compare PS1 emulators http://emulation.gametechwiki.com/index.php/PS1_Tests |
Probably possible now on PCSX2, gregory has recently implemented IRX running support PCSX2/pcsx2@c00b427 this puts the EE idle and runs the IRX directly, we don't make the COP2 bit of the control registers mandatory for GTE support, so it will probably just work lol |
The tests I linked are pre-compiled PSX EXEs, which have a different header to IRX files. |
oh yeh, they're exe's, forgot about that, damn, nevermind, they would probably need to be put on a psx format cd and executed that way for pcsx2, invoking the ps1 emulation, but that's the only way they would execute currently :( |
The PSX had a Geometry Transformation Engine as COP2 for basic linear algebra calculations. It would be interesting to know if it still exists on the PS2's IOP, or is potentually emulated in software.
To enable the GTE, you first need to set bit 30 of COP0.r12.
Here is some sample code for using it, which calculates the weighted average of two color vectors: http://pastebin.com/0S3wGed9
The signature for the function there is
void LoadAverageCol(unsigned char in1[3], unsigned char in2[3], long weight1, long weight2, unsigned char out[3]);
Note that the last parameter is passed on the stack.
The text was updated successfully, but these errors were encountered: