Login  •  Register

The time is now: Tue Dec 18, 2018 9:05 pm

Emaculation wiki  •  Delete all board cookies

Post new topic  Reply to topic Page 1 of 1 [ 5 posts ]
Print view Previous topic  |  Next topic
Author Message
PostPosted: Mon Oct 24, 2016 9:52 pm 
Apple Corer

Joined: Sun Feb 01, 2009 4:55 pm
Posts: 255
Before I begin, Sheepshaver's code is here. Sheepshaver hasn't seen much development since Gwenole left. The most significant patch in memory is a patch that allows some Ambrosia games like Escape Velocity: Nova and Ferazel's Wand to run under Sheepshaver. There's also a monitor/disassembler named cxmon, which was recently put into the macemu tree.

Here are some notable places under macemu/SheepShaver/src/ :

/dummy - Empty files used for whenever a component is not available.

/emul_ppc - The original Sheepshaver core. No longer used and is effectively dummied out by sheepshaver_glue.cpp in the below folder.

/kpx_cpu - The current Sheepshaver core.

emul_op.cpp - Emulating various operations that were 68k code in the original ROM.

gfxaccel.cpp - Quickdraw (2D) acceleration, but it only handles some basic functions.

main.cpp - This is where Sheepshaver initializes everything, poking the XPRAM to values expected by Mac OS.

name_registry.cpp - Set up the names for the devices, such as the processors and the ethernet devices.

prefs_items.cpp - Items referenced by the preferences files.

video.cpp - Video emulation.

rom_patches.cpp - Patches for the ROM. There are patches used for New World ROMs compiled in 1998 and 1999, but mainly focuses the Old World ROMs.

rsrc_patches.cpp - Patches based on the OS's resource forks.

timer.cpp - Time Manager emulation. This is an emulation of the Time Manager, but using the Unix functions.

Of course, several files are shortcuts to files in Basilisk II, reusing the audio, CD, and disk functionality from that.

There are also .i files, which are really binaries. To see these in a hex editor and disassemble them easier...
1)Open the .i file up any word processor
2)Replace 0x and , with blanks.
3)Copy and paste into the editor.

The original code for these driver stubs hasn't been found yet and I don't think it was included.

Patterns I've noticed in the code so far:

D(bug("String\n")); <- Used whenever the debug mode is enabled, noting which function was enabled

ReadMacInt32(), ReadMacInt16() <- Trying to read from the emulated Mac's memory.

FindLibSymbol() <- Not common, but it's supposed to be used any time Sheepshaver is trying to find a library within the Mac OS itself.

As for the video driver stub, there are exactly two functions: TheDriverDescription, and DoDriverIO. It's very primitive, being under 512 bytes. I'll check out the other stubs included.

Inside kpx_cpu, you have four folders:

cpu - The main code for the CPU
mathlib - Used for the floating point operations
test - PowerPC regression testing, but it's largely floating point and integer operations... and some AltiVec/VMX ones.
utils - Processor check, but this is largely for the x86 processors

There's also ppc-dis.c, which is a file straight from GNU, and is now being used as the disassembler.

You can also work with a monitor (using the command mon), but you have to manually enable this command in the code.

I plan on adding/commenting on the code more, so stay tuned on this topic.

Also, some new resources:
Mac Process Manager Document

Reply with quote Post a reply  
PostPosted: Wed Nov 02, 2016 3:45 pm 
Mac Mechanic
User avatar

Joined: Tue Mar 29, 2011 8:57 pm
Posts: 184
Location: London, UK
Hello, allow me to add a shy contribution.
I like the way Basilisk II was documented. The document can be found here:

Since SheepShaver and Basilisk II share some components, I'd suggest we shamelessly copy the structure of it and adapt it to fit SheepShaver's description. I don't think that "the documentation" is limited to this and this should be the whole thing, but the document would be a nice-to-have manual nevertheless.

And here I have compiled some of SheepShaver's configuration properties:


You will notice there's nothing about Windows properties and there can be some Linux configuration items missing or too many.

I got many of these properties from the 'prefs_items.cpp' file. Description and usage I took from examples, from Basilisk II and trial and error.


Also, there is a discussion in this forum somewhere about the model SheepShaver reports to the system. It seems it was developed based on the Power Macintosh 9500, which is the model reported. The processor, though, is not the original PowerPC 604, but a PowerPC G4 (it contains some AltiVec instructions).

Reply with quote Post a reply  
PostPosted: Sat Nov 24, 2018 5:05 pm 
Apple Corer

Joined: Sun Feb 01, 2009 4:55 pm
Posts: 255
Massive bump, but it's still pretty important. So, Sheepshaver determines how the emulator functions by a string in the ROM, which is always located at hex address 0x30D064. However, older ROMs have that string at hex address 0x30C064 instead. Only the ROMs that Bauer and Beauchesne had access to are supported. Even stranger is how it seems to rely on a New World ROM located within the OS's hard disk rather than a proper New World ROM.

It also seems that, when first loading in a ROM, rather than loading the whole ROM, it instead only copies the first three MB, which are largely 68k code. The last megabyte is PowerPC code, along with a jump table at the very bottom. So, Sheepshaver has its own routines it can use. This means that there's flexibility as to whether or not to load portions from the ROM, or inject new PPC code for new functionality like the 68k UAE core.

Reply with quote Post a reply  
PostPosted: Sun Nov 25, 2018 12:59 am 
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2300
Location: Emaculation.com
So which ROMs in https://docs.google.com/spreadsheets/d/ ... =840977089 does that mean SheepShaver works with? And I wonder... should we update the load code to check for the proper values and check the alternate address if things don't line up?

Reply with quote Post a reply  
PostPosted: Sun Nov 25, 2018 5:29 am 
Apple Corer

Joined: Sun Feb 01, 2009 4:55 pm
Posts: 255
Here's the thing - Sheepshaver does not check for checksums, just strings. So it doesn't matter how much you change the ROM, so long as the strings is found in its proper place. That said, I don't think there are any hacks of the Apple Mac ROMs.

Anyhow, here are the ROMs that Sheepshaver can work with, among what I have in my collection:

6F5724C0 - Performa 6400 (Alchemy)
6E92FE08 - Power Mac 6500 (Gazelle)
78F57389 - Power Mac G3 (v3) (Gossamer)
79D68D63 - Power Mac G3 desktop (Gossamer)
960E4BE9 - Power Mac 7300 & 7600 & 8600 & 9600 (v1) (TNT)
960FC647 - Power Mac 8600 & 9600 (v2) (TNT)
9630C68B - Power Mac 7200&7500&8500&9500 v2 (TNT)
96CD923D - Power Mac 7200&7500&8500&9500 v1 (TNT)

There's also no ROM listed there with the code name of "Zanzibar".

Here's the others that don't work with Sheepshaver, with the boot string address and codename noted in the ROM.

Boot String at 0x30D064...

2BEF21B7 - Bandai Pippin (Kinka 1.0) (Pip)
2BF65931 - Bandai Pippin (Kinka Dev) (Pip)
63ABFD3F - Power Mac & Performa 5200,5300,6200,6300 (Cordyceps)
B46FFB63 - PowerBook G3 Wallstreet PDQ (GRX)
CBB01212 - PowerBook G3 Wallstreet (GRX)

Boot Strings at 0x30A064, 0x30B064, 0x30C064 0x30D064...

83A21950 - PowerBook 1400cs (PBX 603)
83C54F75 - Powerbook 2300 & PB5x0 PPC Upgrade (PBX 603)

Boot String at 0x30C064...

9FEB69B3 - Power Mac 6100 & 7100 & 8100 (Boot PDM 601)

There's more Macs here that are missing, like the Twentieth Anniversary Mac (Spartacus).

Reply with quote Post a reply  
Display posts from previous:  Sort by  
Post new topic  Reply to topic Page 1 of 1 [ 5 posts ]

Who is online

Users browsing this forum: Google [Bot] and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group