This was based on the status infos described in Stef's cdd_inf.txt document regarding the Stop command, which stated that status was 0x0 after that command then 0x9 so I assumed the drive was automatically restarted in leadin area once stopped (and assumed it was also the case on reset when it initializes in stopped state).Genesis Plus GX seems to start in the "reading TOC" (0x9) mode when the system is reset and a disc is inserted.
The BIOS then sends a "stop" (0x1) command, which GX lets the BIOS read back once, and then it switches to "reading TOC" mode again.
This behavior seems to work fine with BIOS but, after analyzing CD emulator controller sourcecode posted by Nemesis, it seems like the CDD status is initialized then stays to 0x0 (stopped) until a TOCT request command is sent (0x2:0x4), which only then causes a CDD status transition to 0x9 (read TOC) if there is a disc in the tray (0xb otherwise).
That transition is not automatic and occurs only after a read command (0×3) is sent. This is confirmed in CDTrac microcontroller sourcecode (actually it seems you can also get this status transition by sending a resume/play command): CDD status remains to 0x9 while TOC is being read in leadin area but also when the drive reaches the end of leadin area. Drive is automatically paused at the start of program area (which corresponds to absolute time 00:00:00) but CDD status remains unchanged until specific commands are sent.I don't see any code in GX that transitions away from "reading TOC" into "playing" (0x1) mode after reading 150 sectors.
Note that there are no such thing as 'reading 150 sectors' while in 'read TOC' status, the leadin area has variable size apparently and the drive is paused when end of leadin area is detected. The 150 sectors thing is the 2s pause at the start of the program area so it's not read in 'read TOC' status.
Are you correctly emulating CDC decoder interrupt (int5) every 1/75s once it get enabled by the BIOS (IFCTRL=0x3A and DECEN bit in CTRL0 enable decoder interrupt and data transfer to the host) ? It has higher priority than CDD interrupt (int4) used to read CDD status and update CDD command and should not cancel it.Anyone have advice?
Normally, once 00:01:74 is reached in CDD status, the BIOS will send a new set of CDC registers write commands (in int5 handler I think) to enable write of sector data to CDC internal buffer RAM and initiate data transfer to the host, then BIOS successively reads data words from CDC host data register.
Also don't forget to update CDC HEAD0-3 registers with the info of current decoded block/ sector as they are read (I think) in int5 handler.