Page 1 of 1

CD-i Emulator Technical Discussion

Posted: Mon Oct 03, 2005 7:01 pm
by cdifan
The interview just posted here on The Black Moon Project contains some information about the technical philosophy and inner workings of the emulator, but very little detail. If people are interested, I'd be willing to discuss such details here.

This is to be a technical discussion topic; posts about about distribution models, free- and open-ness, ROM files, game files etc. do not belong in this topic.

Posted: Wed Oct 05, 2005 5:52 pm
by Ruekov
CdiFan, in one future will be posible to control with keyboard cursors?
I good control for edutaiment and board games, but bad for control plataform games and similars.
And more, is posible to render the image to opengl or directx? basicly to apply the Scale2x filters, a very implanted emulator image rendering.

Posted: Sat Jan 07, 2006 4:30 am
by ubipetrus
I notice in you interview that you are taking a different approach than merely creating a "virtual CD-i" machine. I would like to know what you mean by that, since I must admit that I also thought that making a "virtual CD-i" machine would be the way to go. Or have I misunderstood your comments? It would seem to me that once you have emulated the hardware, including such things as the 68070 instruction set, registers, memory, as well as such things as the non-volitile memory, four-layer imaging video chip, and so forth, then all one need add is the software and you're there.

But apparently, that is not the way of things, is it?

As I have two fully functional CD-i players at home I am not in any immediate hurry to pick up the emulator, and am willing to wait a season until things get a little further along before attemtping it myself, so I have not bought one. It also seems rather complicated. It's one thing to know theory but quite another to be skilled in working a computer and so many other things necessary to make it all work, as it presently stands. Let's review the inventory:

1) The emulator software itself, which you provide in both 3-minute free demo version as well as the fully functional product for purchase (not to mention the various beta test versions previosuly circulated or in work)

2) The "stubs" (whatever those are)

3) The "link" (whatever that is)

4) The special "null-modem" cable (do all CD-i players have a serial port one can find, and where does one plug the other end of this cable into one's computer?)

5) the ROM player operating system (requiring that one have at least a defunct CD-i player, of any from a certain list of players (one of mine, a Memorex 2200, does not appear to be on your list of players for which you can provide what it takes to use its ROM data))

6) the BIOS (whatever that is)

7) disk images that have to be previously "ripped" from a CD-i disk (or downloaded ilegally from someone else on the net who has already done so)

8) and of course the PC of sufficient capability to host all of this. By the way, what if one uses MAC or Linux systems instead of Windows?

Then, once you have assembled all these ingredients the recipe is still quite complicated, more than I know how to do. I think you can understand why I am holding out for a more cohesive product. However in any event I am pleased to learn of your progress and eagerly await that "more cohesive" product. Since I bought my Memorex 2200 when it was new, I have been a big fan of CD-i ever since. It is an honor to be able to correspond with one of the actual developers of it!

I do have acouple thoughts on the various licensing issues. From what I have read from Philips, if you have purchased the various red, yellow, green, white, and photo-CD books from them, then you have lawfully obtained their propriety information and are at full legal liberty to use it (but obviously not to distribute it of course!) So it wouldn't be merely a matter of CD-i emulators being such small fry as to be ignored by Philips corporate lawyers, but in fact a matter of the lawful use of information you have purchased from them. That would probably mean that you couldn't hand out or sell copies of the source code since Philips propriety information could be gleaned from it, though it should be permissible to make the necessary arrangements for someone working close to you to be able to continue to maintain it.

The Microware operating system on the other hand is something of a different matter. Since that apparently is a "hot property" I can't see them licensing that out to you to sell UNLESS you can find a way (as many software producers do) to control the copies sold, rendering them unuseable to anyone but the person they have been sold to. Convince them to a satisfactory degree that no one is going to be able to take some copy of their operating system which you will have provided to them under this circumstance and use it for anything other than playing CD-i disks on a single PC, and the fee could work out to something reasonable, adding something to the price of your product to be sure, but adding something which I for one would readily pay for, as I believe many prospective customers might also do. I for one wouldn't blink at paying 300 Euros or more for a software package that I can just load on my PC (self-installing) and be good to go for playing CD-i disks straight from my computer's CD-drive.

I do think it would be better to try to find some way to license the ROM data rather than to write your own, not only because of the time it would take (which could detract from the time you might spend on emulating the MPEG-1 capability) but also because any similarity between what you come up with and what they came up with could be contrued by them to be some sort of "copy" from them. So it just seems wiser to work with Microware than against them. Just a thought...

Posted: Sat Jan 07, 2006 6:42 pm
by cdifan
Ruekov, I seem to have somehow missed your post, but I will answer it now. Keyboard control appears to be the single most requested feature (apart from MPEG capability); it's being worked on.

Rendering to DirectDraw might be done at some point, it could have performance advantages. I am not familiar with the Scale2x filters you mention, but that would probably require Direct3D, no? What would be the purpose of using these filters?

Ubipetrus, you are raising quite a number of points in your (quite long) post, to which I will attempt to reply (in another long post).

First, regarding the "virtual CD-i" machine. What you describe is exactly the approach I used, keeping in mind that there are several versions of the various nvram, cd+audio and video chips. This amounts to emulating "virtual CD-i hardware", on top of which you then run the original CD-i ROM software. This is not what I meant with a "virtual CD-i" machine, though.

You have to keep in mind that the Green Book does not actually specify most CD-i hardware except in terms of basic capabilities; it specifies the software interface (API) used to access that hardware. The purpose of most of the ROM-resident software is to map the generic software interface to the specific hardware available (each ROM is tailored to a specific hardware configuration, i.e. player model/revision). This is why they often call the ROM a "BIOS" (Basic Input/Output System); most of it fulfills exactly the same role as the original CP/M BIOS, i.e. hiding the hardware behind a standard software interface.

A "virtual CD-i" machine, then, is one that emulates the software interface and not any particular CD-i hardware configuration (in a sense, their wouldn't "be" such hardware). Such a machine would not need or even support the "BIOS" part of the CD-i system ROMs. And this is in fact the route taken by CD-ice, but in the interview I've described why I believe my approach is better. In short: easier, faster, more compatible.

Your inventory of pieces is exhaustive but misleading: items 5 (ROM) and 6 (BIOS) are one and the same and item 2 (stubs) comes with item 3 (link program). What you absolutely need is item 1 (emulator software) and 5/6 (ROM file) and of course one or more items 7 (disc image files). Items 2/3/4 (link program and cable) are one way to get the ROM file from a CD-i player you own, which is the only legal source. However, more and more CD-i sites are starting to offer ROM downloads, at their own risk.

So the recipe isn't quite as complicated as you say although I agree that it could be simpler. Perhaps a nice HOWTO guide would help here; anybody want to write one?

Regarding Linux or Mac, I have already received several porting offers and such ports will be done at some point, perhaps even this year.

Finally, all Philips-derived players (which includes the Memorex 2200) supply the serial port, and most other players as well. The Memorex 2200 ROM isn't listed because I haven't tested it for compatibility!

On the licensing issues you are more or less right, except for the following. The confidentiality clauses on the Green Book (and probably the other colored books also) are reported to have a limited duration of 10 years, which means that anyone now having a Green Book from 1995 or earlier is no longer bound by the clauses. That should release most former CD-i developers from their confidentiality restrictions. And the emulator sources do not actually give away the Green Book; as described above they implement (several versions of) CD-i hardware, not the software interface!

The ROMs contain more then just the Microware OS9 software although Philips has stated informally that they would not mind distribution of their part. If you or anybody else can arrange a licensing deal with Microware for OS9 version 2.4, by all means do so. However, do not count too much on people's willingness to pay 300 Euros or more; you wouldn't believe the amount of bitching I've seen about the emulator's mere 25 Euros!

Any "copying" charges from Microware against a "ROM rewrite" would be baseless, as no copying would be involved except for public interfaces, quite similar to the situation with Microsoft and WINE. This would fall under the "reverse engineering" and "compatibility requirements" exceptions in the laws of most countries. The rewrite probably wouldn't even be in assembly language, which I understand to be the original language of OS9. And it would probably be somewhat intimately tied to the emulator and thus certainly not work "against" Microware (you might call it working "around" them, however).

I hope this answers your questions!

Posted: Mon Jan 09, 2006 11:28 pm
by ubipetrus
As for the length of my post that just reflects 15 years of being interested in CD-i and having no one to talk to about it. I assume you have also observed the extreme patchiness of my knowlege; I can know a great deal about one thing and yet absolutely nothing about something right next door to it. I appreciate your patience with my ignorance in certain areas. My apologies most of all for my extreme ignorance about the ROM being the BIOS. Too bad there isn't an "egg-on-face" emoticon...
Now that I better understand what you mean by the "virtual CD-i machine" which you are not doing, and what you are doing instead, I must admit I fully agree with your approach. At some point I do expect to be "biting the bullet" to buy and emulator and hopefully contribute in other ways as well.
I notice however that in the list of titles the emulator does or does not support (or to what degree) you only list game titles. I assume that game titles are given priority due to 1) the fact that games are the most challenging test of the emulator, and 2) most of your customer/interest base are primarily interested in playing the CD-i games. However, all of those other titles, the Art History, Music history, museum, and other educational programs are of more personal interest to me, and it would be nice to know if you have had a chance to see just how well those titles are supported. If such titles really are (generally) less challenging than the games then at least that should give you an opportunity to list more titles in bright green (as I look at it today, only "CD-Interlink" and "Frog Feast" are bright green) How about Compton's Encyclopaedia (original base case edition)? or the Art of the Czars?
And getting back to games, I notice Voyeur is not mentioned. This particular game has interested me because of the clever way it simulates full-screen motion by placing the camera in one location (keeping all of the room static) while only having to move the various rather small characters about, thus making it work even on a base case player. I can't tell you how many times I watched it while waiting most impatiently for my first Digital Video cartridge back in 1994!
How well does your emulator deal with those "pre-gap" ROM data audio CD's ("CD-i Ready") such as Mozart, Pavarotti, Prelude, Earth Rhythms, and so forth?
On some other asides, does your emulator as yet address Photo-CD or CD+G?

Posted: Tue Jan 10, 2006 12:44 am
by cdifan
Again several questions :-)

I have focused on testing games because those are, as you say, the titles that people most want to play. But there is nothing title-specific in the entire emulator; in principle all base-case titles should play (except for emu bugs, of course).

CD+G is not currently supported, because it 1) needs a different disc image format (the CD+G info is in the "subcode" data that normal bin/cue images omit) and 2) it uses currently unsupported CD chip commands to read those data. The same goes for pure audio CDs, by the way...

PhotoCD ought to work, it's basically just CD-ROM XA. I haven't tested it, though...

CD-i Ready is not a problem with the emulator per se (The Apprentice is also of this type and it works fine), but it is sometimes difficult to get an image from such discs. CloneCD has worked fine for me. There may also be issues with titles that depend on the disc TOC, because the emulator currently always reports a single CD-i track disc (it doesn't include CDDA tracks in the TOC).

The CD+G and TOC issues should not be very hard to fix, but I think it is relatively low priority. And note that not all player ROMs support CD+G discs anyways!