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.

This post is part of my Freewheeling Apps Devlog.

Comments gratefully appreciated. Please send them to me by any method of your choice and I'll include them here.

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