PCEngineFans.com - The PC Engine and TurboGrafx-16 Community Forum

Tech and Homebrew => Turbo/PCE Game/Tool Development => Topic started by: nodtveidt on January 23, 2011, 05:41:15 PM

Title: Accessing the CD system without the system card
Post by: nodtveidt on January 23, 2011, 05:41:15 PM
This was part of the plan for the Street Fighter II' project but it was scrapped. I want to know how to access the CDROM system hardware without using a system card; aka how to control the CDROM hardware on a hucard. Any leads? Or perhaps a system card disassembly?
Title: Re: Accessing the CD system without the system card
Post by: TheOldMan on January 23, 2011, 10:58:17 PM
There's a disassembly floating around on the net. I think zeograd had it on his site. It's only partially commented, but that's better than nothing....
Title: Re: Accessing the CD system without the system card
Post by: nodtveidt on January 24, 2011, 12:23:15 AM
OK thanks for the hint. I did make a disassembly of the system card using dis.exe found on zophar.net not long after I made this post, but zeograd's site seems to have the same thing with some comments. This might be more useful. :D
Title: Re: Accessing the CD system without the system card
Post by: Arkhan on January 24, 2011, 12:36:57 AM
OK thanks for the hint. I did make a disassembly of the system card using dis.exe found on zophar.net not long after I made this post, but zeograd's site seems to have the same thing with some comments. This might be more useful. :D

Yeah comments tend to help with 6502 disassembly, which usually looks like someone just smacked their nuts on a keyboard and saved the file.
Title: Re: Accessing the CD system without the system card
Post by: TheOldMan on January 24, 2011, 01:48:54 AM
Keep in mind that not all of the card is cd-related, either. Bank 1 (the second 8K) is the mml player, and Bank 2 is the line-graphics and math routines. Basically, you just have to figure out whats going on in the first 8K.

And somewhere Charlie has a list of what the cd/adpcm registers control. That will be a big help figuring out how to actually write to the hardware.
Title: Re: Accessing the CD system without the system card
Post by: nodtveidt on January 24, 2011, 03:08:11 AM
Well, this seems to be helping a bit. Been awhile since I messed with the assembler. This is the CD_RESET subroutine reworked for pceas, though I'm not quite certain exactly what it does:

Code: [Select]
CD_RESET:
lda #$02
tsb $1804
ldy #$0a
ldx #$3b
decx1:
dex
bne decx1
decy1:
dey
bne decy1
lda $1804
and #$fd
sta $1804
ldx #$77
decx2:
dex
bne decx2
rts
I'll keep looking at the disassembly for more information. Basically, my aim is to write a microdriver capable of initializing the CDROM system enough to enable redbook playback and access to the ADPCM circuit from a regular hucard. I don't know if any emulators would support this though... YAME probably will because of how it's set up, and a recent build of mednafen might as well... but I doubt Hu-Go! will, and Ootake is only a maybe.

EDIT: Oh, and bank 1 seems to have some important routines too, but it seems that for the most part, it just calls subroutines in bank 0... mainly just cluster subs, probably a convenience measure taken when they were writing the system card software. For example, jsr cb0f during the boot sequence goes to a sub in bank 1 that calls a ton of other subs in one fell swoop, mostly in bank 0. But yeah, most of the "good stuff" is in bank 0.
Title: Re: Accessing the CD system without the system card
Post by: TheOldMan on January 24, 2011, 04:53:49 AM
It's basically a couple of delay loops and a test to see if the cd is ready. $1804 is one of the hardware addresses - that's why It pays to find charlies doc about the hardware. Then you can actually figure out what bits it tests....

And I think the stuff in bank 1 is calling some of the interrupt stuff in bank 0 for the mml player. The player irq hook has to be mapped in all the time (at least part of it), but there's not enough room to keep it all in bank 0. But I Could Be Wrong - it's been a while since I looked at any of the cd stuff.
Title: Re: Accessing the CD system without the system card
Post by: nodtveidt on January 24, 2011, 05:28:23 AM
Well, Charles is on IRC at this very minute so I'll bug him about that. :D
Title: Re: Accessing the CD system without the system card
Post by: nodtveidt on January 24, 2011, 05:59:20 AM
OK... he pointed me to this document:

http://cgfm2.emuviews.com/txt/pcetech.txt

which confirms a lot of what I'm looking at and should be enough to get this ball rolling a little faster. :D
Title: Re: Accessing the CD system without the system card
Post by: TheOldMan on January 24, 2011, 06:25:22 AM
That's the one!. Knowing the reset bit may not help, but knowing the other addresses should make things much easier. Especially the adpcm buffer addresses :-)

Good Luck!

Edit: Thinking about this makes me wonder: What are you planning on doing, making your own CD-System card?
Or..... Uh-oh. Don't answer that question here. Arkhan will pee himself.....
Title: Re: Accessing the CD system without the system card
Post by: nodtveidt on January 24, 2011, 07:25:41 AM
Haha :) nah, just wanting to write a microdriver to allow CD audio playback from a hucard, like SFII' was originally supposed to have. Tom and I did plan on making a System Card 4 which would double the normal RAM to 512KB plus add the extra banks of the ACD as well as implement ISO-9660 compliance (much like the Games Express card did) but we never got around to it.
Title: Re: Accessing the CD system without the system card
Post by: nikdog on January 24, 2011, 10:24:09 AM
Basically, my aim is to write a microdriver capable of initializing the CDROM system enough to enable redbook playback and access to the ADPCM circuit from a regular hucard. I don't know if any emulators would support this though... YAME probably will because of how it's set up, and a recent build of mednafen might as well... but I doubt Hu-Go! will, and Ootake is only a maybe.

Mednafen should do it, even 8.0. Just have to tell it that your HuCard is your cd system card and load the cd you want to use.
Title: Re: Accessing the CD system without the system card
Post by: nodtveidt on January 24, 2011, 11:49:49 AM
That's a great idea... it should work fine. :) I'm about halfway through the process of converting enough of the BIOS functions to support the idea... but I might also have to swipe some code from pceas's cdrom source to make it fully work.
Title: Re: Accessing the CD system without the system card
Post by: MottZilla on January 26, 2011, 05:43:18 AM
Pretty cool sounding project. Where did you hear that SF2CE was supposed to be on CD/have CD audio?
Title: Re: Accessing the CD system without the system card
Post by: Necromancer on January 26, 2011, 06:24:31 AM
Where did you hear that SF2CE was supposed to be on CD/have CD audio?


I remember hearing that rumor from a variety of magazines - here's (http://archives.tg-16.com/archive-four/DW-01-08.html) one of 'em.  Dig that white Avenue Pad 6 with what appears to be a threaded insert for a mini-joystick, like those Gravis pc pads from way back when.
Title: Re: Accessing the CD system without the system card
Post by: MottZilla on January 26, 2011, 01:37:28 PM
I always wish we could have seen a SuperGrafx Arcade CD-ROM game even if it was a port of a Capcom game like SF2 or Strider. Seems like the SG had useful potential untapped as well as the ACD that atleast had some of its potential realized.
Title: Re: Accessing the CD system without the system card
Post by: BlueBMW on January 26, 2011, 02:14:36 PM
like those Gravis pc pads from way back when.

Aka, the best PC game pad EVER! :P  I love those old pads.  I used to play Star Control 2 for Dos with one :P  I've got a spare if anyone's looking for one.