about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-25 15:56:34 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-25 15:56:34 -0700
commit22a95bd813c284af582cac59a6ee490e2a0d4665 (patch)
tree166d4f60badd62bdddd6a6ccbee260d5875a07da
parent8185a605c6cf1995477954aa7868785e770f1c69 (diff)
downloadmu-22a95bd813c284af582cac59a6ee490e2a0d4665.tar.gz
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.
-rw-r--r--120allocate.subx2
-rw-r--r--shell/README.md8
-rw-r--r--shell/iterative-definitions.limg8
3 files changed, 11 insertions, 7 deletions
diff --git a/120allocate.subx b/120allocate.subx
index 639b9635..c4f954f8 100644
--- a/120allocate.subx
+++ b/120allocate.subx
@@ -28,7 +28,7 @@ Heap:  # allocation-descriptor
   # curr
   0x01000000/imm32  # 16 MB
   # limit
-  0x08000000/imm32  # 128 MB is how much RAM Qemu models by default
+  0x80000000/imm32  # 2 GB
 
 Next-alloc-id:  # int
   0x100/imm32  # save a few alloc ids for fake handles
diff --git a/shell/README.md b/shell/README.md
index 20dc3615..2f6d6bd0 100644
--- a/shell/README.md
+++ b/shell/README.md
@@ -9,11 +9,11 @@ $ ./translate shell/*.mu      # generates code.img
 
 2. Run it:
 ```sh
-$ qemu-system-i386 code.img
+$ qemu-system-i386 -m 2G code.img
 ```
 or:
 ```
-$ bochs -f bochsrc
+$ bochs -f bochsrc            # _much_ slower
 ```
 
 To save typing in a large s-expression, create a secondary disk for data:
@@ -34,7 +34,7 @@ $ cat iterative-definitions.limg |dd of=data.img conv=notrunc
 
 Now run with both code and data disks:
 ```sh
-$ qemu-system-i386 -hda code.img -hdb data.img
+$ qemu-system-i386 -m 2G -hda code.img -hdb data.img
 ```
 or:
 ```
@@ -58,7 +58,7 @@ may speed up emulation:
 As a complete example, here's the command I typically use on Linux:
 
 ```
-$ qemu-system-i386 -enable-kvm -hda code.img -hdb data.img
+$ qemu-system-i386 -m 2G -enable-kvm -hda code.img -hdb data.img
 ```
 
 *Known issues*
diff --git a/shell/iterative-definitions.limg b/shell/iterative-definitions.limg
index 315f12b0..c54a1229 100644
--- a/shell/iterative-definitions.limg
+++ b/shell/iterative-definitions.limg
@@ -66,15 +66,19 @@
     (chessboard . (fn () (screen px)
                     (chessboard1 screen px 0 15)))
     (chessboard1 . (fn () (screen px y color)
+                     (clear screen)
                      (while (< y (height screen))
                        (chessboard2 screen px y 0 color)
                        (set y (+ y px))
-                       (set color (- 15 color)))))
+                       (chessboard2 screen px y px color)
+                       (set y (+ y px)))))
     (chessboard2 . (fn () (screen px y x color)
                      (while (< x (width screen))
                        (fill_rect screen x y (+ x px) (+ y px) color)
                        (set x (+ x px))
-                       (set color (- 15 color)))))
+                       (set x (+ x px)))))
+    (main . (fn () (screen keyboard)
+              (chessboard screen 16)))
   ))
   (sandbox . (+ 1 2))
 )