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.
This commit is contained in:
Kartik K. Agaram 2021-04-25 15:56:34 -07:00
parent 8185a605c6
commit 22a95bd813
3 changed files with 11 additions and 7 deletions

View File

@ -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

View File

@ -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*

View File

@ -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))
)