Commit Graph

38 Commits

Author SHA1 Message Date
Kartik K. Agaram f5ece0451b start cleaning up pixel graphics
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.
2021-04-19 10:47:30 -07:00
Kartik K. Agaram 97df52bf2f shell: ctrl-r runs on real screen without a trace
We run out of memory fairly early in the course of drawing a chessboard
on the whole screen.
2021-04-17 23:52:52 -07:00
Kartik K. Agaram c11ea74442 . 2021-04-17 22:53:45 -07:00
Kartik K. Agaram c026dba006 shell: reenable the trace
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.
2021-04-17 22:33:28 -07:00
Kartik K. Agaram 1354161a36 tmp: debugging why brline prints no pixels
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.
2021-04-17 08:34:48 -07:00
Kartik K. Agaram f66de61392 handle drawing 16*4 = 64 pixels
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)))
  )
2021-04-16 20:26:56 -07:00
Kartik K. Agaram 6392f1fde9 first session programming _within_ the Mu computer
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.
2021-04-15 22:56:59 -07:00
Kartik K. Agaram 9d367ec2ed shell: start persisting global bindings 2021-04-15 21:05:55 -07:00
Kartik K. Agaram 0f760bd60c . 2021-04-15 20:56:52 -07:00
Kartik K. Agaram 0192e2031f . 2021-04-15 20:12:36 -07:00
Kartik K. Agaram 91e30acbd8 . 2021-04-15 20:07:07 -07:00
Kartik K. Agaram 613b1d5734 parse dotted lists 2021-04-15 19:47:01 -07:00
Kartik K. Agaram 5a46430e0e . 2021-04-14 21:47:59 -07:00
Kartik K. Agaram 31b4368079 shell: word/line navigation 2021-04-14 20:09:25 -07:00
Kartik K. Agaram bbabe8bd1a shell: pixel graphics 2021-04-13 22:27:59 -07:00
Kartik K. Agaram 1afc02113a shell: fake keyboard 2021-04-10 22:28:24 -07:00
Kartik K. Agaram e93bbec63b shell: start jumping to keyboard using Tab 2021-04-10 22:14:20 -07:00
Kartik K. Agaram 770cac9412 shell: UI now showing fake keyboard
But we don't actually support fake keyboards anywhere yet.
2021-04-10 21:20:46 -07:00
Kartik K. Agaram a509279aea shell: start on support for fake keyboard 2021-04-10 20:49:20 -07:00
Kartik K. Agaram 400574f956 shell: move fake screen to sandbox 2021-04-10 20:44:26 -07:00
Kartik K. Agaram 6fa86619b2 shell: tweaks for fake screens
- make them more discoverable
- clear them between commands
2021-04-10 20:09:18 -07:00
Kartik K. Agaram 90748fa45d shell: render fake screens
'print' turns out to not be working yet.
2021-04-10 17:42:35 -07:00
Kartik K. Agaram 97cffa20d4 shell: start of 'print' primitive 2021-04-10 15:59:40 -07:00
Kartik K. Agaram f21e224fcd . 2021-04-08 23:04:30 -07:00
Kartik K. Agaram d6d28b8c94 shell: create space to display globals 2021-04-08 22:19:24 -07:00
Kartik K. Agaram 26a1849895 shell: quote 2021-04-06 09:40:13 -07:00
Kartik K. Agaram 0db683ffdb shell: extensible array of globals
I'm not bothering with full dynamic scope for now.
2021-04-05 23:55:13 -07:00
Kartik K. Agaram 07bc1eeb90 shell: save repl input to disk before running 2021-04-05 23:09:05 -07:00
Kartik K. Agaram 463878a4a4 shell: clean up unimplemented menu items 2021-04-05 19:46:47 -07:00
Kartik K. Agaram 62a2442110 writes to disk now working
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.
2021-03-23 00:32:49 -07:00
Kartik K. Agaram aaf2941bfe . 2021-03-08 18:05:36 -08:00
Kartik K. Agaram d124be9cb6 strip spaces when tokenizing
Thanks Max Bernstein for reporting this.
2021-03-08 17:54:07 -08:00
Kartik K. Agaram e58980b4c8 get rid of ctrl-d/ctrl-u when browsing trace
Also clean up the menu. Mode-specific stuff goes after Tab.
2021-03-08 16:27:41 -08:00
Kartik K. Agaram 477e58f0b2 7860 2021-03-06 23:38:46 -08:00
Kartik K. Agaram 2454f72c8a 7854 - shell: symbol lookup 2021-03-05 06:19:21 -08:00
Kartik K. Agaram 091a4e4001 7851 - shell snapshot: symbol lookup 2021-03-05 05:28:28 -08:00
Kartik K. Agaram e5ff0c39a6 7849 - shell: literal numbers 2021-03-04 22:05:39 -08:00
Kartik K. Agaram 71e4f38129 7842 - new directory organization
Baremetal is now the default build target and therefore has its sources
at the top-level. Baremetal programs build using the phase-2 Mu toolchain
that requires a Linux kernel. This phase-2 codebase which used to be at
the top-level is now under the linux/ directory. Finally, the phase-2 toolchain,
while self-hosting, has a way to bootstrap from a C implementation, which
is now stored in linux/bootstrap. The bootstrap C implementation uses some
literate programming tools that are now in linux/bootstrap/tools.

So the whole thing has gotten inverted. Each directory should build one
artifact and include the main sources (along with standard library). Tools
used for building it are relegated to sub-directories, even though those
tools are often useful in their own right, and have had lots of interesting
programs written using them.

A couple of things have gotten dropped in this process:
  - I had old ways to run on just a Linux kernel, or with a Soso kernel.
    No more.
  - I had some old tooling for running a single test at the cursor. I haven't
    used that lately. Maybe I'll bring it back one day.

The reorg isn't done yet. Still to do:
  - redo documentation everywhere. All the README files, all other markdown,
    particularly vocabulary.md.
  - clean up how-to-run comments at the start of programs everywhere
  - rethink what to do with the html/ directory. Do we even want to keep
    supporting it?

In spite of these shortcomings, all the scripts at the top-level, linux/
and linux/bootstrap are working. The names of the scripts also feel reasonable.
This is a good milestone to take stock at.
2021-03-03 22:21:03 -08:00