Emulating Pioneer LaserActive (Mega-LD) games

Moderator: Mask of Destiny

User avatar
Nemesis
Very interested
Posts: 689
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Mon Sep 26, 2011 11:48 pm

After a number of failed attempts, I've had another burst of interest in dumping MegaLD disks over the last week or so, and I've made some progress:

Code: Select all

5345 4741 4449 5343 5359 5354 454D 2020 5350 4143 4520 4245 5253 4500 0000 0001 | SEGADISCSYSTEM  SPACE BERSE.....
5345 4741 2066 7563 6B20 2000 0000 0000 0000 0200 0000 0600 0000 0000 0000 0000 | SEGA fuck  .....................
0000 0800 0000 2800 0000 0000 0000 0000 2020 2020 2020 2020 2020 2020 2020 2020 | ......(.........                
2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 |                                 
2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 |                                 
2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 |                                 
2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 |                                 
2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 |                                 
5345 4741 204D 4547 4120 4452 4956 4520 2843 2957 4152 2020 3139 3933 2E46 4542 | SEGA MEGA DRIVE (C)WAR  1993.FEB
5350 4143 4520 4245 5253 4552 4B45 5220 2020 2020 2020 2020 2020 2020 2020 2020 | SPACE BERSERKER                 
2020 2020 2020 2020 2020 2020 2020 2020 5350 4143 4520 4245 5253 4552 4B45 5220 |                 SPACE BERSERKER 
2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 |                                 
474D 2020 542D 3630 3036 342D 3030 2020 4A20 2020 2020 2020 2020 2020 2020 2020 | GM  T-60064-00  J               
2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 |                                 
2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 |                                 
2020 2020 2020 2020 2020 2020 2020 2020 4A20 2020 2020 2020 2020 2020 2020 2020 |                 J               
(Yes the profanity is on the real disc)

This is far from a complete dumping process yet, but it's a start. What I've done is to allow the LaserActive to start a MegaLD game, then as the game is booting, hijack the main M68000 processor and run my own code, which is in tern able to lock/reset the sub M68000, and read/write its program memory. The above data was obtained simply by dumping out the cached portion of the disk contents from the program ram. The next stage is to write a modified subcpu program back, which will dump each sector of the MegaLD disk, and transfer it back to the main M68000 processor, which will in tern transfer it to my computer over the control port. I have this kind of program working successfully for the MegaCD. What I need to do now is figure out how to modify it to support the MegaLD bios, which as TascoDLX pointed out, is different to the MegaCD bios. Once I've got the few bios calls that I need figured out, I should be able to make an iso image of this game. Once that's working, the next thing to do is try and dump the full sector header, subcode, and TOC data, to make a bin/cue rip of the disk if possible, rather than just an iso. This is possible on the MegaCD, so I don't see why it shouldn't be possible on the LaserActive too.

I'm also very curious to know if this player will actually allow me to rip the analog Laserdisc video in digital form, once I start trying to read past the end of the digital region of the disk. I don't know enough about the laserdisc to know if this is possible. If the pits on the disk have a logical spacing and density, it should be possible. If the actual pits on the disk are truly analog (IE, tracks have no concept of density, it's the speed of the disk and sync pulse that determine where data is read), then it may not really be possible to get a truly complete digital rip, unless there is such a thing as a "minimum" spacing between each bit, and the disk can be read at that minimum spacing. Even if a "complete" digital rip of the disk isn't possible though, it should be possible to get a digital rip of the disk at least at some sampling rate. Of course, if a digital rip of the laserdisc video signal can be obtained, converting that into an actual image is another thing entirely, but if I do manage to dump the data, that's an excerise I'll leave to others.


Once I get a process fully working and proven, I'll be interested in submissions from people who have MegaLD games, who are willing to loan them to me for dumping purposes. I'm not at that point yet, but I'll let you guys know when I am. I'm planning to keep on working at this now until I at least get a complete iso rip of a game, so work can begin on emulation.

User avatar
ElBarto
Very interested
Posts: 158
Joined: Wed Dec 13, 2006 10:29 am
Contact:

Post by ElBarto » Tue Sep 27, 2011 7:21 am

Amazing !!!

Maybe you can try to contact Aaron Giles, he knows a lot of stuff about LD.

TascoDLX
Very interested
Posts: 248
Joined: Tue Feb 06, 2007 8:18 pm

Post by TascoDLX » Tue Sep 27, 2011 8:14 am

Fuck. Yeah. :D
Nemesis wrote:What I've done is to allow the LaserActive to start a MegaLD game, then as the game is booting, hijack the main M68000 processor and run my own code, which is in tern able to lock/reset the sub M68000, and read/write its program memory. The above data was obtained simply by dumping out the cached portion of the disk contents from the program ram.
That's interesting. I never expected a backdoor attack. It's definitely creative.

I had considered writing a program to boot to CD and then manually reload the sub cpu with the LD bios, which is not as difficult as it sounds. Otherwise, I'm sure you could just load it manually using a program on a cart (bootstrap method).

On a related note, I had at one point tried to acquire a LaserActive and Sega PAC in order to do basically the same thing. Unfortunately, I never got my hands on a working PAC. If someone wants to help me find a PAC (recapped and generally functional), I would be more than willing to help out this project.
Nemesis wrote:What I need to do now is figure out how to modify it to support the MegaLD bios, which as TascoDLX pointed out, is different to the MegaCD bios. Once I've got the few bios calls that I need figured out, I should be able to make an iso image of this game.
The LD-BIOS is very similar to the CD-BIOS. Some of the calls are either identical (except for different function numbers) or nearly identical. There may be a few idiosyncrasies or even bugs (yes, there are bugs). Here's a bit of it:

Code: Select all

Equivalent BIOS calls:

<NOTE: This list is incomplete.>

LD-BIOS 0101 [CD-BIOS 0010 : DRVINIT]

LD-BIOS 0102 [CD-BIOS 000A : DRVOPEN]
- d1[in] : 0000 for LD tray, 0001 for CD tray

LD-BIOS 0120 [CD-BIOS 0017 : ROMREAD]

LD-BIOS 0121 [CD-BIOS 0020 : ROMREADN]

LD-BIOS 0122 [CD-BIOS 0021 : ROMREADE]

LD-BIOS 0126 [CD-BIOS 0080 : CDBCHK]

LD-BIOS 0127 [CD-BIOS 0081 : CDBSTAT]
- returns BIOS status only

LD-BIOS 0128 [CD-BIOS 0083 : CDBTOCREAD]
- A0, A1, B0, B1 are special track numbers (probably for video) [likely pairings: A0/A1, B0/B1]

The following LD-BIOS calls are code identical to their respective CD-BIOS calls:
LD-BIOS 013A [CD-BIOS 0087 : CDCSTART]
LD-BIOS 013B [CD-BIOS 0089 : CDCSTOP]
LD-BIOS 013C [CD-BIOS 008A : CDCSTAT]
LD-BIOS 013D [CD-BIOS 008B : CDCREAD]
LD-BIOS 013E [CD-BIOS 008C : CDCTRN]
LD-BIOS 013F [CD-BIOS 008D : CDCACK]
LD-BIOS 0140 [CD-BIOS 008E : SCDINIT]
LD-BIOS 0141 [CD-BIOS 008F : SCDSTART]
LD-BIOS 0142 [CD-BIOS 0090 : SCDSTOP]
LD-BIOS 0143 [CD-BIOS 0091 : SCDSTAT]
LD-BIOS 0144 [CD-BIOS 0092 : SCDREAD]
LD-BIOS 0145 [CD-BIOS 0093 : SCDPQ]
LD-BIOS 0146 [CD-BIOS 0094 : SCDPQL]
LD-BIOS 0147 [CD-BIOS 0088 : CDCSTARTP]
Nemesis wrote:I'm also very curious to know if this player will actually allow me to rip the analog Laserdisc video in digital form, once I start trying to read past the end of the digital region of the disk.
No, it's quite doubtful. The recorded pattern is essentially the PWM form of a heavily modulated AV signal. Short of a crazy hack, we're basically relying on the playback quality of the LaserActive. In that regard, it should be possible (theoretically) to write a simple playback driver and capture the output. But, there's still a lot to do before that happens.

User avatar
Nemesis
Very interested
Posts: 689
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Tue Sep 27, 2011 10:27 pm

The LD-BIOS is very similar to the CD-BIOS. Some of the calls are either identical (except for different function numbers) or nearly identical. There may be a few idiosyncrasies or even bugs (yes, there are bugs). Here's a bit of it:
Awesome! That has all the function calls I should need in order to dump the disk contents, in iso mode at least. I'm going to try and use those numbers and see if I can get my subcpu dumping code working. Thanks, you've just saved me a lot of time!
I had considered writing a program to boot to CD and then manually reload the sub cpu with the LD bios, which is not as difficult as it sounds.
Yeah, I experimented along those lines, but it seemed like it wasn't going to work. The LaserActive player detects whether either a CD or an LD has been inserted, and based on that, the mechanism of the drive physically adjusts itself to read the inserted medium (focal distance seems to be different, so the disk sits at a different height). The PAC doesn't have any control over the LaserActive in this manner, it can just request the drive tray to open/close, and gets told what kind of disk has been inserted. This meant bypassing the normal disk eject/load process and physically switching the CD out for an LD wasn't going to work (I tried, it couldn't read it).

I tried to write a CD-based program that was designed to open the drive, with the intent of being able to insert an LD, and have the drive close, then read from the LD, as you're describing. The main problem was, I couldn't actually get the drive to close! Is DRVINIT supposed to close the drive and read the TOC? Because the command seemed to be completely ignored on the LaserActive. I could open the drive drive tray, but once it was open, I couldn't close it either through software commands, or by physical buttons, or even pressing on the tray. The mechanism would never kick in to retract the tray and load the disk. None of my attempts to do that ever worked at any rate, so I gave up on that method.
Otherwise, I'm sure you could just load it manually using a program on a cart (bootstrap method).
I would definitely like to work towards that method, as it would make things much easier. I don't know enough about the MegaCD to pull it off yet though. I want to get it working before I start ripping any disks on-mass though, as then it's just a simple matter of booting the system and the rip starts straight away. If you know the basic steps to do it, or if you have code that can do it, I'd love to see it.
On a related note, I had at one point tried to acquire a LaserActive and Sega PAC in order to do basically the same thing. Unfortunately, I never got my hands on a working PAC. If someone wants to help me find a PAC (recapped and generally functional), I would be more than willing to help out this project.
Well, since we're not actually booting the games themselves, you could use a PAC-S1 instead (Japanese Sega PAC). They seem easy enough to get on ebay. There's one with a $175 buy it now price and free shipping right now. Not exactly dirt cheap I know, but not too bad considering the ridiculous prices these systems and games for them go for nowadays.

TascoDLX
Very interested
Posts: 248
Joined: Tue Feb 06, 2007 8:18 pm

Post by TascoDLX » Wed Sep 28, 2011 9:48 am

Nemesis wrote:The LaserActive player detects whether either a CD or an LD has been inserted, and based on that, the mechanism of the drive physically adjusts itself to read the inserted medium (focal distance seems to be different, so the disk sits at a different height). The PAC doesn't have any control over the LaserActive in this manner, it can just request the drive tray to open/close, and gets told what kind of disk has been inserted.
AFAIK, the mode is changed depending on which sub bios is loaded. When you attempt to boot a game, the main bios will check with the sub bios to see if an LD is inserted. If not, it will reload the sub with the CD BIOS. The loading process, whether LD BIOS or CD BIOS, is the same as any other Sega/MegaCD bios. This is fairly easy to do on your own, assuming you can locate and decompress the sub bios. Of course, you have to load your SP manually, but that's a minor inconvenience.

The only possible caveat would be if the hardware can't transition from CD mode to LD mode. That's pretty unlikely, but the easy fix is to run your program from cart. The process is pretty much the same either way.
Nemesis wrote:If you know the basic steps to do it, or if you have code that can do it, I'd love to see it.
I'll see what I can do.
Nemesis wrote:Well, since we're not actually booting the games themselves, you could use a PAC-S1 instead (Japanese Sega PAC). They seem easy enough to get on ebay. There's one with a $175 buy it now price and free shipping right now.
I'm a little skittish about eBay because of the leaky capacitor problem. The price is not a big concern to me as long as the risk isn't huge. I would be willing to pay a little extra to someone with PAC repair experience.

User avatar
TmEE co.(TM)
Very interested
Posts: 2307
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Wed Sep 28, 2011 10:50 am

If I wasn't so busy I'd happily replace the caps etc. I would really buy one cheap non working unit and then do a cap replacement.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

LocalH
Very interested
Posts: 152
Joined: Tue Dec 19, 2006 5:04 pm

Post by LocalH » Sat Oct 01, 2011 4:47 pm

Nemesis wrote:(Yes the profanity is on the real disc)
That's absolutely hilarious. I wonder if that carries over to every game. It'd be way funnier if every single Mega LD disc in existence carries the word "fuck" embedded within the header.

User avatar
Nemesis
Very interested
Posts: 689
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Thu Oct 06, 2011 10:38 pm

Just wanted to let you guys know I'm still working on this. I don't have a huge amount of spare time right now, but I spent another few hours on it last night. My attempts to boot the system from a cartridge have been unsuccessful so far. The main cpu does everything I want it to, but when I expect the subcpu to kick in and start executing code, I get nothing. I'm going to keep working on this front though.

As for dumping the games, all I need is to successfully either boot or hijack the subcpu, and successfully read the disk from my hijacked code. So far I haven't been able to do this, but it's definitely possible. Unfortunately, it's very hard to debug when things go wrong. I'm going to focus on getting my subcpu code at least doing something, so I can verify I'm getting control of the subcpu, and then work on the cd system after that.

On another note, my brand new EverDrive flashcart arrived yesterday. I've been using a Tototek cart all these years, so I'm glad to have something that's a little faster to program. It used to take me a few minutes to go through the compile+copy+flash+run cycle for doing hardware tests, but now it only takes 10 seconds or so, and I can do it all from my laptop, so that's going to make this work much faster. Kudos to KRIKzz.

User avatar
Nemesis
Very interested
Posts: 689
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Thu Oct 06, 2011 10:47 pm

Oh, by the way, I was able to confirm this:
Snake wrote:I don't believe the video on LDs is arranged as tracks, just a single big stream, like a VHS tape - but with the ability to seek to any point. For this you're going to need a good capture card.
When I hijack the main CPU while the Laserdisk video is playing, it just keeps on playing quite happily in the background. I watched through all the video for Space Berserker last night. I also have a very good capture card, or at least it was back in the day. When I rip the data for Space Berserker, I'll rip the video stream along with it. I have absolutely no doubt the video will need to be re-ripped later, but if I manage to get the data off the disk, I'll do an initial video rip for the game, as a starting point for emulation.

TascoDLX
Very interested
Posts: 248
Joined: Tue Feb 06, 2007 8:18 pm

Post by TascoDLX » Wed Oct 12, 2011 3:31 am

Nemesis wrote:My attempts to boot the system from a cartridge have been unsuccessful so far. The main cpu does everything I want it to, but when I expect the subcpu to kick in and start executing code, I get nothing.
Kinda wish I had the hardware for testing right about now. You might want to verify the sub bios when you load it. But if the bios is good, the rest would depend on your SP.

I still haven't managed to get a working PAC, not that I've been trying very hard. I have a broken one around here somewhere... still need someone willling to work on it. If anyone is willing to do the legwork, I may offer a finder's fee. I prefer to deal in the US to keep shipping short and cheap.
TmEE co.(TM) wrote:If I wasn't so busy I'd happily replace the caps etc. I would really buy one cheap non working unit and then do a cap replacement.
Thanks anyway, Tiido. If you manage to become unbusy, let me know.

EDIT: I'm no longer looking for a PAC. Just need someone to repair/recap.

LocalH
Very interested
Posts: 152
Joined: Tue Dec 19, 2006 5:04 pm

Post by LocalH » Thu Oct 13, 2011 4:36 pm

So has there been any further thought to the video format to be used? I just want to make sure you don't go the lossless route, it's useless for analog video and will just bloat the file size (since the composite video is already degraded, there's no sense in preserving those degradations loslessly). I recommend either I-frame-only MPEG-2, or MJPEG. Both are mature codecs with wide software support, and both have no concept of dependent frames, meaning that you can seek to any frame with no worries of having to seek earlier and decode multiple frames in order. I would recommend MPEG-2 at either 640x480 with square pixels, or 720x480 with 4:3 DAR.

I just don't want to see 200GB files that mostly contain just nasty-ass NTSC composite video. Now, if we were to somehow gain access to any non-NTSC source elements, they might be worth preserving losslessly (I'm talking like film sources, or possibly even a component source or two).

User avatar
Nemesis
Very interested
Posts: 689
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Thu Oct 13, 2011 10:49 pm

Well, the only capture card I have worth using for analog video is a Canopis DvStorm. The capture quality of the card is superb, but it uses a hardware MPEG-2 encoder, with (to my knowledge) no way to capture the data without encoding it first, so that's what I'll ultimately be ripping to.

That said, in terms of long-term goals, I'm still hoping to get a "digital" rip of the video stream eventually. I'm still convinced it must be possible. Ultimately the video is just data on the disk, and that data has to read back the same way each time with a reasonable level of consistency. Even if there's no error correction, if you can just get three separate copies of a game and rip the data, it should be easy to reconcile any differences due to minor scratches or the like, and end up with a known good dump of the data. The data itself may require something crazy in order to turn into an actual image, but once we have the data itself, it can be done. Even if it takes an hour per frame to decode and we have to simulate the actual video decoding hardware in a LaserDisk player, once we have the data itself, we've got a perfect preservation of the disk, and then we've got all the time in the world to work on the decoding part. If we can decode it at all in software, which we must be able to do eventually, we can then convert it into a lossless video format, for fast and easy playback on a computer, with much better picture quality than a rip of the analog video stream, all the while, keeping the original video data around, in case someone comes along with a better decoder for it in the future.

LocalH
Very interested
Posts: 152
Joined: Tue Dec 19, 2006 5:04 pm

Post by LocalH » Sun Oct 16, 2011 4:42 pm

Nemesis wrote:If we can decode it at all in software, which we must be able to do eventually, we can then convert it into a lossless video format, for fast and easy playback on a computer, with much better picture quality than a rip of the analog video stream, all the while, keeping the original video data around, in case someone comes along with a better decoder for it in the future.
NTSC decoding is pretty high-end as it stands, and there's a limit to how well one can extract the luma and chroma signals. AFAIK, a good 3D comb filter is about as good as it gets, and comb filter are not without their own set of artifacts. Remember, the data written to the disc is a representation of analog composite video in the first place - you will never be able to gain any better quality from the image. Rather than ripping it directly from the disk (which I'm not even sure is possible), if you truly want to preserve the full NTSC composite signal rather than the image contained within, then it would make sense to just capture the signal off the wire, but instead of decoding the video signal, just write the raw bits that the capture hardware samples. A few such captures and one could theoretically average them, as you mention. With a good LD player (perhaps modded for BNC cabling as opposed to RCA, for better interference shielding), you should get pretty much the signal that's on disc, fed to the video output. You might even do well to get an older LD player, one that doesn't process the output video as much (if at all), to get closer to the raw baseband video signal.

I still recommend standard intraframe MPEG-2 capture for use with everyday emulation, at this point, even if you have to capture at a higher bitrate and re-encode it in software (since you want to be able to seek to all frames independently). I'll recommend about 9 or 10 Mbps for both capture and final encoding. Arbitrary NTSC decoding in software can be slow, as it has to work with about 13.5MHz of samples (assuming the LD video conforms to NTSC standards, no reason why it shouldn't though). Most modern PC GPUs can decode MPEG-2 in hardware, and one could use the native hardware overlay for the game graphics.

Misty
Interested
Posts: 15
Joined: Mon Nov 14, 2011 4:08 am

Post by Misty » Mon Nov 14, 2011 4:35 am

Stumbled across this on Google. Fantastic to see this is being worked on!

I actually just bought a good quality LD player and capture card with the intention of ripping the analogue video and audio from my games. I'd be super interested in helping you out, Nemesis.

As far as dumping video from your capture card goes, it's worth keeping in mind that it'll need to be able to capture without deinterlacing. At least a few games (like Blue Chicago Blues and Road Prosecutor) duplex two 240p streams together on opposite scanlines rather than storing a standard 480i image. Since games that use PAC graphics run in 240p anyway, they used it as a way to double video capacity.

Edit: Should add - I bought a high-end player because I wanted the best decoding of video possible, but I forgot just how noisy and badly-mastered most LA games are! I doubt the improvement'll be noticeable over the LA itself. ;) The LA does have a pretty bad reputation as a laserdisc player.

User avatar
Nemesis
Very interested
Posts: 689
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Thu Nov 24, 2011 12:04 am

Thanks Misty, it's good to see there's some interest out there about this. I'm taking a short break from this for now to work on other things, but I'll be coming back around to it in the coming months, so watch this space. If I get a dumping process working for the disks, I'll definitely need people like you who have the actual media to help out with the dumping efforts. The only game I have is Space Berserker.
Misty wrote:As far as dumping video from your capture card goes, it's worth keeping in mind that it'll need to be able to capture without deinterlacing. At least a few games (like Blue Chicago Blues and Road Prosecutor) duplex two 240p streams together on opposite scanlines rather than storing a standard 480i image. Since games that use PAC graphics run in 240p anyway, they used it as a way to double video capacity.
Yikes, I didn't know that. My capture card can capture individual frames without deinterlacing, (IE, grab either the odd, even, or interlaced frame), but I don't know if it can record video without deinterlacing. I'll have to check the settings.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest