May 17, 2021
Using Mu to play with some ideas from Hest by Ivan Reese

https://archive.org/details/akkartik-mu-2021-05-17 (video; 3.5 minutes)

Mysterious picture showing a few squares connected by red and orange edges. There's a counter ticking off instants of time on the top right.

Putting more animation and control of time into the debugging experience.

More info on Hest: https://ivanish.ca/hest-podcast

Main project page for Mu: https://github.com/akkartik/mu


I was just reminded of the existence of an idea called double-buffering.

It's easy to add.

The current implementation is quite naive. Copies one byte at a time, makes several redundant copies per byte. In spite of all that, it makes a huge difference in video quality.

permalink

* *
May 15, 2021
The Mu computer now dumps a snapshot of the call stack when it fails catastrophically

The Mu computer running on Qemu, showing a session of the Lisp-based shell that has failed catastrophically. On the top left it prints out, all in a pinkish red, an error message and dumps the function calls in the call stack at the time of the error.

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!

permalink

* *
May 9, 2021
Zooming into the Mandelbrot set on the Mu computer

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.

Sources

Main project page: https://github.com/akkartik/mu


Same video but replacing floating point numbers with fixed-point (8 bits of fractional precision)

Sources

permalink

* *
May 8, 2021
Playing with the kids on a Saturday morning

A full-circle rainbow in Mu running on Qemu.

Slowly drawing many full-circle rainbows all in a jumble.

A

Chessboard pattern on Qemu, 256 pixels to a side.

(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

permalink

* *
May 7, 2021
The Mu computer now has Lisp macros

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.

Bresenham's circle algorithm implemented using 2 macros:

  (when cond body) = (if cond body ())
  (let x val body) = ((fn (f) body) val)

Caveats:

  • No nested backquotes yet.
  • I can't draw circles too far down the screen due to a strange error.
  • In general, error messages have been a mess ever since I stopped relying on Linux. A heavy exercise in humility.

Main project page: https://github.com/akkartik/mu

permalink

* *
May 5, 2021
I've been noodling on sandboxing models

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.

permalink

* *
Apr 29, 2021
I suck at colors. Anybody wanna help me paint this bikeshed for the mind?

Constraint: I only have 256 colors.

Screenshot of the prototyping environment for the Mu computer, running within Qemu. The left side occupies 2/3rds of the 1024px-wide screen and contains two columns of function definitions, each 41 characters wide (each character is 8px wide) with 1 character of padding on both sides of each column. the right side occupies the remaining 1/3rd of screen width and contains a sandbox. Both sides contain grey text over black background, though the left side has a slightly lighter background than the left.

permalink

* *
Apr 22, 2021
Prototyping on the Mu computer

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.

A Qemu window showing the prototyping environment for the Mu computer.

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

permalink

* *
Apr 16, 2021
Writing code within the Mu computer

I tried and failed to implement Bresenham's line algo. Horizontal and vertical lines work.

Screenshot of the Lisp-based HLL on the Mu computer running on Qemu.

1024x768 screen, 256 colors. Text mode, 80x48 for characters.

Function definitions on top left, help for primitives on bottom left, menu of available keyboard shortcuts across bottom.

Right side has a REPL with initial state of a toy screen and keyboard buffer, some code typed in to draw lines, a trace for drilling into computations performed, and final state of toy screen containing pixel graphics, showing one horizontal and one vertical line in red.

I try running my function for Bresenham line-drawing. Nothing happens. Screen stays blank. No errors either. The code being run shows up in an unindented blob on the left.

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.

Screenshot of Mu's disk image, showing just a raw text s-expression followed by null bytes. It's currently easier to edit outside Qemu because we keep losing indentation inside.

I have lots of little buffers. When they overflow the computer crashes. Without a call stack.

Terminal window showing my debug cycle

      dd if=/dev/zero of=data.img count=20160
      cat x.lisp |dd of=data.img conv=notrunc
      ./translate shell/*.mu
      qemu-system-i386 -hda code.img -hdb data.img

Thanks Max Bernstein for pairing!


The bug wasn't in Mu or in Bresenham. I just typoed when I edited the disk image 😂

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.

permalink

* *
Apr 11, 2021
Distinguishing a program's return value from its side effects

https://archive.org/details/akkartik-2min-2021-04-10 (2-minute video)

A Qemu window draws a little cartoon screen, and a cartoon representation of a keyboard buffer, then waits for input. Prints show up in the cartoon screen, Reading a key reads from the cartoon keyboard buffer.

Main project page: https://github.com/akkartik/mu

permalink

* *
archive
projects
writings
videos
subscribe
Mastodon
RSS (?)
twtxt (?)
Station (?)