Introducing FocusedEdit

focusededit box art

What is FocusedEdit?

FocusedEdit is a new text editor for classic Macintosh computers (running System 2 through MacOS 9.2.2) and the CoprocessorJS library that allows shared bidirectional text editing with a modern computer within a web browser window.

focusededit animated demo

FocusedEdit will allow you to easily work on text documents on a classic Macintosh and then instantly use them on your modern computer. For example, I’ve been typing up confluence documents, emails, slack messages, etc. for work on a Macintosh Quadra 700 and then pasting them out of the FocusedEdit website when I’m done typing them up. I even wrote and edited the markdown document that generated this blog post using FocusedEdit!

Great, how do I use it?

The setup is very similar to Messages for Macintosh which also uses the CoprocessorJS library, Retro68, etc, so if you’ve attempted to try out Messages for Macintosh, you’ll be in familiar territory. Read on for the full instructions…

System requirements

  • A network-connected machine capable of running CoprocessorJS (we’ll include setup instructions for that here) connected to your “classic” Macintosh via a serial port — a raspberry pi is a great option, but I used a 2011 i5 Mac Mini running Ubuntu 20.04
  • A USB to mini din 8 RS422 serial cable (see this article for how to build your own)
  • A “classic” Macintosh, with its modem serial port connected to the previously mentioned CoprocessorJS machine via the previously mentioned cable. In my case I will be using a Macintosh Quadra 700 running System 7.6.1 with 20MB of RAM and a Macintosh Classic with 1MB RAM running System 6.0.8, but the software has been tested in an emulator down to a Macintosh SE running System 2.0 with 1MB RAM. It is known to not run on System 1.1 due to unimplemented function calls, but may be able to run on a 512k Mac with System 2.0 or greater – if anyone tries it, let me know! Side note: FocusedEdit is known to run much much better using System 6.0.8 or earlier on 8MHz 68000-based systems. System 7 seems to treat the serial port differently which causes some performance issues on 68000-based systems running it. ‘020 and better systems should be fine on System 7. Your Macintosh must have a “modem” serial port available
  • A USB floppy drive and floppy disk, or some other way of transferring files to your classic Macintosh.
  • Alternatively, this is all capable of running in emulators on a single modern Mac for development and testing purposes. Running within an emulator is very similar to the workflow for doing development work on Messages for Macintosh, outlined here – just check out the FocusedEdit code from GitHub rather than the Messages for Macintosh code.

How to run FocusedEdit

There are 2 major things we’re going to do to get FocusedEdit up and running:

  • Set up an intermediary machine to handle communication between our “classic” Macintosh and the rest of the our local network
  • Set up our “classic” Macintosh

Setting up your “intermediary” computer to run CoprocessorJS

We need to get up and running with the software that will handle communication between our classic Macintosh and our network. We do that using CoprocessorJS running on the intermediary computer and a USB to mini din 8 RS422 serial cable (again, see this article for how to build your own). (note: the intermediary machine can be a modern Mac, a Linux machine, raspberry pi, etc. I am using an older Mac Mini running Ubuntu 20.04 as I test this out)

CoprocessorJS will handle serial communication with our classic Macintosh and will execute workloads on the classic Macintosh’s behalf, allowing it to communicate over a network with other machines. Let’s walk through getting CoprocessorJS up and running. More in depth instructions and explanation is available at the coprocessor repo’s readme.

Finding your serial cable’s tty

If you’re using a new USB to serial port adapter (maybe like the one I outlined here) you may not know what port you’re running on. Here’s an easy way to figure it out:

In a new terminal window, with the USB portion of the cable unplugged from your host machine, run:

1
output1=$(ls /dev/*)

Then, plug in the USB portion of the cable to your host machine, and in the same terminal window, run:

1
2
output2=$(ls /dev/*)
diff <(echo "$output1") <(echo "$output2")

This should output something that looks like:

1
> /dev/ttyUSB0

Which is your USB to serial cable’s tty!

Running CoprocessorJS

Here is how to quickly get up and running with CoprocessorJS now that we know how to reference our serial cable. In a terminal window on your “intermediary” machine:

1
2
3
4
git clone git@github.com:CamHenlin/coprocessor.js.git
cd coprocessor.js
npm install
sudo SERIAL_PORT="/dev/ttyUSB0" node index

(note: the final line’s /dev/ttyUSB0 came from the “Finding your serial cable’s tty” section)

You should be rewarded with:

1
instantiated program, waiting for data on /dev/ttyUSB0

Getting up and running on your classic Macintosh (finally!)

Now comes the easy part. We’re ready to set up our classic Macintosh to communicate over its serial cable, to its host which will run our server software and allow us to interact with FocusedEdit with other computers on your local network. We’ll first load our software on to a floppy disk, then we’ll open it on our classic Mac.

Write FocusedEdit to your floppy

You can play a similar game to what we played in “Finding your serial cable’s tty” above with your USB floppy drive if you don’t know how to access it. Just unplug/plug in the floppy disk drive with a disk loaded into it, and you should wind up with something like /dev/rdisk5, which is what my USB floppy drive happens to be on a modern Mac. Or if I run through these steps on my Linux Mac Mini, I will get /dev/sdb. Once you’ve figured out where your floppy drive is located, try this in a terminal window (remember, replace /dev/rdisk5 with your floppy disk drive):

1
2
wget https://github.com/CamHenlin/FocusedEdit/raw/main/build/FocusedEdit.dsk
sudo FocusedEdit.dsk of=/dev/rdisk5 bs=1024

For reference, this process takes approximately 3 minutes with a USB floppy drive. After it’s done, eject the disk and insert it into your classic Macintosh.

Setting up FocusedEdit on the classic Macintosh

We’re in the home stretch and nearly to do a bit of text editing! Here are our final steps for getting up and running:

  • Plug the serial cable connected to your machine running CoprocessorJS to the modem serial port on your classic Macintosh
  • Insert the floppy disk that you just created into your classic Macintosh
  • Once the floppy appears on the desktop, open it
  • Double click FocusedEdit which will launch the app
  • The app will take a few moments to load depending on the speed of your internet connection, as it installs supporting software on the CoprocessorJS server
  • A blank text editor window will appear. You can start typing in it!
  • Additionally, if you need help finding the address of your CoprocessorJS machine to access your text document in, go to the File menu and select “Get IP Addresses for Host”, which will pop up an alert showing addresses that you should be able to access the shared editor on from web browsers on you local network. If you’re wanting to view the document on the machine running CoprocessorJS, you can open http://127.0.0.1:3000/ in your web browser.
  • We’re done! We’re up and running! Now you can edit to your heart’s content!

focusededit box art

Next steps

Feel free to check out the source code and make your own contributions https://github.com/CamHenlin/FocusedEdit. I welcome contributors!

Did you enjoy my post?

I'm really excited about the work that I'm doing here. If you enjoyed my post and my work, please consider tipping me with a coffee. I appreciate you taking the time to read my post!

Comments

⬆︎top