about summary refs log tree commit diff stats
path: root/shell/sandbox.mu
Commit message (Collapse)AuthorAgeFilesLines
* adjust some colors and paddingKartik K. Agaram2021-04-291-52/+54
|
* bugfix: initialize gap buffers before using themKartik K. Agaram2021-04-281-1/+1
| | | | | | | I keep running into one hole in Mu's memory-safety since dropping the Linux dependency: null pointers no longer error when dereferenced. Here the problem manifests as aliasing: lots of gap buffers share the same exact data near address 0, because it was never initialized.
* shell: load/store from/to disk with indentKartik K. Agaram2021-04-281-0/+17
| | | | | Once I came up with the right approach, this worked on the first try once I got the types and registers to line up!
* .Kartik K. Agaram2021-04-281-3/+1
|
* start stashing and clearing sandbox after definitionsKartik K. Agaram2021-04-281-9/+13
|
* shell: stream literalsKartik K. Agaram2021-04-271-0/+17
|
* .Kartik K. Agaram2021-04-271-17/+17
|
* .Kartik K. Agaram2021-04-271-73/+18
|
* shell: use ctrl-m rather than tab to bounce to traceKartik K. Agaram2021-04-251-9/+9
| | | | We'll save tab for inserting graphemes.
* devote 2/3rds of screen to definitionsKartik K. Agaram2021-04-251-1/+1
|
* add some padding to the sandboxKartik K. Agaram2021-04-251-1/+1
|
* clear old output when new run is in progressKartik K. Agaram2021-04-211-67/+92
| | | | I'm currently doing this extremely naively/slowly/uglily. Not a bottleneck.
* .Kartik K. Agaram2021-04-211-13/+13
|
* .Kartik K. Agaram2021-04-211-1/+1
|
* .Kartik K. Agaram2021-04-211-66/+66
|
* shell: show screen state during evaluationKartik K. Agaram2021-04-211-1/+1
| | | | | | | | | | | | | | All highly experimental. Current constraints: * No tail recursion elimination * No heap reuse * Keep implementation simple So it's slow, and I don't want to complicate it to speed it up. So I'm investing in affordances to help deal with the slowness. However, in the process I've taken the clean abstraction of a trace ("all you need to do is add to the trace") and bolted on call counts and debug-prints as independent mechanisms.
* an interface approximating stack tracesKartik K. Agaram2021-04-201-3/+3
|
* get bresenham line drawing working with a traceKartik K. Agaram2021-04-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (brline . (fn () (screen x0 y0 x1 y1 color) ((fn (dx dy sx sy) ((fn (err) (brline1 screen x0 y0 x1 y1 dx dy sx sy err color)) (+ dx dy))) (abs (- x1 x0)) (- 0 (abs (- y1 y0))) (sgn (- x1 x0)) (sgn (- y1 y0))))) (brline1 . (fn () (screen x y xmax ymax dx dy sx sy err color) (pixel screen x y color) (if (andf (= x xmax) (= y ymax)) () ((fn (e2) (brline1 screen (if (>= e2 dy) (+ x sx) x) (if (<= e2 dx) (+ y sy) y) xmax ymax dx dy sx sy (+ err (+ (if (>= e2 dy) dy 0) (if (<= e2 dx) dx 0))) color)) (* err 2))))) sandbox: (brline screen 1 1 5 5 12) There are two ideas stemming from this commit: - I need an extremely compact on-screen trace to underlie the trace UX - perhaps we should start truncating trace lines
* reimplement pixel graphicsKartik K. Agaram2021-04-191-24/+46
| | | | | | | | | | | Before: we always drew pixels atop characters, and we only drew pixels that were explicitly requested. After: we always draw pixels atop characters, and we only draw pixels that don't have color 0. Both semantics should be identical as long as pixels are never drawn atop characters.
* start cleaning up pixel graphicsKartik K. Agaram2021-04-191-11/+11
| | | | | | Filling pixels isn't a rare corner case. I'm going to switch to a dense rather than sparse representation for pixels, but callers will have to explicitly request the additional memory.
* shell: ctrl-r runs on real screen without a traceKartik K. Agaram2021-04-171-12/+7
| | | | | We run out of memory fairly early in the course of drawing a chessboard on the whole screen.
* .Kartik K. Agaram2021-04-171-4/+4
|
* shell: reenable the traceKartik K. Agaram2021-04-171-1/+1
| | | | | | | | | | | | | | We now have a couple of protections: - if we get close to running out of space in the trace we drop in an error - if we run out of space in the trace we stop trying to append - if there are errors we cancel future evaluations This is already much nicer. You can't do much on the Mu computer, but at least it gracefully gives up and shows its limitations. On my computer the Mu shell tries to run computations for about 20s before giving up. That seems at the outer limit of what interactivity supports. If things take too long, test smaller chunks.
* tmp: debugging why brline prints no pixelsKartik K. Agaram2021-04-171-1/+1
| | | | | | | | | | | | | | | | | Among other things, we turned off the trace to significantly speed up the debug cycle. State as of https://merveilles.town/@akkartik/106079258606146213 Ohhh, as I save the commit I notice a big problem: I've been editing the disk image directly because writes to the Mu disk lose indentation. But I've been forgetting that the state in the Mu disk needs to be pre-evaluated. So function bindings need extra parens for the environment. The `pixel` calls in the previous commit message are the first statement in the body, and they aren't actually considered part of the body right now. No wonder they don't run. There are lots of other problems, but this will clarify a lot.
* handle drawing 16*4 = 64 pixelsKartik K. Agaram2021-04-161-1/+1
| | | | | | | | | | | | | | | Previously we'd only drawn 8*5 = 40 pixels. Current contents of data.img: ( (globals . ( (hline . (fn () (screen y) (hline1 screen y 0 (width screen)))) (hline1 . (fn () (screen y lo hi) (if (>= lo hi) () ((fn () (pixel screen lo y 12) (hline1 screen y (+ lo 1) hi)))))) (vline1 . (fn () (screen x lo hi) (if (>= lo hi) () ((fn () (pixel screen x lo 12) (vline1 screen x (+ lo 1) hi)))))) )) (sandbox . (vline1 screen 5 0 (height screen))) )
* first session programming _within_ the Mu computerKartik K. Agaram2021-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I tried building a function to draw a horizontal line across the screen. Here's what I have in data.txt: ( (globals . ( (horline . (fn () (screen y) (horline_1 screen y 0 (width screen)))) (horline_1 . (fn () (screen y lo hi) (if (>= lo hi) () ((fn () (pixel screen lo y 12) (horline_1 screen y (+ lo 1) hi)))))) )) (sandbox . (horline_1 screen 0 0 20)) ) $ dd if=/dev/zero of=data.img count=20160 $ cat data.txt |dd of=data.img conv=notrunc $ ./translate shell/*.mu && qemu-system-i386 -hda disk.img -hdb data.img Result: I can't call (horline screen 0) over a fake screen of width 40. Some stream overflows somewhere after all the tweaks to various fixed-size buffers scattered throughout the app. Calling horline_1 gets to a 'hi' column of 20, but not to 30.
* shell: start persisting global bindingsKartik K. Agaram2021-04-151-1/+4
|
* .Kartik K. Agaram2021-04-151-0/+8
|
* .Kartik K. Agaram2021-04-151-0/+7
|
* .Kartik K. Agaram2021-04-151-1/+1
|
* parse dotted listsKartik K. Agaram2021-04-151-0/+135
|
* .Kartik K. Agaram2021-04-141-10/+3
|
* shell: word/line navigationKartik K. Agaram2021-04-141-0/+8
|
* shell: pixel graphicsKartik K. Agaram2021-04-131-17/+49
|
* shell: fake keyboardKartik K. Agaram2021-04-101-1/+1
|
* shell: start jumping to keyboard using TabKartik K. Agaram2021-04-101-25/+180
|
* shell: UI now showing fake keyboardKartik K. Agaram2021-04-101-9/+86
| | | | But we don't actually support fake keyboards anywhere yet.
* shell: start on support for fake keyboardKartik K. Agaram2021-04-101-2/+5
|
* shell: move fake screen to sandboxKartik K. Agaram2021-04-101-39/+35
|
* shell: tweaks for fake screensKartik K. Agaram2021-04-101-5/+137
| | | | | - make them more discoverable - clear them between commands
* shell: render fake screensKartik K. Agaram2021-04-101-4/+75
| | | | 'print' turns out to not be working yet.
* shell: start of 'print' primitiveKartik K. Agaram2021-04-101-8/+17
|
* .Kartik K. Agaram2021-04-081-0/+3
|
* shell: create space to display globalsKartik K. Agaram2021-04-081-1/+1
|
* shell: quoteKartik K. Agaram2021-04-061-0/+20
|
* shell: extensible array of globalsKartik K. Agaram2021-04-051-19/+19
| | | | I'm not bothering with full dynamic scope for now.
* shell: save repl input to disk before runningKartik K. Agaram2021-04-051-22/+29
|
* shell: clean up unimplemented menu itemsKartik K. Agaram2021-04-051-4/+0
|
* writes to disk now workingKartik K. Agaram2021-03-231-0/+3
| | | | | | Tested by inserting a call into the shell, but we can't leave it in because every test ends up clobbering the disk. So it's now time to think about a testable interface for the disk.
* .Kartik K. Agaram2021-03-081-1/+1
|