@splith - definitely Verilog from the start. I honestly can't understand the need for VHDL. Many people say that it forces you to code things more "specifically" to the task (which is good for some designs), but you can do exactly the same in Verilog, just a lot quicker and easier IMHO.
Verilog is as close to C as you can get (SystemVerilog even closer - includes "structs" and "unions" etc.)
Quite often, I've had to convert VHDL code to Verilog just to understand it. Here's a free converter (demo) which does a good job with most of the code...
http://www.sugawara-systems.com/
@-=FamilyGuy=- Thanks for the info. I can see now how libGDR (in nullDC) generates both type of TOC depending on the request.
I think it ignores the SD TOC when it finds a GD. I could have sworn I saw it reading both TOC's though? Oh well, I can confirm this soon.
The GD TOC is actually in "IP.BIN" in the first sector of the ISO file at offset 0x100. This seems to be exactly what is read for the GD TOC data, the only difference is that it is marked with "TOC1" in ASCII before the data.
Yep, this is at the 45150 "physical" sector as you say, which is "FAD" type addressing. With LBA addressing, this is at sector 45000 - it looks like the DC uses FAD addresses quite a lot?
btw, I said "ISO" file and not raw BIN file because the DC only ever sees the pre-processed 2048-byte sectors (also as you said). It's much easier working with ISO files because the IP.BIN part starts at offset 0x0000 like it should. ;-)
The error correction is done internally by the drive, so I'm assuming the extra data is included in the BIN file for completeness?
The extra data (2352-byte sectors) might be required in audio tracks though - the Q channel data is used to determine the playback offsets etc.
Anywho, I think I might need to spoof both types of TOC just in case.
As for the actual GD Emu progress, I finally got around to trying it for real, but it's not very happy.
(Please note: no actual images are being run yet!!)
I can get it past a certain point, but I can't even get the DC to boot to the setup menu. There were many things to sort out in the code because I realized it was trying to access the status register all the time. My code wouldn't let it access the status reg because it was still in a different state.
What it does now is allows access to any register at any point in time (like a real drive would do). This actually simplified other parts of the code and the output is much cleaner, but it looks like it will need a bit of a re-write...
(it gets stuck after the REQ_MODE command, so maybe my spoof data is incorrect for my PAL BIOS?)...
http://imageshack.us/f/535/gdemutesting241111ozone.jpg/
I think the problems now are getting the correct timing for the handshaking signals (interrupts / status bits etc). Basically, I need to add state machines just like in the nullDC source so it outputs the correct signals at the correct times.
It was surprising how many registers need to be emulated just to get to this point. In the end, it's like designing your own CD-ROM controller. :crying:
Still no CF card access yet. My new CF card arrived, but it has the same problem as the 4GB card (always "BUSY"), so there's an inherent problem somewhere. Typical that the old 2GB card didn't have this problem, but I fried it. :evil:
At least it's much easier to switch between Spy and Emu mode now - I can just plug the GD-Rom back in and change two lines in the code to start monitoring transfers again. I'll double-check the data that my PAL DC BIOS is expecting and see if that helps.
OzOnE.