From: <ni...@in...> - 2000-11-28 00:42:57
|
Hi. I am working on porting B2 to MacOS X (Unix + new GUI). Christian suggested I join this list, so here I am. Firstly, the question you must be asking yourself ... Why would I want to emulate a Mac on a Mac? (apart from insanity) 1) Mainly because OS X only supports the emulation of programs that run under OS 9. I have some programs that only work under OS 8.5, some that require a 68020, and some that only work on a monochrome Mac 2) I don't have a copy of OS 9, and I am not planning on buying a copy just yet (hoping that Apple will bundle it at a discount) Here is what I have been doing: * Installed a compiler (OS X PB doesn't come with one by default), and tried to compile Unix source for B2. Config failed, because OS X PB doesn't come with an X windows server by default * I installed a demo X windows server, Xtools. After some fiddling around with the config files (OS X libraries are a bit different) and some header files (missing pthread & nanosleep prototypes), I got a version that mostly worked (some screen bit depths failed, but that may be the X server) * I decided that a port to the "native" windowing system would be of more use to most people (I may also port to one of the free X servers later), so I have been learning about the foundation class libraries (Cocoa) and the developer kit (ProjectBuilder. Nice integrated application for building C, C++, Java and Objective-C, which invokes gcc and gdb to do all the hard work) * At the moment, I have a B2 that outputs into a window at 24bit depth, but that doesn't yet accept input (will do soon), and is really slow (there is a task that draws the frame base into the window a few times a second). If anyone wants to see what it looks like, I will mail the list a screen dump. * The native GUI classes are only in Objective-C and Java. To make my life easier, I decided to go the Obj-C route, but this means that I have a lot of "wrapper" functions defined in C++ land, so that C can call the standard B2 C++ routines. Now, some items for discussion: * The "flavour" of Unix that OS X uses is called Darwin. Any objections to there being a 'Unix/Darwin' directory for the low-level Unix stuff ? (audio, ether et c.) * Since this isn't an X windows port, I really cannot use the Unix directory for video and main. So, is a directory 'MacOSX' at the same level as Amiga, BeOS and Unix OK? * I would like to have the ability to "Interrupt" and "Restart" a hung B2 emulation (most real Macs have two buttons for this). The sensible way to do this would seem to be to define two new interrupt flags in main.h, e.g.: INTFLAG_NMI = 32 // Non maskable interrupt INTFLAG_RESET = 64 // Hard reset and handle those in the emulator. Now, I can see that TriggerInterrupt() sets a bit to tell something else to handle an interrupt, but I cannot see what actually processes the InterruptFlags variable. I also have heaps of questions about the source code (e.g. why does Unix need an XPRAM watchdog? why does Unix use this: #ifdef NANOSLEEP struct timespec req = {1, 0}; nanosleep(&req, NULL); #else usleep(1000000); #endif to sleep for a minute when sleep(60); would suffice?) but they can certainly wait until I have got a bit more code working, and then built against the latest versions (I am using 0.8.1?) -- | Nigel Pearson, ni...@in... | "Reality is that which, | | Telstra NW-D, Sydney, Australia. | when you stop believing | | Office: 9206 3468 Fax: 9212 6329 | in it, doesn't go away." | | Mobile: 0408 664435 Home: 9792 6998 | Philip K. Dick - 'Valis.' | |