Commit Graph

546 Commits

Author SHA1 Message Date
Kartik K. Agaram
aab93d7538 . 2021-10-30 07:37:05 -07:00
Kartik K. Agaram
0f0d615ec4 . 2021-10-30 07:36:39 -07:00
Kartik K. Agaram
bb1d5c2cd3 . 2021-10-11 21:21:31 -07:00
Kartik K. Agaram
834377d6e3 . 2021-10-03 08:03:15 -07:00
Kartik K. Agaram
6e05a8fa27 fix bad terminology: grapheme -> code point
Unix text-mode terminals transparently support utf-8 these days, and so
I treat utf-8 sequences (which I call graphemes in Mu) as fundamental.

I then blindly carried over this state of affairs to bare-metal Mu,
where it makes no sense. If you don't have a terminal handling
font-rendering for you, fonts are most often indexed by code points and
not utf-8 sequences.
2021-08-29 22:20:09 -07:00
Kartik K. Agaram
bc859a7ca4 . 2021-08-28 22:57:22 -07:00
Kartik K. Agaram
8765064d69 move gap buffer code to top-level
Now that it's been used in a second app without needing any changes.
2021-08-15 21:09:17 -07:00
Kartik K. Agaram
350a255134 new tool: creating a data disk 2021-08-10 08:59:00 -07:00
Kartik K. Agaram
19d2e6423a . 2021-08-02 10:27:58 -07:00
Kartik K. Agaram
4692c48f40 better error handling on stray commas 2021-08-01 18:26:35 -07:00
Kartik K. Agaram
15b1c2651c . 2021-08-01 10:22:16 -07:00
Kartik K. Agaram
e55d3f5814 maintain aspect ratio when rendering images 2021-07-29 08:24:27 -07:00
Kartik K. Agaram
63c7d5c4e0 downsampling photos makes the dithering seem worse
We support 128px, so let's use the whole 128px.
2021-07-29 07:55:54 -07:00
Kartik K. Agaram
295e50f025 shell: reliable image rendering 2021-07-29 07:55:28 -07:00
Kartik K. Agaram
e9fb7e4453 shell: rendering image definitions
Not quite working yet. Only the very first rendering succeeds. After
that any keypress triggers a second render which aborts. Image is
getting corrupted in memory somehow.
2021-07-29 00:41:19 -07:00
Kartik K. Agaram
fc951149a0 shell: support loading 128x128px images
I'm loading them in uncompressed ASCII format, and all streams and gap
buffers all over the place need to get massively scaled up to 256KB
capacity. But the tests don't yet run out of RAM, so I'll keep going.
2021-07-28 23:58:46 -07:00
Kartik K. Agaram
e2f18e8866 shell: literal images 2021-07-28 23:28:29 -07:00
Kartik K. Agaram
e2f6e9011e saving definitions containing string literals
This was the whole proximal goal in implementing balanced terminals.

Printing these is still unreliable. It always surrounds in [], which may
not work.
2021-07-28 23:08:07 -07:00
Kartik K. Agaram
bec33a7067 shell: second notation for string literals
I've always been dissatisfied with the notion of escaping. It introduces
a special-case meta-notation within the tokenizer, and the conventional
approach leads to exponential "leaning toothpick syndrome" with each
level of escaping.

One potential "correct" solution is to keep string terminals
parameterizable:

  [abc]           => abc
  [=]             => =
  [=[abc]=]       => abc
  [=[a]bc]=]      => a]bc
  [==[a]=]bc]==]  => a]=]bc

..and so on. Basically the terminals grow linearly as the number of
escapings grow.

While this is workable, I'd like to wait until I actually need it, and
then gauge whether the need is a sign of the stack growing too complex,
with too many layers of notation/parsing. Mu's goal is just 3 notations,
and it's going to require constant vigilance to keep that from growing.

Therefore, for now, there are two notations for string literals, one
symmetric and one balanced:

  "abc"           => abc
  [abc]           => abc

The balancing notation permits nested brackets as long as they balance.
  [abc [def]]     => abc [def]

If you need unbalanced square brackets, use the symmetric terminals:
  "abc [def"      => abc [def

If you need double quotes inside strings, use the balanced notation:
  [abc "def]      => abc "def

If you need _both_ square brackets (whether balanced or unbalanced) and
double quotes, you're currently shit outta luck.
2021-07-28 20:44:02 -07:00
Kartik K. Agaram
267c74b59a shell: render image from pbm data stream 2021-07-27 22:38:26 -07:00
Kartik K. Agaram
a5cbf871ea . 2021-07-26 17:28:49 -07:00
Kartik K. Agaram
bfa0efb7d1 game of life in lisp
Super slow; each frame is cleared as a sort of progress indicator while
it computes the next frame.

In the process I realize I need to adjust every single trace in the
shell sources to be more fault-tolerant to a filled-up trace stream.
2021-07-26 17:19:04 -07:00
Kartik K. Agaram
46441d7204 .
Smoked out some issues by rendering a single frame of Game of Life.
Incredibly slow.
2021-07-26 02:27:32 -07:00
Kartik K. Agaram
81c3678515 gracefully trace large multi-dimensional arrays 2021-07-26 02:08:09 -07:00
Kartik K. Agaram
6a92f3b535 gracefully trace large arrays 2021-07-26 02:06:48 -07:00
Kartik K. Agaram
6b57715502 palette operations now a bit faster 2021-07-26 01:33:48 -07:00
Kartik K. Agaram
438c00fd1f . 2021-07-26 01:21:46 -07:00
Kartik K. Agaram
ef637b6bab . 2021-07-26 01:12:04 -07:00
Kartik K. Agaram
3e76e0540b shell primitive: initialize array of some size 2021-07-26 00:56:30 -07:00
Kartik K. Agaram
4c224c5375 shell primitive: iset to mutate array at index 2021-07-25 16:46:12 -07:00
Kartik K. Agaram
f7a890d435 shell primitive: array index 2021-07-25 16:35:21 -07:00
Kartik K. Agaram
17e50d27d4 shell: array type 2021-07-25 16:24:45 -07:00
Kartik K. Agaram
7ed4a6aed9 . 2021-07-25 16:24:45 -07:00
Kartik K. Agaram
ff24d7b810 . 2021-07-25 16:24:45 -07:00
Kartik K. Agaram
251f317c38 . 2021-07-25 16:24:45 -07:00
Kartik K. Agaram
170b6787c5 shell: starting to implement arrays 2021-07-25 16:24:45 -07:00
Kartik K. Agaram
492f7bd0b7 . 2021-07-25 12:36:18 -07:00
Kartik K. Agaram
99cc27200f . 2021-07-24 21:35:52 -07:00
Kartik K. Agaram
4f60a4a6b2 . 2021-07-24 21:10:37 -07:00
Kartik K. Agaram
1eb1ac81ea . 2021-07-19 20:08:30 -07:00
Kartik K. Agaram
4b5a6f6c30 . 2021-07-19 20:05:00 -07:00
Kartik K. Agaram
8be28fdd46 error message when trying to jump to primitive 2021-07-19 19:58:10 -07:00
Kartik K. Agaram
7204135203 . 2021-07-19 19:55:10 -07:00
Kartik K. Agaram
916d011753 . 2021-07-19 19:52:24 -07:00
Kartik K. Agaram
c0db806820 . 2021-07-19 19:46:04 -07:00
Kartik K. Agaram
542773df2f render functions in MRU order 2021-07-19 15:39:36 -07:00
Kartik K. Agaram
b22e6ebfe2 . 2021-07-17 00:23:52 -07:00
Kartik K. Agaram
ac45f09715 . 2021-07-16 06:13:51 -07:00
Kartik K. Agaram
13ef6b6202 . 2021-07-08 16:20:17 -07:00
Kartik K. Agaram
cbf22e7ab2 primitives for double-buffering
I thought I needed these for this bouncing-ball demo:

  def (bounce screen)
    with (w (width screen)
          h (height screen)
          cx 16
          cy 16
          dx 12
          dy 19)
      while 1
        clear screen
        ring screen cx cy 16 3 5
        cx += dx
        cy += dy
        when (or (cx > w) (cx < 0))
          set dx 0-dx
        when (or (cy > h) (cy < 0))
          set dy 0-dy
        for _ 0 (< _ 100) ++_         # delay

No matter how I adjusted the delay I couldn't get rid of the jitter. So
I built a double-buffered version:

    (bounce2 . [def (bounce2 screen)
  with (w (width screen)
        h (height screen)
        cx 16
        cy 16
        dx 12
        dy 19
        screen2 (new_screen (columns screen)
                            (lines screen)))
      while 1
        clear screen2
        ring screen2 cx cy 16 3 5
        cx += dx
        cy += dy
        when (or (cx > w) (cx < 0))
          set dx 0-dx
        when (or (cy > h) (cy < 0))
          set dy 0-dy
        blit screen2 screen
        for _ 0 (< _ 100) ++_])       # delay

But it didn't make a difference! Turns out nothing will help you when
successive frames are too far apart. This is the correct tweak to
`bounce`:

  -       dx 12
  -       dy 19)
  +       dx 1
  +       dy (/ 19 12))

Still, we'll keep double-buffering around for the future.
2021-07-05 23:18:30 -07:00