*Screenception*
Visualizing programs with side-effects in a postfix shell with a live-updating text-mode environment. Built all the way up from machine code without any dependencies (except an x86 processor and Linux kernel).
https://archive.org/details/akkartik-2min-2020-11-12
Project page: https://github.com/akkartik/mu
More context: https://mastodon.social/@akkartik/104896128141863951
*Editing functions in the Mu shell*
https://archive.org/details/akkartik-2min-2020-12-06
Long delay since my last video. Printing floating-point numbers is *really* hard. I'm still half-assing it.
As a follow-up to https://merveilles.town/@akkartik/105331619408248578, I'm tightening focus to two threads:
a) These Mu shell experiments, and
b) An extremely skeletal OS to drop the Linux kernel dependency.
Deprioritized for now:
a) Other processors: RISCV, ARM, RPi, etc.
b) Graphics, mouse, etc. Device priorities for the OS are disk then ethernet.
*Towards running Mu without Linux*
All Mu really needs so far is to print to screen and read from the keyboard. Here's a 2-minute video about achieving that:
https://archive.org/details/akkartik-2min-2020-12-24
It seems such a small thing. But I needed lots of help, as you can see from the additions to my credits: https://github.com/akkartik/mu/compare/670cbb3d33807efb2d5e0db9e54ffed42f7ef0e3..main?short_path=b335630#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
Merry Christmas to all! What a beautiful world.
Project page: https://github.com/akkartik/mu
More context: https://mastodon.social/@akkartik/104896128141863951
*Switching gears to pure graphics*
Until now Mu has followed classic Unix: stdin, stdout, pure text mode.
But giving up an OS kernel requires controlling the screen myself. Which requires various complicated probing for hardware. Then programs handling various screen sizes.
Easier: just always assume some common graphics mode. Say 1024x768 with 256 colors.
Interestingly, the default palette has far fewer than 256 colors. (Pic: 1024 cols each contain color `col%256`.)
*2020: Flood-filling the Mu computer*
A year ago I had a prototype of a C-level programming language mapping 1:1 to Assembly that I _thought_ could be type-safe.
Since then, I:
* wrote an academic paper on it
* made it type-safe
* began a high-level language atop it
* got into video, with 15 2-minute screencasts
* and ran programs written in it on bare metal, without an OS, like, 5 years before I expected to.
❤️ to everyone who inspired, taught, debated, encouraged.
My 2020 wrap-up is turning into a bit of a rabbit hole:
http://akkartik.name/post/mu-2020
I ended up trying to create a Wardley Map (https://en.wikipedia.org/wiki/Wardley_map) for Mu.
*Rendering text atop baremetal*
Mu can now render text atop baremetal x86.
Try clicking around from http://akkartik.github.io/mu/html/baremetal/ex5.mu.html
The boot-up machine code reads a few sectors from disk, configures a keyboard handler, and loads a bitmap font (2KB for ASCII, with the option for more).
I use GNU Unifont. I believe that means Mu is now GPL v2. So stated. IANAL and I try not to think about software IP. But a font? Copyright seems reasonable there.
Next up: a text editor!
*A more international interface for rendering text*
New 2-minute video: https://archive.org/details/akkartik-2min-2021-01-12
You get just one fixed screen resolution: 1024x768, 256 colors. Widely available on modern machines, no drivers needed.
You get just one fixed-width bitmap font. No bold/italics, no anti-aliasing.
BUT it won't make assumptions about English and left-to-right order. I eventually want anybody to be able to customize it to their language.
Main project page: https://github.com/akkartik/mu
I've been trying to visualize the default 256-color palette I get on baremetal.
http://akkartik.github.io/mu/html/baremetal/vga_palette.html
To my eyes it looks like I can/should just live in the first 128 colors.
I built a game of "snakes", but it came out more like an etch-a-sketch 😄
http://akkartik.github.io/mu/html/baremetal/ex7.mu.html
Play it on any non-windows:
```
git clone https://github.com/akkartik/mu
cd mu
./translate_mu_baremetal_emulated baremetal/ex7.mu
qemu-system-i386 disk.img
```
h/j/k/l to draw
It took a while, but I've finally ported a pre-existing Mu program to baremetal: an RPN calculator.
This was _hard_, purely because of cursor management. I have a greater appreciation for everything that display hardware and terminal emulators provide for text mode. Mu so far puts the onus on the programmer.
http://akkartik.github.io/mu/html/baremetal/rpn.mu.html
In the end it's interesting to visualize the changes I had to make:
vim -d apps/rpn.mu baremetal/rpn.mu
They're entirely in `main`; the rest is unchanged.
I've been reimplementing my from-scratch live-updating postfix shell to _really_ from scratch (no more OS kernel), while at the same time rewriting the prototype with lots of tests and actually giving the language some sort of rigorous basis. No demos yet, but in the meantime here's Conway's Game of Life running on baremetal Mu.
https://archive.org/details/akkartik-mu-life-2021-02-13
Sources: http://akkartik.github.io/mu/html/baremetal/life.mu.html
Main project page: https://github.com/akkartik/mu
An experimental way to do control flow in the postfix Mu shell
The screenshot below shows an idea I've been playing with.
The conventional way Forth does control flow is a little confusing with words like `if` and `then` showing up at the end.
Factor uses quotations to put code blocks on the stack. But then you see a potentially complex chunk of code executing "all at once".
Main project page: https://github.com/akkartik/mu
Drilling into computations on the Mu shell
This was one of the more difficult things I've built, and yet all I've gotten working so far is some rudimentary tokenization. The reason is one little feature.. well, take a look for yourself.
https://archive.org/details/akkartik-2min-2021-02-24 (video; 2 mins)
As always, built all the way up from machine code, and designed primarily to be easy to build, easy to run, comprehensible to others. Also this time with lots of tests
I should just go pay for Dyalog APL.
fact← {0=⍵:1 ⋄ ⍵×∇ ⍵-1}
https://en.wikipedia.org/wiki/Direct_function
via* https://www.youtube.com/watch?v=z8MVKianh54
Thanks @dogstar for the recommendation.
I currently have several tabs from https://www.sacrideo.us open, and it's very jarring that it has the same favicon as my own website 😂
@akkartik I'm not sure I understand what break 3 does?
@neauoire They're separate words. Break skips remaining words until a `}`. There will be a similar word called `loop` to jump backwards to a `{`. And some conditional way to skip a word or word group surrounded in {}
@akkartik ah yeah! The way Forth does loop and conditional is one of the most awkward thing in the language I find. For Uxn I didn't want to have this since it felts infix in a way.
@neauoire Yeah.
I've basically been trying to plan out a series of code examples:
- factorial
- pushing n numbers starting from 1
- binary search over a sorted array (inspired by this screenshot from https://vimeo.com/36579366)
My examples are kinda square, like me 😄 Other suggestions welcome. For some corpus of examples I want to make it really nice to browse the intermediate states of the computation.
@akkartik Oh wow, that's like a Mu Rosetta! I'd love to browse that when it's live
@akkartik it's free for personal use! you used to have to register for it but i don't think you need to anymore.
@akkartik @dogstar rly idk why but I just feel like there's some obscure relevance here. I've been rly hoping someone capable of understanding this (I'm not) reads this and finds it intriguing http://xsp.xegesis.org/WNSETS.pdf
I'm working through Make a Lisp with Mu
So far I'm done with https://github.com/kanaka/mal/blob/master/process/guide.md#step-0-the-repl, albeit with some tweaks since it's baremetal
https://github.com/akkartik/mu/tree/main/baremetal#readme