[Prev][Next][Index][Thread]

Re: Nice demo, but why does it die?



Dear Folks,

	A recent letter of mine compared Soft-PC to Executor.  I claimed that  
Executor is much more difficult a task than Soft-PC (and implicitly did the same  
for "Liken", a Mac emulator available for the SPARC).  The letter to which I am  
replying here implies that either I don't understand the issues, or that I am  
misleading you.  Neither is the case.  In the text below, I will refer to  
Soft-PC, Liken, and Executor in some contexts where I'm really talking about the  
developers of same (Insignia, Excellerated, and ARDI respectively).  I believe  
people are more familiar with the products than the companies, so I  
anthropomorphize.

>>THe one thing I'd like to say in response is that:
>>Liken and Quorum both have to emulate the processor, like SoftPC.  The NeXT
>>on the other hand has a 68K family processor.  So instead of emulating the 

>>whole processor you grab the graphics and system calls.  This is a lot  
different
>>than SoftPC and the emulation of a PC on NeXT hardware.  This is the big  
reason
>>that SoftPC is slow.  It not only has to emulate the processor but it has to 

>>intercept graphic calls to the bios and hardware.  A much more difficult job
>>than what's done in Executor.  Liken is the same in that respect.

	Writing a synthetic CPU is not a difficult task (compared to what we're  
doing).  I speak as the designer and major implementer of our synthetic CPU*  
that will be used when we support Executor on other platforms (we will).  There  
are two major ways to go about emulating a CPU:  interpretation and dynamic  
recompilation.  I believe SoftPC uses the latter and Liken uses the former.  The  
former is easier, but to get good speed you usually have to revert to a lot of  
assembly language which makes porting your synthetic CPU difficult.  Insignia  
claims that the biggest speed problems with Soft-PC on the NeXT are related to  
the "BitmapImage" bottleneck and that with NeXTstep-3.0, much of the graphics  
slowness will be alleviated.  I believe them; I know much about the  
"BitmapImage" bottleneck, it plagues us as well (Yes, Executor should be much  
faster if the 3.0 imaging mods live up to NeXT's claims).

	Why is writing a synthetic CPU so much more easy than rewriting the  
Macintosh ROMs from scratch?  Regularity, documentation and bulk are the three  
major reasons.  The implementers of Soft-PC had a more difficult job than those  
of Liken, because the Intel 80x86 architecture isn't as regular as the Motorola  
680x0 architecture, but by and large, a synthetic CPU is a fairly regular piece  
of work (i.e. you design the synthetic environment and implement a bunch of  
routines for manipulating that environment, but "add" is more or less like  
"subtract", which is similar, but not the same as "multiply", etc.).  The 80x86  
documentation is much more complete than is the specification for what various  
"A-line" traps do.  The major source of information for the latter is "Inside  
Macintosh" Volumes I through VI.  Inside Macintosh is often incorrect, but is  
almost always incomplete.  There are other sources of information, but the  
bottom line is that you have a much greater state-space to watch after each  
A-line trap (that's how Mac programs make operating system calls) then you do  
after each synthetic instruction.  Should the first two reasons not be  
compelling, consider bulk.  There are more user callable routines within the  
MacOS then there are instructions in a 80x86.  The routines are significantly  
larger and more complex than the instructions as well.

	Both Soft-PC and Liken have glue that is necessary in addition to the  
synthetic CPU.  Soft-PC needs also emulate the BIOS and Liken needs to emulate  
just enough of the ROMs to be able to use all of Apple's code present in the  
Apple System file that you must acquire to use their product.  Both of these are  
tricky things to do; however they are both miniature versions of what we have to  
do (i.e. BIOS is a major subset of DOS; the portions of the ROMs that Liken has  
to replicate constitute a major subset of the code that we have to support from  
the ROMs and System File).  Remember, Soft-PC gets MS-DOS from Microsoft; Liken  
gets MacOS from Apple (although you have to supply it yourself; I guess they  
don't feel comfortable purchasing it on your behalf).  We have rewritten the  
majority of MacOS-6.

	NOTE:  Several companies have reverse-engineered the BIOS; Phoenix  
Technologies pioneered the legal technique (clean room/dirty room), but several  
other companies have done it.  A few companies have written glue similar in  
scope to what's found in Liken for their Mac compatibility products which, like  
Liken, require that the majority of the MacOS code come directly from Apple  
itself.  I've been told that there are also other companies that have done  
IBM-PC emulators, Acorn for instance, but I don't know; Soft-PC is certainly the  
one that everyone thinks of.

>>I would say that Executor is more in the same line of emulators for the Mac  
that
>>run on the Amiga and Atari, that is same family of processors so instruction
>>set mapping or emulation is not needed.
>>
>>I understand that for the Atari and Amiga you need the ROMS, etc.
>>I'm not trying to take anything away from Executor, I think it's a great 

>>program.  But I also think that SoftPC and Liken were more difficult to write 

>>just because you have the added difficulty of supporting the native processor
>>that the stuff originally ran on through software.
 

	You are mistaken.  We are the first (and currently only) company to have  
released a product that has any degree of binary compatibility with the  
Macintosh that doesn't require any code being supplied by Apple.  If you believe  
"Mac the Knife" in MacWeek 4-6-92, then Apple themselves are having a hard time  
reimplementing their code on the PowerPC.  There are synthetic CPUs of various  
degrees of usability all over the place, as there are reverse-engineered BIOSs  
and various little Mac compatibility things that require Apple code.  The reason  
we are unique is not totally because of fear of lawsuits.  What we've done and  
what we are doing *is* harder than what Soft-PC and Liken do, and that's not  
even taking into consideration the legal hassle of what we do (although Liken  
certainly has concerns similar to Executor).

	For anyone doubting my claims, I suggest one of two exercises that may  
help settle uncertain minds:

	1) Go to your nearest computer technical bookstore and look at an 80x86  
reference, an 680x0 reference and "Inside Macintosh" Volumes I-VI.  Compare the  
sizes.  Read a little out of any volume of "Inside Macintosh" and consider  
carefully the OS routine that they are documenting.  Think about the various  
aspects of the routine that aren't well defined (such as what order to do  
various subtasks in, what happens on an error, etc) and then remember that  
enough of the information therein is wrong to tick off a large number of  
Macintosh software developers, much less someone who is trying to do reverse  
engineering.

	2) Sit back and wait.  We will be on non-68k platforms.  When we are,  
ask about the amount of development time that was spent on the synthetic CPU.   
So far we have been working on the reverse-engineered ROMs for six years.  We  
plan to have fewer people working on the synthetic CPU than the ROMs and we plan  
to have the synthetic CPU out in one quarter of the time.  Since plans can go  
awry, wait until it's shipping; I don't think you'll have to wait for NeXTWORLD  
Expo '92.

	--Cliff


__________________
*I wrote a more detailed explanation of synthetic CPU theory and practice,  
including just what we were doing in a post to comp.sys.next.misc a few months  
back.  I didn't save the article, but it should be available in the archives.