evansm7 / pico-mac

Run the popular umac emulator right on your Pi Pico!
244 stars 22 forks source link

Add PSRAM to allow Mac Plus emulation? #7

Open ajacocks opened 1 month ago

ajacocks commented 1 month ago

Obviously, adding more RAM to the emulated Macintosh isn't really possible on the Pico, as is, as it only has ~256k of native RAM. However, adding a PSRAM module is a path that a lot of Pico-based projects have done.

Have you considered that? Here is a C library for the access to such RAM: https://github.com/polpo/rp2040-psram

Ian Scott used that, I believe, in the PicoGUS, and here is the schematic: https://github.com/polpo/picogus/blob/main/hw/PicoGUS-schematic.pdf

evansm7 commented 1 month ago

Hello! I have, yes. It’s something I’m thinking about, though for the “Pico micro mac” the purpose was very much to see what just the bare 2040 can do, and making it easy to build from spare parts lying around. (There are many ways you can make a much better emulator if memory isn’t an issue…)

On the technical side, adding PSRAM hardware is easy, but using it in such a way that it’s not slow isn’t trivial. For example, all 68k instruction and memory accesses now get about 30x more expensive; the total cost of interpreting an instruction will go up by a lesser amount but I believe it’ll be too slow to do naively. That leads to doing more complicated caching of hot external RAM locations in internal SRAM etc.

Anyway: it’d be fun to try, and at some point I’ll make a PCB up, but it’s kind of a different project if you see what I mean.

geerlingguy commented 1 week ago

The Pico 2 that launched today has 520 KiB of RAM now, and a lot more compute power (even FPU on the Cortex-M33 cores)... would that have enough overhead, or still need more?

evansm7 commented 1 week ago

Nah, still need more. (It’s not enough for a Mac 512K, though I’ll have a play with doing a Mac 400K or so :) I don’t know what that would enable in terms of new apps/OS though, and biting the bullet and going for 4MB would be a radical improvement.) The most useful part of the 2350 is the XIP/cache interface to PSRAM – that would avoid the horrible tricks I alluded to above. Hoping to prototype something this week…

geerlingguy commented 1 week ago

I'm just surprised Raspberry Pi didn't consider that they'd need more headroom to emulate Mac 512K inside the chip, ha!

doliveira4 commented 1 week ago

Nah, still need more. (It’s not enough for a Mac 512K, though I’ll have a play with doing a Mac 400K or so :) I don’t know what that would enable in terms of new apps/OS though, and biting the bullet and going for 4MB would be a radical improvement.) The most useful part of the 2350 is the XIP/cache interface to PSRAM – that would avoid the horrible tricks I alluded to above. Hoping to prototype something this week…

Looking forward to read about that RP2350-based prototype! ;)

jamesfmackenzie commented 3 days ago

Nah, still need more. (It’s not enough for a Mac 512K, though I’ll have a play with doing a Mac 400K or so :) I don’t know what that would enable in terms of new apps/OS though, and biting the bullet and going for 4MB would be a radical improvement.) The most useful part of the 2350 is the XIP/cache interface to PSRAM – that would avoid the horrible tricks I alluded to above. Hoping to prototype something this week…

Very excited to hear more on this one! 😎

evansm7 commented 15 hours ago

image

Very much just a proof of concept, but it’s alive! This has PSRAM (on a Pimoroni PGA2350), and SD, with original video. It runs 7.5.5 as a 4MB Plus-ish machine; most things seem to work (MacPaint hehe, and even Shufflepuck!).

The video DMA needs work as it’s dropping CPU performance in the current approach – it’s not as fast as the plain internal RAM 128K. Then I need to clean up the build so as to target 2040, 2350, 2350+PSRAM, and SD-or-internal-flash for each of them.

So please be patient! It’ll get there. I also intend to get DVI going, design a board etc. Lots to do but sharing an early milestone as yall seemed interested! :):)

geerlingguy commented 10 hours ago

Oh wow, this is awesome! Following very closely—I hope to do a pico-mac build with the 2040 soon, and it'd be cool to have a design that can go straight on to Mac OS 7.x with the 2350!

jamesfmackenzie commented 9 hours ago

Agree with @geerlingguy - awesome progress and very excited to hear more as it develops! 😎