about summary refs log tree commit diff stats
path: root/shell/sandbox.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-15 22:51:08 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-15 22:56:59 -0700
commit6392f1fde9a1177085954e42b9517f73acac88fe (patch)
treef00df23728ed5f2789930a183084d6f777ed2d75 /shell/sandbox.mu
parentde993bc0cdb7202390c9ed1d0c4e0a5b33d1d0ee (diff)
downloadmu-6392f1fde9a1177085954e42b9517f73acac88fe.tar.gz
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.
Diffstat (limited to 'shell/sandbox.mu')
-rw-r--r--shell/sandbox.mu2
1 files changed, 1 insertions, 1 deletions
diff --git a/shell/sandbox.mu b/shell/sandbox.mu
index 6355baa8..b1b8c7e3 100644
--- a/shell/sandbox.mu
+++ b/shell/sandbox.mu
@@ -31,7 +31,7 @@ fn initialize-sandbox _self: (addr sandbox), screen-and-keyboard?: boolean {
   var trace-ah/eax: (addr handle trace) <- get self, trace
   allocate trace-ah
   var trace/eax: (addr trace) <- lookup *trace-ah
-  initialize-trace trace, 0x1000/lines, 0x80/visible-lines
+  initialize-trace trace, 0x4000/lines, 0x80/visible-lines
   var cursor-in-data?/eax: (addr boolean) <- get self, cursor-in-data?
   copy-to *cursor-in-data?, 1/true
 }