Mac OS on the PSP? Well, maybe. Major cheating involved.

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

neisha
Posts: 8
Joined: Fri Sep 30, 2005 11:07 pm

Mac OS on the PSP? Well, maybe. Major cheating involved.

Post by neisha »

Hi! I wanted to introduce myself to the forum and get some criticism on something I did as well. The meat is in the last paragraph, if you don't particularly want to hear me ramble about myself.

I'm a lifetime computer game programmer, I guess you could say. It's all I ever wanted to do since I was about 5 (21 now) and I started learning as soon as I could! Which was, um, a few months after I decided I wanted to do it. Most of my work has been independent, since I don't believe in doing things the proper way (read: I think four years of college to learn what I could in one year is a waste of time), though I've had a chance to romance various companies including the occasional console maker. Sadly it's all been contracting work, but ah well. *sigh*

Recently I'd been at a loss for inspiration. By a twist of fate I happened to be around the very moment that the downgrader was being completed, around the very people who were working on it, and I guess it inspired me, because within a very short time I was in the store buying my PSP. For hobby programming (see, there's work programming as well as hobby programming, for me) I've been doing GBA and DS stuff over the last ten months or so, and I'd be interested in shifting gears and learning more about the PSP. At this point, I know absolutely nothing, make no mistakes about that. :) Around this time in 2003 I turned down an offer from Sony for a free dev kit, and I'm regretting it a little, though I probably wouldn't make anything Sony would want me to make anyway. My primary goal at this point is to develop or take advantage of existing GUI libs for the purpose of writing a general interface to accompany ports of fun things like Gaimlib. In other words, I'm heavily focused on app devel at this point.

As to what I'm looking for crits on, I spent a few hours yesterday trying to think of something "neat" to do within an extremely short timeframe. For the GBA, it was writing a remake of the FF6 airship steering interface in half a day. For the PSP, it was.. emulating Mac OS. XD *giggles* I've posted screenshots and info at http://www.digital-yume.net/neisha/ which you can feel free to peruse. ^^; All in all, it's pretty shameful to even say this is a "hack", but there's nonetheless something special about having something like this actually *running*, you know? I was wondering what people thought - is this in the spirit of this particular homebrew dev scene, and would a true port of vMac or Basilisk (etc) be something I should try to organize? Just curious, mostly.

Thanks for reading. :) I hope you'll welcome me.
User avatar
ChaosKnight
Posts: 142
Joined: Thu Apr 14, 2005 2:08 am
Location: Florida, USA

Post by ChaosKnight »

I've had a similar history to you, and your story and project have inspired me to want to work with you on this. I was looking for a PSP project and porting something like basilisk would be incredibly fun.

Count me in if you do start a port, if you don't I'll work on it myself. I'll send you a PM with more detailed information just in case.

Note: I would have only PMed this, but hopefully this message will inspire others to help as well.
w00t
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Boot time is approximately 4 hours using default CPU settings.
Haha, I love it! :)
neisha
Posts: 8
Joined: Fri Sep 30, 2005 11:07 pm

Post by neisha »

Chaos, you're tempting me. ;) I originally was going to flatly refuse to actually work on something like this, but the fact that you're inspired inspires me! ^^;;

Also, after doing some poking around, it turns out that there's apparently a R4000 port already out, though it's for IRIX. Certainly that could be used as a base. Another thing is the dynamic-recompiler-patch for Basilisk, which might actually make running a Mac bearable. Both the MIPS port and the JIT compiler are linked from the main site.

In case you're not extremely familiar with Basilisk, by the way, it can emulate computers about 10 years more recent than the computers that vMac can emulate, and can do color and OS 8 as well. I originally tried getting an emulator for OS 8 to work on the PSP, but PSPbochs only supports VESA 1.2, not 2.0. And the original goal, of course, was to get something done in under 6 hours. :)

Please do continue discussing details about this in the thread. This *is* the development board after all, right? ^.- I think it would help a lot to have every quirky idea available for public dissection, no? :)


Food for thought:

Currently, vMac runs in PSPbochs and takes 4 hours to boot. PSPbochs is admitted by the author as being miserably slow, especially because the graphics scaling and rendering routines are all completely soft-coded. Let's assume that it'll run twice as fast with proper acceleration. The Mac now takes 2 hours to boot.

The fact that we're running an emulator within an emulator probably slows things down, oh, tenfold. 2 hours = 120 minutes, so running a graphics-accelerated port of vMac at ten times the speed ought to be about 12 minutes to boot, using such a cruddy guess. Not bad.

Finally, let us consider that vMac is SLOW, the slowest out there. Hell, Bochs is so slow that it's pathetic, primarily because of it being designed open-platform and the port devs being lazy. Forgot to account for that. ;)

Tell me I'm crazy, but I'm betting a finished Basilisk port with dynarec could boot in 7 minutes. If we set the PSP to 333MHz, I bet it could hit 5.

If you look at the fact that it takes about the same time to boot an older emulated Mac as it does to boot Windows 95, you can prove the "equation" (heh, yeah right) by considering the assertion that PSPbochs would run 2x what it does currently if properly accelerated. Since it currently takes W95 10minutes to boot in PSPbochs, that would be 5 minutes. W95 = 5 minutes ; OS7 = 5 minutes.

Not bad, eh? ^^; ... In theory.


BTW, if anyone actually *wants* the (messy!) disk image I threw everything onto, just point me to a host. The image should compress to around 30MB, though it takes up 100MB when uncompressed.
Last edited by neisha on Sat Oct 01, 2005 3:39 am, edited 1 time in total.
zigzag
Posts: 129
Joined: Wed Jan 26, 2005 2:11 pm

Post by zigzag »

Basilisk would be great on the PSP, and I guess an on screen keyboard would do!
neisha
Posts: 8
Joined: Fri Sep 30, 2005 11:07 pm

Post by neisha »

Question, out of the blue - has anyone heard of the BAT, or something like it? (http://www.enablemart.com/productdetail ... 85&dept=24)

Chord keyboards, if I recall, can work on 5 keys. We have ten primary keys on the PSP, plus an analog stick. You only need one button to click, three at most.

True, those things are a bitch to learn, but I'm willing to bet that someone somewhere would appreciate having an alternative to a bulky keyboard addon or an onscreen one, just like some people still buy Duo memory sticks - cause they don't want their "portable" game system to start growing into a walrus.

For that matter, though - recall I've had my PSP for a day - does T9 even exist?

*shrugs* I'm gonna go sit in my corner and be quiet now. o.x Too many ideas and no way to know what's good and what's junk.
User avatar
ChaosKnight
Posts: 142
Joined: Thu Apr 14, 2005 2:08 am
Location: Florida, USA

Post by ChaosKnight »

Actually I was so excited I downlaoded the Basilisk II source code and am fairly close to getting it cross-compiled. I'm using mostly the dummy functions right now and a good part of the emulation is actually cut out until I can get all the video working, but I guess the news is that I am in fact working on this.

Well, I'll go back to getting it running.
Cheers!

-- EDIT --

Currently I am having trouble getting this code to compile:

Code: Select all

ENUMDECL {
Dreg, Areg, ...
} ENUMNAME (amodes);
The error is invalid function declaration. Does anyone have suggestions? This is just part of the UAE 68k emulator, so nothing Basilisk-specific.

-- EDIT --

Fixed. Just needed to:

Code: Select all

#define ENUMDECL typedef enum
#define ENUMNAME(name) name
-- EDIT --

New problem... math.h exists, but it doesn't seem to link the math functions correctly. Is there a known workaround in PSPSDK for this?

solution: make a LIBS = in your makefile

Code: Select all

LIBS = -lm -lstdc++
w00t
neisha
Posts: 8
Joined: Fri Sep 30, 2005 11:07 pm

Post by neisha »

Hey hey, gonna try to IM you and see where you're at. ^^; I'm supposed to be packing for my move, but I suppose I can spend a *little* time on this, eh? :D

By the way, do you know of Naoki? Just wondering if you are *that* ChaosKnight. That would be so creepy if you were - I hung around you a few times!

PM'ing you a link with extended contact information for me.
User avatar
ChaosKnight
Posts: 142
Joined: Thu Apr 14, 2005 2:08 am
Location: Florida, USA

Post by ChaosKnight »

neisha wrote:By the way, do you know of Naoki? Just wondering if you are *that* ChaosKnight. That would be so creepy if you were - I hung around you a few times!
Sorry, differant ChaosKnight. It seems to be a popular handle.

Anyway, after much ado, I finally got a build to completely compile* for the PSP and then lost my VNC connection to the computer I was working on. Seems to have gone a little screwy. I guess I'll have to pick back up on Monday.

*By completely compile I mean without doing anything other than compiling. Most everything is dummy functions, I haven't tried firing up the emulator, at -most- it should be sort of a hello world type app. But with a full mac emulator waiting to be used behind it. (Now's the fun part, filling in the missing pieces like filesystem, rendering, input, etc...)
w00t
neisha
Posts: 8
Joined: Fri Sep 30, 2005 11:07 pm

Post by neisha »

Oh, okay. I was wondering, cause of the RO avatar, and everything. The ChaosKnight I know is the head of a guild (I think?) in the game.

I've been busy getting absolutely nothing done, unfortunately. I have a really bad cold for one, and for two you have no idea how much attention this is getting. O.o; I just wish they'd stop crediting me with everything, since you've been doing most of the work! ^^;;;

I'd love to see what you've got going on, especially since I've had experience with that particular emulator and could probably get things working. I'm not sure if I'll wait to see your source, or if I'll work on it this weekend.. what are your thoughts? Waiting till Monday sounds like forever. ;____;

Oh, and, just for the heck of it, I posted the stuff necessary to run the demo on the website.
User avatar
ChaosKnight
Posts: 142
Joined: Thu Apr 14, 2005 2:08 am
Location: Florida, USA

Post by ChaosKnight »

neisha wrote:I'd love to see what you've got going on, especially since I've had experience with that particular emulator and could probably get things working. I'm not sure if I'll wait to see your source, or if I'll work on it this weekend.. what are your thoughts? Waiting till Monday sounds like forever. ;____;
Agreed. I'll try to drop by work tomorrow and upload what I have. PM me with a host of your choice. For the most part it should make, I think there is just one last issue concerning the program strings, but that's a super-quick fix. Oh and if you don't have a host, just let me know and I'll put it up on mine.

P.S. I don't care about credit, i'm just doing this for fun.
w00t
neisha
Posts: 8
Joined: Fri Sep 30, 2005 11:07 pm

Post by neisha »

Awesomes! I'm glad you're willing to bother with going to work and everything. ^^; I don't really have a host that I can set up an actual account for, unfortunately. However, email would work (the dyume one has no limitations), or you can upload to whatever you use.

*smiles* Thanks for bothering. :)

(p.p.s. I don't care either, but if it becomes an issue I think it should be at least fair. o.x)
nevyn
Posts: 136
Joined: Sun Jul 31, 2005 5:05 pm
Location: Sweden
Contact:

Post by nevyn »

Interesting project. Chaosknight, how about adding your port to the ps2dev svn?
User avatar
ChaosKnight
Posts: 142
Joined: Thu Apr 14, 2005 2:08 am
Location: Florida, USA

Post by ChaosKnight »

nevyn wrote:Interesting project. Chaosknight, how about adding your port to the ps2dev svn?
Will do just as soon as it actually runs the main emulation engine. I figure if the project has a functional UAE (68k emulator) and some very basic video functions then people will really get excited and start contributing. I expect the most work will go into the filesystem and rendering. Sound and input (other than mouse) could come later.

I couldn't make it to work today to get my code and I definately will not be able to tomorrow, so I'll post an update Monday. Hopefully by then the 68k emulation engine will be running and outputting some debug messages.
w00t
zigzag
Posts: 129
Joined: Wed Jan 26, 2005 2:11 pm

Post by zigzag »

If you guys need an FTP account to do this, no problem, let me know.
rinco
Posts: 255
Joined: Fri Jan 21, 2005 2:12 pm
Location: Canberra, Australia

Post by rinco »

ChaosKnight wrote:I expect the most work will go into the filesystem and rendering. Sound and input (other than mouse) could come later.
It might be worthwhile investigating the SDL support in Basilisk.

The gu-assisted video rescaling in psp SDL will remove the need for a software scaler. I'm sure if Zi posted his source diffs to Bochs (hello GPL), then we could find out if it really does go twice as fast with hw acceleration (I bet it won't).
neisha
Posts: 8
Joined: Fri Sep 30, 2005 11:07 pm

Post by neisha »

Props for the GPL comment. :P Glad someone had the nerve to say it.

As far as I know the Bochs port doesn't even use freaking blitting. Does snes9x, even? Remember that I'm still a newb, even if I've been doing some reading. ^^; The slowdowns I was seeing were characteristic of redraw slowness, though - AFAIK text mode emulation is not per-pixel, only the manifestation of it, so any lag there would be the graphics engine's fault.

Anyways, just curious if you're having any luck with that code, Chaos. :D It's 2PM here so I don't expect to hear anything for several hours, but can you blame a girl for being anxious? :)
User avatar
ChaosKnight
Posts: 142
Joined: Thu Apr 14, 2005 2:08 am
Location: Florida, USA

Post by ChaosKnight »

Ok. I've been messing with this pretty much all day and a lot works but some important stuff doesn't.

What works:
1) It compiles. (and nicely)
2) It reads the ROM from the root of the memory stick. (ms0:/mac.rom)
3) It does a lot of initial memory configuration and etc.

What doesn't work:
1) The last step before emulation starts (rom patching) has a weird issue where it will hang (i'm guess trying to access a bad memory location) and after a few seconds will turn off the PSP (possibly due to some watchdog timer in hardware or software).
2) There are no drivers for audio, video, input, nothing. It's not even really emulating just yet as not all of the prerequisites (loading ROM) are complete.
3) It doesn't exit properly. (dunno what the deal is with that.)

So... sorry about the slow progress, but it's better than nothing. This is a link to the tarball, yes I develop in linux (sorry windows people I hope your environment is setup ok for that.) You should just be able to cd to /BasiliskII-0.9/src/PSP and run make. Be sure you have a macintosh rom in your root memory stick folder called mac.rom or it will just let you know that you don't have one. I did not include a ROM you will have to figure out how to dump it from a mac yourself. Mine is a 1MB ROM from my Quadra 900.

Oh, and there is an EBOOT.PBP compiled and ready in there already. So for those of you who like black and white texty screens that take up a lot of room on your memory stick (900K for the emulator + ~1MB for the ROM) feel free to download it.

http://www.animezilla.org/BasiliskII-0.9.tar.bz2
w00t
neisha
Posts: 8
Joined: Fri Sep 30, 2005 11:07 pm

Post by neisha »

Yayyu!

Took a look at it and started chipping away at it. @_@ (Bad Neisha! There's time for that after you get everything packed. x.x)

Posting an update about this. ^^
holger
Posts: 204
Joined: Thu Aug 18, 2005 10:57 am

Post by holger »

ChaosKnight wrote: What doesn't work:
1) The last step before emulation starts (rom patching) has a weird issue where it will hang (i'm guess trying to access a bad memory location) and after a few seconds will turn off the PSP (possibly due to some watchdog timer in hardware or software).
Have you installed an exception handler? This may help to track down the problem...

ChaosKnight wrote: 3) It doesn't exit properly. (dunno what the deal is with that.)
Maybe you may want to take a look on one of the psp-setup.c files in the pspsgl/test-*/ directories. They handle all the exit handler voodoo for you and even install an exception handler, you can use your code now almost unchanged from the desktop version...
Last edited by holger on Tue Oct 04, 2005 11:19 pm, edited 2 times in total.
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Post by Arwin »

neisha wrote:Question, out of the blue - has anyone heard of the BAT, or something like it? (http://www.enablemart.com/productdetail ... 85&dept=24)

Chord keyboards, if I recall, can work on 5 keys. We have ten primary keys on the PSP, plus an analog stick. You only need one button to click, three at most.
You mean something like p-sprint? :) ( The thing I made you also have in dosbox and I also hacked it into microwindows)

http://forums.ps2dev.org/viewtopic.php? ... ht=psprint

It's been tested and is great to use in emulators together with an OSK. Unfortunately, not too many coders get the benefits yet I think. :D
True, those things are a bitch to learn
That's the biggest complaint about p-sprint too, yep. :D But you never use more than twice the keypresses you'd use on a normal keyboard, and I challenge any other system to match that.
, but I'm willing to bet that someone somewhere would appreciate having an alternative to a bulky keyboard addon or an onscreen one, just like some people still buy Duo memory sticks - cause they don't want their "portable" game system to start growing into a walrus.
That'd definitely be me. :) At least preferring it to an onscreen one. The SCUMMVM guys considered it but had a list of other priorities and keyboard input isn't too important in most of their games of course. The author for CaSTaway considered it, and I sure hope he does it because on the Atari ST emulator, like the Apple emulator, it would rock.
For that matter, though - recall I've had my PSP for a day - does T9 even exist?
Not quite in the way we're used to. I designed it for p-sprint, but then noticed that with the current setup, I actually didn't really need T9 (the dictionary part that is). The downside of something like T9 is that it requires some kind of graphical feedback, so it's more intrusive. But I'm considering doing something. I've designed it into a PC concept version of p-sprint where it seemed to work pretty well - especially when you use one only for say 4000 frequently used words, selectable also by word-length.
*shrugs* I'm gonna go sit in my corner and be quiet now. o.x Too many ideas and no way to know what's good and what's junk.
I would look at p-sprint and at CaSTaway. The Atari ST is a very similar machine in some ways to the Apple, so some ideas could definitely be shared. P-sprint was designed to work with the face buttons, where the analog stick and the rear buttons are reserved for mouse emulation.

That's a good setup and I would start with that, because it is great for the early phase (no on-screen keyboard required) and really easy to include in your project - just add a few lines of code to your mouse handling code and presto (I made it as a fairly neat library package).

In the meantime I think I'll finally start working on a typing tutor for p-sprint, as I'm sure that could sway a lot of non-believers.
User avatar
ChaosKnight
Posts: 142
Joined: Thu Apr 14, 2005 2:08 am
Location: Florida, USA

Post by ChaosKnight »

holger wrote: Maybe you may want to take a look on one of the psp-setup.c files in the pspsgl/test-*/ directories. They handle all the exit handler voodoo for you and even install an exception handler, you can use your code now almost unchanged from the desktop version...
Thanks. This actually helped out a lot. I haven't been able to fix the problem yet, but now I don't have to go through a myrid of builds to nail down the problem.

-- Edit --
Ok, the emulator is emulating. There are no drivers yet (although I did throw some framebuffer code at the video driver, which it scoffed). So now for the fun part. No more exceptions! Yay!.
By the way, it turns out that malloc spaced out my allocations a bit more than Basilisk wanted so the fix was actually to just malloc a big block of memory and point at it.
w00t
User avatar
ChaosKnight
Posts: 142
Joined: Thu Apr 14, 2005 2:08 am
Location: Florida, USA

Post by ChaosKnight »

Of course there's a link. Same as before, that link includes both source and a compiled PBP. Much more boring now that debugging text is turned off. It now just sits there. Has the updated exit code (which worked for awhile) but that stopped working when the emulator started working... so. Have fun with that.

New in this update:
- Emulation works.
- New icon.

Still missing
- Drivers (most important are External Filesystem and Video)
- Mac ROM (will never be included in a release from me)

What stayed the same?
- Full source included.

http://www.animezilla.org/BasiliskII-0.9.tar.bz2
w00t
User avatar
ChaosKnight
Posts: 142
Joined: Thu Apr 14, 2005 2:08 am
Location: Florida, USA

Post by ChaosKnight »

Quick Update:

I did get a basic video driver working this morning which writes directly to the PSP framebuffer. Right now it boots up and displays the grey XORy background that pre-X mac people have come to know and love is the first thing you see.

So things are getting accomplished. It comes up pretty fast so I'm confident we won't need to do anything with the CPU speed. I won't post the update though unless people really want me to, I'd rather wait until I get a flashing disk icon. (indicating no boot disk)
w00t
nevyn
Posts: 136
Joined: Sun Jul 31, 2005 5:05 pm
Location: Sweden
Contact:

Post by nevyn »

ChaosKnight wrote:Quick Update:

I did get a basic video driver working this morning which writes directly to the PSP framebuffer. Right now it boots up and displays the grey XORy background that pre-X mac people have come to know and love is the first thing you see.

So things are getting accomplished. It comes up pretty fast so I'm confident we won't need to do anything with the CPU speed. I won't post the update though unless people really want me to, I'd rather wait until I get a flashing disk icon. (indicating no boot disk)
SVN repository? :) Talk to opoo if you don't have an account.
zigzag
Posts: 129
Joined: Wed Jan 26, 2005 2:11 pm

Post by zigzag »

Great! Your work is very much appreciated.
User avatar
ChaosKnight
Posts: 142
Joined: Thu Apr 14, 2005 2:08 am
Location: Florida, USA

Post by ChaosKnight »

Ok, I have re-uploaded today's build, which has a broken video driver but does (kinda) show a disk with a blinking question mark. If anyone who knows more about the PSP video stuff can tell me how to render this buffer to the screen properly it would be much appreciated. That or modify video_psp.cpp and send it to me, you will be credited.

Again: TODAY IT WORKS! When I get the video working i'll go ahead with disk emulation and input and it should be functional!

That link is http://www.animezilla.org/BasiliskII-0.9.tar.bz2
w00t
rinco
Posts: 255
Joined: Fri Jan 21, 2005 2:12 pm
Location: Canberra, Australia

Post by rinco »

Is there a reason you are using 0.9 instead of 1.0?

ie: http://gwenole.beauchesne.online.fr/basilisk2/

video_sdl.cpp !
User avatar
ChaosKnight
Posts: 142
Joined: Thu Apr 14, 2005 2:08 am
Location: Florida, USA

Post by ChaosKnight »

I hadn't found that site. The main site just has up to 0.9. Thanks for the link! As soon as I get 0.9 working then going up to 1.0 should be a snap.

Also was that supposed to be a link or a suggestion? I don't have psp sdl so I'll have to look into it.
w00t
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Post by Arwin »

ChaosKnight wrote:I hadn't found that site. The main site just has up to 0.9. Thanks for the link! As soon as I get 0.9 working then going up to 1.0 should be a snap.

Also was that supposed to be a link or a suggestion? I don't have psp sdl so I'll have to look into it.
If the 1.0 version uses SDL for video emulation, then I think he means that would make video support much easier: SDL has already been ported to the PSP and is included in the SVN tree of this website.
Post Reply