Make "PS2 Invaders v1.6" by "InPulSe Team" work.
Posted on 2005-10-05 00:00:00
Implemented two more system calls: SifSetReg and SifGetReg.

Also implemented registers in the SIF module. The program plays with registers that have the most significant bit set (ex.: 0x80000000, 0x80000001) though, and I don't know what these are for. I'm just assuming they are some user-usable registers for now.

The program is now stuck at sending a 0x80000002 (Initialize) command to the SIF, then waiting for an "sreg" to be set to something else than zero. Sregs can only be set by the interrupt handler for the SIF0 DMA channel if it receives a 0x80000001 (SetSREG) command.

I was assuming at the beginning that once the SIF received a command, it would reply back to the EE with the same command, but it doesn't seem to be the case for 0x80000002. For added confusion, there's also a 0x80000002 command sent earlier and the only difference between those 2 instances is the value set in the SIF command header: The earliest sets a member to 0, and the latest sets it to 1. So, I'm assuming that this 1 must have a special meaning that makes a 0x80000001 to be sent that changes the value of the sreg. No clue what "sreg" stands for too...

So, I've pretty much set up everything up to the point where I gotta trigger an interrupt on the EE. Of course, this interrupt must be processed by the BIOS or OS first. Then, it's going to be thier responsibility to call the various interrupt handlers. Two things are bugging me though:

- I don't know if I should call the OS directly when an interrupt occurs or have the EE jump normally to the exception vector (0x80000180) and have the OS hook this address.

- And I'm not sure about the way I'm going to call the interrupt handler... I have its address and I can change the program counter to it, but once it's done executing, it needs to come back and reinvoke the OS code. I'll probably need to save the state of the OS just before executing the interrupt routine or something in the lines of this.

I'll ponder those a bit more and I'll try to find a working solution for tomorrow.