Commit Graph

178 Commits

Author SHA1 Message Date
Kartik K. Agaram
05879d4f99 load large definitions 2021-04-29 16:10:30 -07:00
Kartik K. Agaram
b860f108f7 adjust some colors and padding 2021-04-29 15:10:17 -07:00
Kartik K. Agaram
dcb6a21a91 bugfix: initialize gap buffers before using them
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.
2021-04-28 22:03:58 -07:00
Kartik K. Agaram
7fa356abef fix rendering 2021-04-28 17:54:02 -07:00
Kartik K. Agaram
b9c59a5f5b shell: load/store from/to disk with indent
Once I came up with the right approach, this worked on the first try once
I got the types and registers to line up!
2021-04-28 17:49:55 -07:00
Kartik K. Agaram
ef8dc999ca . 2021-04-28 17:08:15 -07:00
Kartik K. Agaram
d5d3e02ad4 shell: bugfix for stream literals
I was forgetting that callers sometimes reuse outputs between successive
tokens.
2021-04-28 16:34:40 -07:00
Kartik K. Agaram
9269234e46 start rendering definitions with indentation 2021-04-28 14:47:41 -07:00
Kartik K. Agaram
5b7f938733 start stashing and clearing sandbox after definitions 2021-04-28 13:55:10 -07:00
Kartik K. Agaram
e73f1a3b41 . 2021-04-28 12:21:51 -07:00
Kartik K. Agaram
a71ff2383a . 2021-04-28 09:45:39 -07:00
Kartik K. Agaram
55cde01edf shell: stream literals 2021-04-27 23:10:30 -07:00
Kartik K. Agaram
9e9e40c05a . 2021-04-27 23:04:20 -07:00
Kartik K. Agaram
409d26ca87 . 2021-04-27 23:03:23 -07:00
Kartik K. Agaram
6ecd9920ca shell: tokenizing stream (string) literals
We're calling them streams since they support appending.
2021-04-27 22:48:16 -07:00
Kartik K. Agaram
16f51dd76d . 2021-04-27 22:14:08 -07:00
Kartik Agaram
865f37aa9c . 2021-04-26 09:42:05 -07:00
Kartik K. Agaram
606c5681b7 bresenham circles
Known issue: circles of radius 9 crash. (Multiples of 9 overflow the trace.)
2021-04-25 22:33:26 -07:00
Kartik K. Agaram
7148f1222e bug in bresenham lines 2021-04-25 22:20:57 -07:00
Kartik K. Agaram
891083c44d shell: primitives 'and' and 'or' 2021-04-25 22:19:00 -07:00
Kartik K. Agaram
bd9c1e6a79 shell: primitive 'not' 2021-04-25 22:09:51 -07:00
Kartik K. Agaram
24a6f99107 failing tests not printing since show-stack-state 2021-04-25 22:08:00 -07:00
Kartik K. Agaram
6e0f0bdf50 . 2021-04-25 22:00:00 -07:00
Kartik K. Agaram
ffe36c4050 . 2021-04-25 21:45:27 -07:00
Kartik K. Agaram
1a18c9e24b . 2021-04-25 21:35:14 -07:00
Kartik K. Agaram
a68ecc0184 . 2021-04-25 21:32:15 -07:00
Kartik K. Agaram
6bb70a236c shell: tab inserts two spaces 2021-04-25 21:03:14 -07:00
Kartik K. Agaram
cbebd548ca shell: use ctrl-m rather than tab to bounce to trace
We'll save tab for inserting graphemes.
2021-04-25 21:03:05 -07:00
Kartik K. Agaram
1323a6bb3a .
Show all builtins now that we have more space.
2021-04-25 17:57:19 -07:00
Kartik K. Agaram
8e89dd5a78 devote 2/3rds of screen to definitions 2021-04-25 17:55:17 -07:00
Kartik K. Agaram
35a6f3cc99 add some padding to the sandbox 2021-04-25 17:49:39 -07:00
Kartik K. Agaram
a761d0e4ef a troubleshooting note 2021-04-25 16:02:30 -07:00
Kartik K. Agaram
d56153d004 . 2021-04-25 15:58:03 -07:00
Kartik K. Agaram
22a95bd813 expand memory to 2GB
It requires more than 1GB to fill the screen with a chessboard pattern
using the definition in shell/iterative-definitions.limg.

I also speed up the chessboard program by clearing the screen up front
and then only rendering the white pixels.
2021-04-25 15:56:34 -07:00
Kartik Agaram
9c3e2821c1 .
Get rid of my experiment adding Game of Life to the shell.
2021-04-24 07:18:15 -07:00
Kartik Agaram
cb464c9378 bugfix; thanks Max Bernstein 2021-04-24 07:16:34 -07:00
Kartik Agaram
b7224ab44e . 2021-04-23 21:49:28 -07:00
Kartik Agaram
fa8d337d90 shell: some example definitions 2021-04-23 21:36:48 -07:00
Kartik K. Agaram
2ff86d9162 better error message on trace overflow 2021-04-22 10:13:19 -07:00
Kartik K. Agaram
8a66b59940 faster emulation
Thanks Maxwell Bernstein for pointing this out 🤦‍♂️
2021-04-22 09:16:48 -07:00
Kartik K. Agaram
7a7191cc3e clean up with the final bugfix 2021-04-22 09:09:23 -07:00
Kartik K. Agaram
bd0410c993 snapshot
It took me _way_ too long to realize that I'm not checking for errors within
the loop, and that will cause it to manifest as an infinite loop as inner
evaluations fail to run.

Debugging notes, for posterity:
  printing one row of a chessboard pattern over fake screen (chessboard screen 4 0 0 15) gets stuck in an infinite loop halfway through
    debug pattern during infinite loop: VWEX. It's still in the loop but it's not executing the body
    raw (fill_rect screen 16 0 20 4 15) works fine
    same number of calls to fill_rect work fine
    replacing calls to fill_rect with pixel inside chessboard2 works fine
    at the point of the infinite loop it's repeatedly going through the hline loop
      -- BUT it never executes the check of the loop (< lo hi) with lo=20, hi=20. Something is returning 1, but it's not inside <
    stream optimization is not implicated

  simple test case with a single loop
    (
      (globals . (
        (foo . (fn () (screen i n)
                 (while (< i n)
                   (pixel screen 4 4 i)
                   (pixel screen 5 4 i)
                   (pixel screen 6 4 i)
                   (pixel screen 7 4 i)
                   (set i (+ i 1)))))
      ))
      (sandbox . (foo screen 0 100))
    )

  simpler (if you reset cursor position before every print):
    (
      (globals . (
        (foo . (fn () (screen i n)
                 (while (< i n)
                   (print screen i)
                   (set i (+ i 1)))))
      ))
      (sandbox . (foo screen 0 210))
    )

  I now believe it has nothing to do with the check. The check always works.
  Sometimes no body is evaluated. And so the set has no effect.
2021-04-22 09:05:11 -07:00
Kartik K. Agaram
6842dddd68 . 2021-04-22 07:56:49 -07:00
Kartik K. Agaram
4afe53d834 shell: non-recursive 'while' 2021-04-21 21:34:55 -07:00
Kartik K. Agaram
a5e1a220fd shell: refuse to 'def' duplicate names 2021-04-21 20:54:18 -07:00
Kartik K. Agaram
c54b7e9630 shell: separate 'def' from 'set'
'def' creates new bindings (only in globals)
'set' only modifies existing bindings (either in env or globals)
2021-04-21 20:53:38 -07:00
Kartik K. Agaram
bfc6fa1876 slightly more responsive animation 2021-04-21 20:12:16 -07:00
Kartik K. Agaram
bcd37c381a clear old output when new run is in progress
I'm currently doing this extremely naively/slowly/uglily. Not a bottleneck.
2021-04-21 20:06:46 -07:00
Kartik K. Agaram
bc4b6021de . 2021-04-21 19:56:32 -07:00
Kartik K. Agaram
5daa1f06d4 . 2021-04-21 19:45:02 -07:00