From f774677854ca2f0affcccb362fb2c6b1c407df44 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 16 Apr 2021 20:26:42 -0700 Subject: [PATCH] . --- README.md | 6 +++--- bochsrc | 2 +- bochsrc.2disks | 2 +- boot0.hex | 8 ++++---- ex10.mu | 6 +++--- ex2.mu | 6 +++--- ex3.mu | 6 +++--- ex4.mu | 6 +++--- ex5.mu | 6 +++--- ex6.mu | 6 +++--- ex7.mu | 6 +++--- ex8.mu | 4 ++-- ex9.mu | 4 ++-- life.mu | 2 +- rpn.mu | 2 +- shell/README.md | 6 +++--- translate_subx | 6 +++--- translate_subx_emulated | 6 +++--- 18 files changed, 45 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 3d376ebe..82eda010 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ Here's the Mu computer running [Conway's Game of Life](https://en.wikipedia.org/ ```sh $ git clone https://github.com/akkartik/mu $ cd mu -$ ./translate life.mu # emit a bootable disk.img -$ qemu-system-i386 disk.img +$ ./translate life.mu # emit a bootable code.img +$ qemu-system-i386 code.img ``` screenshot of Game of Life running on the Mu computer @@ -94,7 +94,7 @@ Mu programs build natively either on Linux or on Windows using [WSL 2](https://d For Macs and other Unix-like systems, use the (much slower) emulator: ```sh -$ ./translate_emulated ex2.mu # ~2 mins to emit disk.img +$ ./translate_emulated ex2.mu # ~2 mins to emit code.img ``` Mu programs can be written for two very different environments: diff --git a/bochsrc b/bochsrc index cd5f046d..7a74312e 100644 --- a/bochsrc +++ b/bochsrc @@ -9,7 +9,7 @@ display_library: sdl2 -ata0-master: type=disk, path="disk.img", mode=flat, cylinders=20, heads=16, spt=63 # 10MB, 512 bytes per sector +ata0-master: type=disk, path="code.img", mode=flat, cylinders=20, heads=16, spt=63 # 10MB, 512 bytes per sector boot: disk mouse: enabled=1, toggle=ctrl+f10 log: - diff --git a/bochsrc.2disks b/bochsrc.2disks index c3e99ba9..a9550a9d 100644 --- a/bochsrc.2disks +++ b/bochsrc.2disks @@ -9,7 +9,7 @@ display_library: sdl2 -ata0-master: type=disk, path="disk.img", mode=flat, cylinders=20, heads=16, spt=63 # 10MB, 512 bytes per sector +ata0-master: type=disk, path="code.img", mode=flat, cylinders=20, heads=16, spt=63 # 10MB, 512 bytes per sector ata0-slave: type=disk, path="data.img", mode=flat, cylinders=20, heads=16, spt=63 # 10MB, 512 bytes per sector boot: disk mouse: enabled=1, toggle=ctrl+f10 diff --git a/boot0.hex b/boot0.hex index e1ea98bd..4753451e 100644 --- a/boot0.hex +++ b/boot0.hex @@ -9,14 +9,14 @@ # halts. # # To convert to a disk image, first prepare a realistically sized disk image: -# dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB +# dd if=/dev/zero of=code.img count=20160 # 512-byte sectors, so 10MB # Now fill in sectors: # bootstrap/bootstrap run hex < boot0.hex > boot.bin -# dd if=boot.bin of=disk.img conv=notrunc +# dd if=boot.bin of=code.img conv=notrunc # To run: -# qemu-system-i386 disk.img +# qemu-system-i386 code.img # Or: -# bochs -f bochsrc # bochsrc loads disk.img +# bochs -f bochsrc # bochsrc loads code.img # # Since we start out in 16-bit mode, we need instructions SubX doesn't # support. diff --git a/ex10.mu b/ex10.mu index ddea539a..858c4a25 100644 --- a/ex10.mu +++ b/ex10.mu @@ -1,11 +1,11 @@ # Demo of mouse support. # # To build a disk image: -# ./translate ex10.mu # emits disk.img +# ./translate ex10.mu # emits code.img # To run: -# qemu-system-i386 disk.img +# qemu-system-i386 code.img # Or: -# bochs -f bochsrc # bochsrc loads disk.img +# bochs -f bochsrc # bochsrc loads code.img # # Expected output: # Values between -256 and +255 as you move the mouse over the window. diff --git a/ex2.mu b/ex2.mu index f595510c..cd170aa7 100644 --- a/ex2.mu +++ b/ex2.mu @@ -1,11 +1,11 @@ # Test out the video mode by filling in the screen with pixels. # # To build a disk image: -# ./translate ex2.mu # emits disk.img +# ./translate ex2.mu # emits code.img # To run: -# qemu-system-i386 disk.img +# qemu-system-i386 code.img # Or: -# bochs -f bochsrc # bochsrc loads disk.img +# bochs -f bochsrc # bochsrc loads code.img fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) { var y/eax: int <- copy 0 diff --git a/ex3.mu b/ex3.mu index bf4af1d9..b90af18b 100644 --- a/ex3.mu +++ b/ex3.mu @@ -2,11 +2,11 @@ # and in raster order. # # To build a disk image: -# ./translate ex3.mu # emits disk.img +# ./translate ex3.mu # emits code.img # To run: -# qemu-system-i386 disk.img +# qemu-system-i386 code.img # Or: -# bochs -f bochsrc # bochsrc loads disk.img +# bochs -f bochsrc # bochsrc loads code.img # # Expected output: a new green pixel starting from the top left corner of the # screen every time you press a key (letter or digit) diff --git a/ex4.mu b/ex4.mu index caed4e5c..ec43c3e0 100644 --- a/ex4.mu +++ b/ex4.mu @@ -1,11 +1,11 @@ # Draw a character using the built-in font (GNU unifont) # # To build a disk image: -# ./translate ex4.mu # emits disk.img +# ./translate ex4.mu # emits code.img # To run: -# qemu-system-i386 disk.img +# qemu-system-i386 code.img # Or: -# bochs -f bochsrc # bochsrc loads disk.img +# bochs -f bochsrc # bochsrc loads code.img # # Expected output: letter 'A' in green near the top-left corner of screen diff --git a/ex5.mu b/ex5.mu index 6f776d16..7a915ea7 100644 --- a/ex5.mu +++ b/ex5.mu @@ -2,11 +2,11 @@ # Also demonstrates bounds-checking _before_ drawing. # # To build a disk image: -# ./translate ex5.mu # emits disk.img +# ./translate ex5.mu # emits code.img # To run: -# qemu-system-i386 disk.img +# qemu-system-i386 code.img # Or: -# bochs -f bochsrc # bochsrc loads disk.img +# bochs -f bochsrc # bochsrc loads code.img # # Expected output: text in green near the top-left corner of screen diff --git a/ex6.mu b/ex6.mu index 16aa34eb..cae98e36 100644 --- a/ex6.mu +++ b/ex6.mu @@ -1,11 +1,11 @@ # Drawing ASCII text incrementally. # # To build a disk image: -# ./translate ex6.mu # emits disk.img +# ./translate ex6.mu # emits code.img # To run: -# qemu-system-i386 disk.img +# qemu-system-i386 code.img # Or: -# bochs -f bochsrc # bochsrc loads disk.img +# bochs -f bochsrc # bochsrc loads code.img # # Expected output: a box and text that doesn't overflow it diff --git a/ex7.mu b/ex7.mu index ea4bf6aa..4ddd754a 100644 --- a/ex7.mu +++ b/ex7.mu @@ -1,11 +1,11 @@ # Cursor-based motions. # # To build a disk image: -# ./translate ex7.mu # emits disk.img +# ./translate ex7.mu # emits code.img # To run: -# qemu-system-i386 disk.img +# qemu-system-i386 code.img # Or: -# bochs -f bochsrc # bochsrc loads disk.img +# bochs -f bochsrc # bochsrc loads code.img # # Expected output: an interactive game a bit like "snakes". Try pressing h, j, # k, l. diff --git a/ex8.mu b/ex8.mu index 7e1f1b9c..64c0c24f 100644 --- a/ex8.mu +++ b/ex8.mu @@ -1,9 +1,9 @@ # Demo of floating-point support. # # To build a disk image: -# ./translate ex8.mu # emits disk.img +# ./translate ex8.mu # emits code.img # To run: -# bochs -f bochsrc # bochsrc loads disk.img +# bochs -f bochsrc # bochsrc loads code.img # Set a breakpoint at 0x7c00 and start stepping. fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) { diff --git a/ex9.mu b/ex9.mu index 1b2cae5e..e0767d9c 100644 --- a/ex9.mu +++ b/ex9.mu @@ -1,7 +1,7 @@ # Demo of reading and writing to disk. # # Steps for trying it out: -# 1. Translate this example into a disk image disk.img. +# 1. Translate this example into a disk image code.img. # ./translate ex9.mu # 2. Build a second disk image data.img containing some text. # dd if=/dev/zero of=data.img count=20160 @@ -9,7 +9,7 @@ # 3. Familiarize yourself with how the data disk looks within xxd: # xxd data.img |head # 4. Run in an emulator, either Qemu or Bochs. -# qemu-system-i386 -hda disk.img -hdb data.img +# qemu-system-i386 -hda code.img -hdb data.img # bochs -f bochsrc.2disks # 5. Exit the emulator. # 6. Notice that the data disk now contains the word count of the original text. diff --git a/life.mu b/life.mu index 829443b7..b3947434 100644 --- a/life.mu +++ b/life.mu @@ -3,7 +3,7 @@ # To build: # $ ./translate life.mu # To run: -# $ qemu-system-i386 disk.img +# $ qemu-system-i386 code.img fn state _grid: (addr array boolean), x: int, y: int -> _/eax: boolean { # clip at the edge diff --git a/rpn.mu b/rpn.mu index 8214e420..88053e7c 100644 --- a/rpn.mu +++ b/rpn.mu @@ -7,7 +7,7 @@ # $ ./translate rpn.mu # # Example session: -# $ qemu-system-i386 disk.img +# $ qemu-system-i386 code.img # > 4 # 4 # > 5 3 - diff --git a/shell/README.md b/shell/README.md index 76ecccea..d6072bf8 100644 --- a/shell/README.md +++ b/shell/README.md @@ -4,12 +4,12 @@ Currently runs a tiny subset of Lisp. Steps to run it from the top-level: 1. Build it: ```sh -$ ./translate shell/*.mu # generates disk.img +$ ./translate shell/*.mu # generates code.img ``` 2. Run it: ```sh -$ qemu-system-i386 disk.img +$ qemu-system-i386 code.img ``` or: ``` @@ -28,7 +28,7 @@ $ echo '(+ 1 1)' |dd of=data.img conv=notrunc Now run with both code and data disks: ```sh -$ qemu-system-i386 -hda disk.img -hdb data.img +$ qemu-system-i386 -hda code.img -hdb data.img ``` or: ``` diff --git a/translate_subx b/translate_subx index 08519d9f..4b730088 100755 --- a/translate_subx +++ b/translate_subx @@ -30,9 +30,9 @@ cat a.pack |linux/survey_baremetal > a.survey cat a.survey |linux/hex > a.bin -# Create disk.img containing a.bin -dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB -dd if=a.bin of=disk.img conv=notrunc +# Create code.img containing a.bin +dd if=/dev/zero of=code.img count=20160 # 512-byte sectors, so 10MB +dd if=a.bin of=code.img conv=notrunc if [ `stat --printf="%s" a.bin` -ge 193536 ] # 6 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.subx) then diff --git a/translate_subx_emulated b/translate_subx_emulated index d5120f48..7d35a988 100755 --- a/translate_subx_emulated +++ b/translate_subx_emulated @@ -25,9 +25,9 @@ cat a.pack |linux/bootstrap/bootstrap run linux/survey_baremetal > a.su cat a.survey |linux/bootstrap/bootstrap run linux/hex > a.bin -# Create disk.img containing a.bin -dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB -dd if=a.bin of=disk.img conv=notrunc +# Create code.img containing a.bin +dd if=/dev/zero of=code.img count=20160 # 512-byte sectors, so 10MB +dd if=a.bin of=code.img conv=notrunc if [ `stat --printf="%s" a.bin` -ge 193536 ] # 6 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.subx) then