This was not fun. And the debug information in the second half of the code disk is now larger than the code itself.
On the other hand, I hope debugging will now be more fun!
This was not fun. And the debug information in the second half of the code disk is now larger than the code itself.
On the other hand, I hope debugging will now be more fun!
Apologies for the garish colors. Still a work in progress.
I recorded this on Qemu on a Mac, then sped it up 8x. I estimate that makes it 3x slower than Qemu on my Linux computer accelerated with KVM.
Main project page: https://github.com/akkartik/mu
(Much faster on Linux, thanks to -enable-kvm.)
git clone https://github.com/akkartik/mu
cd mu
dd if=/dev/zero of=data.img count=20160
dd of=data.img conv=notrunc < shell/data.limg
./translate shell/*.mu # gen code.img
qemu-system-i386 -enable-kvm -m 2G -hda code.img -hdb data.img
Here's the Bresenham algorithm for drawing circles using a few macros. My current style is to keep line width to 41 characters and lay out two columns of functions.
Caveats:
Main project page: https://github.com/akkartik/mu
Robert Frost:
"Before I built a wall I'd ask to know
What I was walling in or walling out"
(https://www.poetryfoundation.org/poems/44266/mending-wall)
With computers, this strategy doesn't work. Inside and outside have a way of switching places.
In Unix, the crown jewels were the root user; other user accounts were sandboxed. Code (in C) ran all types erased.
Time passed. Root grew vestigial, people stopped sharing computers. The crown jewels moved to user accounts.
Some possible lessons to draw from these sample points.
Sandboxing isn't about a single boundary. When designing VMs for adoption, build for isolation within the VM in addition to the boundary. Allow people to collaborate and run untrusted code within a single sandbox.
Oh, and don't erase types.
Constraint: I only have 256 colors.
A 3-minute video showing what it's currently like to prototype programs on the Mu computer. There are lots of limitations. It's slow, and it can only handle short runs.
While these limitations will be relaxed over time, the goal is partly to nudge people to throw the prototype away once they know what they want, and rewrite it one level down. Therefore: encourage people to write lots of tests.
https://archive.org/details/akkartik-mu-2021-04-22
Main project page: https://github.com/akkartik/mu
I tried and failed to implement Bresenham's line algo. Horizontal and vertical lines work.
No macros => lots of lambdas.
The computer keeps crashing because I type too fast (still can't brain interrupt handlers). It frequently saves to disk, but as an s-expression. Reboots lose indentation.
Ok, edit on host -> create disk image.
I have lots of little buffers. When they overflow the computer crashes. Without a call stack.
Thanks Max Bernstein for pairing!
Still lots of catastrophic bugs that require editing the disk image. The disk is clobbered on reboot because I added support for reading multiple sectors from disk but still only write one sector.
https://archive.org/details/akkartik-2min-2021-04-10 (2-minute video)
Main project page: https://github.com/akkartik/mu
Things to notice:
https://github.com/akkartik/mu/blob/main/shell/README.md
Main project page: https://github.com/akkartik/mu