about summary refs log tree commit diff stats
path: root/308allocate-array.subx
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 /308allocate-array.subx
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 '308allocate-array.subx')
0 files changed, 0 insertions, 0 deletions