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

* *
Apr 9, 2021
Mu's HLL is now Turing-complete, I think.

Things to notice:

  • Wordstar-style menu at the bottom.
  • List of available primitive functions in bottom left.
  • List of globals on the left side that updates as I add definitions.
  • Matching parens highlighted as I type.
  • Drilling down into the trace to understand how the program was evaluated.

https://github.com/akkartik/mu/blob/main/shell/README.md

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

permalink

* *
Mar 29, 2021
What should the signature of a program look like?

Typed languages have a fixed signature for function `main`. A list of strings, a window context, or an IO monad.

Here's the signature on the Mu computer:


fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk)

A rudimentary, hokey capability system. No mouse yet. 'screen' is only used for text; pixel graphics currently go around it. 'data-disk' can't access code, and will eventually include finer-grained restrictions.

permalink

* *
Mar 23, 2021
The Mu computer now has drivers for disk and mouse.

Still extremely klunky. IDE disk drives only, and the mouse driver uses polling because configuring IRQ 12 is still beyond me.

Example programs (as usual memory safe and translating 1:1 to x86 machine code)

Disk: http://akkartik.github.io/mu/html/ex9.mu.html

Mouse: http://akkartik.github.io/mu/html/ex10.mu.html

Here's video of the mouse example. There's no pointer so you have to imagine me moving the mouse around.

Video of a Qemu window with mostly black background showing just two fluctuating numbers in bright green, denoting change in x and y coordinates as I move the mouse around.

Like I said. Klunky.

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

permalink

* *
Mar 22, 2021
Mu can now read from an ATA (IDE) disk drive on Qemu.

https://github.com/akkartik/mu/tree/main/shell#readme

It wouldn't have been possible without the lovely folks over on #osdev. And the inspiration of ColorForth (https://merveilles.town/@akkartik/105906716550232992), though I still don't understand how that driver works.

permalink

* *
Mar 17, 2021
A driver for IDE hard disks in Forth

https://colorforth.github.io/ide.html

It seems to be using https://wiki.osdev.org/ATA_PIO_Mode which transfers data to disk one byte at a time. Super inefficient. And yet, so small! ❤️

permalink

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