diff options
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | apps/boot0.hex (renamed from boot0.hex) | 2 | ||||
-rw-r--r-- | apps/colors.mu (renamed from colors.mu) | 2 | ||||
-rw-r--r-- | apps/ex1.mu | 14 | ||||
-rw-r--r-- | apps/ex10.mu (renamed from ex10.mu) | 2 | ||||
-rw-r--r-- | apps/ex10.mu. | 176 | ||||
-rw-r--r-- | apps/ex11.mu (renamed from ex11.mu) | 2 | ||||
-rw-r--r-- | apps/ex12.mu (renamed from ex12.mu) | 2 | ||||
-rw-r--r-- | apps/ex2.mu (renamed from ex2.mu) | 2 | ||||
-rw-r--r-- | apps/ex3.mu (renamed from ex3.mu) | 2 | ||||
-rw-r--r-- | apps/ex4.mu (renamed from ex4.mu) | 2 | ||||
-rw-r--r-- | apps/ex5.mu (renamed from ex5.mu) | 2 | ||||
-rw-r--r-- | apps/ex6.mu (renamed from ex6.mu) | 2 | ||||
-rw-r--r-- | apps/ex7.mu (renamed from ex7.mu) | 2 | ||||
-rw-r--r-- | apps/ex8.mu (renamed from ex8.mu) | 2 | ||||
-rw-r--r-- | apps/ex9.mu (renamed from ex9.mu) | 2 | ||||
-rw-r--r-- | apps/hest-life.mu (renamed from hest-life.mu) | 8 | ||||
-rw-r--r-- | apps/img.mu (renamed from img.mu) | 2 | ||||
-rw-r--r-- | apps/life.mu (renamed from life.mu) | 2 | ||||
-rw-r--r-- | apps/mandelbrot-fixed.mu (renamed from mandelbrot-fixed.mu) | 4 | ||||
-rw-r--r-- | apps/mandelbrot-silhouette.mu (renamed from mandelbrot-silhouette.mu) | 4 | ||||
-rw-r--r-- | apps/mandelbrot.mu (renamed from mandelbrot.mu) | 4 | ||||
-rw-r--r-- | apps/rpn.mu (renamed from rpn.mu) | 2 | ||||
-rw-r--r-- | ex1.mu | 3 | ||||
-rw-r--r-- | linux/README.md | 8 | ||||
-rw-r--r-- | linux/apps/advent2017/1a.mu (renamed from linux/advent2017/1a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/1a.mu (renamed from linux/advent2020/1a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/1b.mu (renamed from linux/advent2020/1b.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/2a.mu (renamed from linux/advent2020/2a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/2b.mu (renamed from linux/advent2020/2b.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/3a.mu (renamed from linux/advent2020/3a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/3b.mu (renamed from linux/advent2020/3b.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/4a.mu (renamed from linux/advent2020/4a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/4b.mu (renamed from linux/advent2020/4b.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/5a.mu (renamed from linux/advent2020/5a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/5b.mu (renamed from linux/advent2020/5b.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/vimrc.vim (renamed from linux/advent2020/vimrc.vim) | 0 | ||||
-rw-r--r-- | linux/apps/arith.mu (renamed from linux/arith.mu) | 2 | ||||
-rw-r--r-- | linux/apps/crenshaw2-1.subx (renamed from linux/crenshaw2-1.subx) | 2 | ||||
-rw-r--r-- | linux/apps/crenshaw2-1b.subx (renamed from linux/crenshaw2-1b.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex1.mu (renamed from linux/ex1.mu) | 4 | ||||
-rw-r--r-- | linux/apps/ex1.subx | 20 | ||||
-rw-r--r-- | linux/apps/ex10.subx (renamed from linux/ex10.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex11.subx (renamed from linux/ex11.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex12.subx (renamed from linux/ex12.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex13.subx (renamed from linux/ex13.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex14.subx (renamed from linux/ex14.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex2.mu (renamed from linux/ex2.mu) | 2 | ||||
-rw-r--r-- | linux/apps/ex2.subx (renamed from linux/ex2.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex3.2.mu (renamed from linux/ex3.2.mu) | 2 | ||||
-rw-r--r-- | linux/apps/ex3.mu (renamed from linux/ex3.mu) | 2 | ||||
-rw-r--r-- | linux/apps/ex3.subx (renamed from linux/ex3.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex4.subx (renamed from linux/ex4.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex5.subx (renamed from linux/ex5.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex6.subx (renamed from linux/ex6.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex7.subx (renamed from linux/ex7.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex8.subx (renamed from linux/ex8.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex9.subx (renamed from linux/ex9.subx) | 2 | ||||
-rw-r--r-- | linux/apps/factorial.mu (renamed from linux/factorial.mu) | 2 | ||||
-rw-r--r-- | linux/apps/factorial.subx (renamed from linux/factorial.subx) | 2 | ||||
-rw-r--r-- | linux/apps/factorial2.subx (renamed from linux/factorial2.subx) | 2 | ||||
-rw-r--r-- | linux/apps/factorial3.subx (renamed from linux/factorial3.subx) | 2 | ||||
-rw-r--r-- | linux/apps/factorial4.subx (renamed from linux/factorial4.subx) | 2 | ||||
-rw-r--r-- | linux/apps/hello.mu (renamed from linux/hello.mu) | 2 | ||||
-rw-r--r-- | linux/apps/parse-int.mu (renamed from linux/parse-int.mu) | 2 | ||||
-rw-r--r-- | linux/apps/print-file.mu (renamed from linux/print-file.mu) | 2 | ||||
-rw-r--r-- | linux/apps/raytracing/1.cc (renamed from linux/raytracing/1.cc) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/1.cc.0 (renamed from linux/raytracing/1.cc.0) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/1.mu (renamed from linux/raytracing/1.mu) | 4 | ||||
-rw-r--r-- | linux/apps/raytracing/1.ppm (renamed from linux/raytracing/1.ppm) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/2.mu (renamed from linux/raytracing/2.mu) | 4 | ||||
-rw-r--r-- | linux/apps/raytracing/2.ppm (renamed from linux/raytracing/2.ppm) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/3.expected.ppm (renamed from linux/raytracing/3.expected.ppm) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/3.mu (renamed from linux/raytracing/3.mu) | 4 | ||||
-rw-r--r-- | linux/apps/raytracing/3.ppm (renamed from linux/raytracing/3.ppm) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/README.md (renamed from linux/raytracing/README.md) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/color.h (renamed from linux/raytracing/color.h) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/color.mu (renamed from linux/raytracing/color.mu) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/main.cc (renamed from linux/raytracing/main.cc) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/ray.h (renamed from linux/raytracing/ray.h) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/ray.mu (renamed from linux/raytracing/ray.mu) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/vec.mu (renamed from linux/raytracing/vec.mu) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/vec3.h (renamed from linux/raytracing/vec3.h) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/vimrc.vim (renamed from linux/raytracing/vimrc.vim) | 0 | ||||
-rw-r--r-- | linux/apps/rpn.mu (renamed from linux/rpn.mu) | 2 | ||||
-rw-r--r-- | linux/apps/texture.mu (renamed from linux/texture.mu) | 2 | ||||
-rw-r--r-- | linux/apps/tui.mu (renamed from linux/tui.mu) | 2 | ||||
-rwxr-xr-x | linux/bootstrap/build | 2 | ||||
-rw-r--r-- | linux/ex1.subx | 18 |
89 files changed, 293 insertions, 102 deletions
diff --git a/README.md b/README.md index 07fa7f2c..bf8a89d8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ 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 code.img +./translate apps/life.mu # emit a bootable code.img qemu-system-i386 code.img ``` @@ -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 code.img +./translate_emulated apps/ex2.mu # ~2 mins to emit code.img ``` Mu programs can be written for two very different environments: diff --git a/boot0.hex b/apps/boot0.hex index 4753451e..929d2fd9 100644 --- a/boot0.hex +++ b/apps/boot0.hex @@ -11,7 +11,7 @@ # To convert to a disk image, first prepare a realistically sized disk image: # 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 +# linux/bootstrap/bootstrap run linux/hex < apps/boot0.hex > boot.bin # dd if=boot.bin of=code.img conv=notrunc # To run: # qemu-system-i386 code.img diff --git a/colors.mu b/apps/colors.mu index 90f33454..78e58838 100644 --- a/colors.mu +++ b/apps/colors.mu @@ -2,7 +2,7 @@ # If we did this rigorously we'd need to implement cosines. So we won't. # # To build: -# $ ./translate colors.mu +# $ ./translate apps/colors.mu # # Example session: # $ qemu-system-i386 code.img diff --git a/apps/ex1.mu b/apps/ex1.mu new file mode 100644 index 00000000..a96bed07 --- /dev/null +++ b/apps/ex1.mu @@ -0,0 +1,14 @@ +# The simplest possible bare-metal program. +# +# To build a disk image: +# ./translate apps/ex1.mu # emits code.img +# To run: +# qemu-system-i386 code.img +# Or: +# bochs -f bochsrc # bochsrc loads code.img +# +# Expected output: blank screen with no errors + +fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) { + loop +} diff --git a/ex10.mu b/apps/ex10.mu index 858c4a25..05198738 100644 --- a/ex10.mu +++ b/apps/ex10.mu @@ -1,7 +1,7 @@ # Demo of mouse support. # # To build a disk image: -# ./translate ex10.mu # emits code.img +# ./translate apps/ex10.mu # emits code.img # To run: # qemu-system-i386 code.img # Or: diff --git a/apps/ex10.mu. b/apps/ex10.mu. new file mode 100644 index 00000000..35fea653 --- /dev/null +++ b/apps/ex10.mu. @@ -0,0 +1,176 @@ +# Demo of mouse support. +# +# To build a disk image: +# ./translate ex10.mu # emits disk.img +# To run: +# qemu-system-i386 disk.img +# Or: +# bochs -f bochsrc # bochsrc loads disk.img + +fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) { +#? var x/esi: int <- copy 0x200 +#? var y/edi: int <- copy 0x180 +#? render-grid x, y + $main:event-loop: { + # read deltas from mouse + var dx/eax: int <- copy 0 + var dy/ecx: int <- copy 0 + dx, dy <- read-mouse-event + # loop if deltas are both 0 + { + compare dx, 0 + break-if-!= + compare dy, 0 + break-if-!= + loop $main:event-loop + } + # render unclamped deltas +#? render-grid x, y + draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen screen, dx, 7/fg, 0/bg + draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 7/fg, 0/bg + draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen screen, dy, 7/fg, 0/bg + move-cursor-to-left-margin-of-next-line screen +#? { +#? var dummy1/eax: int <- copy 0 +#? var dummy2/ecx: int <- copy 0 +#? dummy1, dummy2 <- draw-text-wrapping-right-then-down-over-full-screen screen, " ", 0/x, 0x10/y, 0x31/fg, 0/bg +#? } +#? { +#? var ephemeral-dx/eax: int <- copy dx +#? var dummy/ecx: int <- copy 0 +#? ephemeral-dx, dummy <- draw-int32-decimal-wrapping-right-then-down-over-full-screen screen, ephemeral-dx, 0/x, 0x10/y, 0x31/fg, 0/bg +#? } +#? { +#? var dummy/eax: int <- copy 0 +#? var ephemeral-dy/ecx: int <- copy dy +#? dummy, ephemeral-dy <- draw-int32-decimal-wrapping-right-then-down-over-full-screen screen, ephemeral-dy, 5/x, 0x10/y, 0x31/fg, 0/bg +#? } +#? # clamp deltas +#? $clamp-dx: { +#? compare dx, -0xa +#? { +#? break-if-> +#? dx <- copy -0xa +#? break $clamp-dx +#? } +#? compare dx, 0xa +#? { +#? break-if-< +#? dx <- copy 0xa +#? break $clamp-dx +#? } +#? dx <- copy 0 +#? } +#? $clamp-dy: { +#? compare dy, -0xa +#? { +#? break-if-> +#? dy <- copy -0xa +#? break $clamp-dy +#? } +#? compare dy, 0xa +#? { +#? break-if-< +#? dy <- copy 0xa +#? break $clamp-dy +#? } +#? dy <- copy 0 +#? } +#? # render clamped deltas +#? { +#? var dummy1/eax: int <- copy 0 +#? var dummy2/ecx: int <- copy 0 +#? dummy1, dummy2 <- draw-text-wrapping-right-then-down-over-full-screen screen, " ", 0/x, 0x20/y, 0x31/fg, 0/bg +#? } +#? { +#? var save-dx/eax: int <- copy dx +#? var dummy/ecx: int <- copy 0 +#? save-dx, dummy <- draw-int32-decimal-wrapping-right-then-down-over-full-screen screen, save-dx, 0/x, 0x20/y, 0x31/fg, 0/bg +#? } +#? { +#? var dummy/eax: int <- copy 0 +#? var save-dy/ecx: int <- copy dy +#? dummy, save-dy <- draw-int32-decimal-wrapping-right-then-down-over-full-screen screen, save-dy, 5/x, 0x20/y, 0x31/fg, 0/bg +#? } +#? # loop if deltas are both 0 +#? { +#? compare dx, 0 +#? break-if-!= +#? compare dy, 0 +#? break-if-!= +#? loop $main:event-loop +#? } +#? # accumulate deltas and clamp result within screen bounds +#? x <- add dx +#? compare x, 0 +#? { +#? break-if->= +#? x <- copy 0 +#? } +#? compare x, 0x400 +#? { +#? break-if-< +#? x <- copy 0x3ff +#? } +#? y <- subtract dy # mouse y coordinates are reverse compared to screen +#? compare y, 0 +#? { +#? break-if->= +#? y <- copy 0 +#? } +#? compare y, 0x300 +#? { +#? break-if-< +#? y <- copy 0x2ff +#? } + loop + } +} + +#? fn render-grid curr-x: int, curr-y: int { +#? and-with curr-x, 0xfffffffc +#? and-with curr-y, 0xfffffffc +#? var y/eax: int <- copy 0 +#? { +#? compare y, 0x300/screen-height=768 +#? break-if->= +#? var x/edx: int <- copy 0 +#? { +#? compare x, 0x400/screen-width=1024 +#? break-if->= +#? var color/ecx: int <- copy 0 +#? # set color if either x or y is divisible by 4 +#? var tmp/ebx: int <- copy y +#? tmp <- and 3 +#? compare tmp, 0 +#? { +#? break-if-!= +#? color <- copy 3 +#? } +#? tmp <- copy x +#? tmp <- and 3 +#? compare tmp, 0 +#? { +#? break-if-!= +#? color <- copy 3 +#? } +#? # highlight color if x and y match curr-x and curr-y (quantized) +#? { +#? var xq/edx: int <- copy x +#? xq <- and 0xfffffffc +#? var yq/eax: int <- copy y +#? yq <- and 0xfffffffc +#? compare xq, curr-x +#? break-if-!= +#? compare yq, curr-y +#? break-if-!= +#? color <- copy 0xc +#? } +#? pixel-on-real-screen x, y, color +#? x <- increment +#? loop +#? } +#? y <- increment +#? loop +#? } +#? } diff --git a/ex11.mu b/apps/ex11.mu index c52deb2f..6b967724 100644 --- a/ex11.mu +++ b/apps/ex11.mu @@ -1,7 +1,7 @@ # Demo of an interactive app: controlling a Bezier curve on screen # # To build a disk image: -# ./translate ex11.mu # emits code.img +# ./translate apps/ex11.mu # emits code.img # To run: # qemu-system-i386 code.img # Or: diff --git a/ex12.mu b/apps/ex12.mu index fe97daa9..79c259b8 100644 --- a/ex12.mu +++ b/apps/ex12.mu @@ -1,7 +1,7 @@ # Checking the timer. # # To build a disk image: -# ./translate ex12.mu # emits code.img +# ./translate apps/ex12.mu # emits code.img # To run: # qemu-system-i386 code.img # Or: diff --git a/ex2.mu b/apps/ex2.mu index 0d301508..be66d883 100644 --- a/ex2.mu +++ b/apps/ex2.mu @@ -1,7 +1,7 @@ # Test out the video mode by filling in the screen with pixels. # # To build a disk image: -# ./translate ex2.mu # emits code.img +# ./translate apps/ex2.mu # emits code.img # To run: # qemu-system-i386 code.img # Or: diff --git a/ex3.mu b/apps/ex3.mu index b90af18b..155457c6 100644 --- a/ex3.mu +++ b/apps/ex3.mu @@ -2,7 +2,7 @@ # and in raster order. # # To build a disk image: -# ./translate ex3.mu # emits code.img +# ./translate apps/ex3.mu # emits code.img # To run: # qemu-system-i386 code.img # Or: diff --git a/ex4.mu b/apps/ex4.mu index ec43c3e0..9c3e28ee 100644 --- a/ex4.mu +++ b/apps/ex4.mu @@ -1,7 +1,7 @@ # Draw a character using the built-in font (GNU unifont) # # To build a disk image: -# ./translate ex4.mu # emits code.img +# ./translate apps/ex4.mu # emits code.img # To run: # qemu-system-i386 code.img # Or: diff --git a/ex5.mu b/apps/ex5.mu index 7a915ea7..07e8bc1a 100644 --- a/ex5.mu +++ b/apps/ex5.mu @@ -2,7 +2,7 @@ # Also demonstrates bounds-checking _before_ drawing. # # To build a disk image: -# ./translate ex5.mu # emits code.img +# ./translate apps/ex5.mu # emits code.img # To run: # qemu-system-i386 code.img # Or: diff --git a/ex6.mu b/apps/ex6.mu index cae98e36..fbad3c13 100644 --- a/ex6.mu +++ b/apps/ex6.mu @@ -1,7 +1,7 @@ # Drawing ASCII text incrementally. # # To build a disk image: -# ./translate ex6.mu # emits code.img +# ./translate apps/ex6.mu # emits code.img # To run: # qemu-system-i386 code.img # Or: diff --git a/ex7.mu b/apps/ex7.mu index 4ddd754a..bd0afd20 100644 --- a/ex7.mu +++ b/apps/ex7.mu @@ -1,7 +1,7 @@ # Cursor-based motions. # # To build a disk image: -# ./translate ex7.mu # emits code.img +# ./translate apps/ex7.mu # emits code.img # To run: # qemu-system-i386 code.img # Or: diff --git a/ex8.mu b/apps/ex8.mu index 64c0c24f..c5e695ed 100644 --- a/ex8.mu +++ b/apps/ex8.mu @@ -1,7 +1,7 @@ # Demo of floating-point support. # # To build a disk image: -# ./translate ex8.mu # emits code.img +# ./translate apps/ex8.mu # emits code.img # To run: # bochs -f bochsrc # bochsrc loads code.img # Set a breakpoint at 0x7c00 and start stepping. diff --git a/ex9.mu b/apps/ex9.mu index e0767d9c..30853c69 100644 --- a/ex9.mu +++ b/apps/ex9.mu @@ -2,7 +2,7 @@ # # Steps for trying it out: # 1. Translate this example into a disk image code.img. -# ./translate ex9.mu +# ./translate apps/ex9.mu # 2. Build a second disk image data.img containing some text. # dd if=/dev/zero of=data.img count=20160 # echo 'abc def ghi' |dd of=data.img conv=notrunc diff --git a/hest-life.mu b/apps/hest-life.mu index b9358587..62f2d945 100644 --- a/hest-life.mu +++ b/apps/hest-life.mu @@ -3,14 +3,14 @@ # https://ivanish.ca/hest-podcast # # To build: -# $ ./translate hest-life.mu +# $ ./translate apps/hest-life.mu # I run it on my 2.5GHz Linux laptop like this: -# $ qemu-system-i386 -enable-kvm code.img +# $ qemu-system-i386 code.img # # If things seem too fast or too slow on your computer, adjust the loop bounds # in the function `linger` at the bottom. Its value will depend on how you -# accelerate Qemu. Mu will eventually get a clock to obviate the need for this -# tuning. +# accelerate Qemu (`-accel help`). Mu will eventually get a clock to obviate +# the need for this tuning. # # Keyboard shortcuts: # space: pause/resume diff --git a/img.mu b/apps/img.mu index 8177ae6b..65b773c5 100644 --- a/img.mu +++ b/apps/img.mu @@ -1,7 +1,7 @@ # load an image from disk and display it on screen # # To build: -# $ ./translate img.mu # generates code.img +# $ ./translate apps/img.mu # generates code.img # Load a pbm, pgm or ppm image (no more than 255 levels) in the data disk # $ dd if=/dev/zero of=data.img count=20160 # $ dd if=x.pbm of=data.img conv=notrunc diff --git a/life.mu b/apps/life.mu index b3947434..a65347bf 100644 --- a/life.mu +++ b/apps/life.mu @@ -1,7 +1,7 @@ # Conway's Game of Life # # To build: -# $ ./translate life.mu +# $ ./translate apps/life.mu # To run: # $ qemu-system-i386 code.img diff --git a/mandelbrot-fixed.mu b/apps/mandelbrot-fixed.mu index b633cfe5..fc33aae1 100644 --- a/mandelbrot-fixed.mu +++ b/apps/mandelbrot-fixed.mu @@ -4,9 +4,9 @@ # $ git clone https://github.com/akkartik/mu # $ cd mu # Build on Linux: -# $ ./translate mandelbrot-fixed.mu +# $ ./translate apps/mandelbrot-fixed.mu # Build on other platforms (slow): -# $ ./translate_emulated mandelbrot-fixed.mu +# $ ./translate_emulated apps/mandelbrot-fixed.mu # Run: # $ qemu-system-i386 code.img diff --git a/mandelbrot-silhouette.mu b/apps/mandelbrot-silhouette.mu index fa1abaff..0d9a137c 100644 --- a/mandelbrot-silhouette.mu +++ b/apps/mandelbrot-silhouette.mu @@ -4,9 +4,9 @@ # $ git clone https://github.com/akkartik/mu # $ cd mu # Build on Linux: -# $ ./translate mandelbrot.mu +# $ ./translate apps/mandelbrot.mu # Build on other platforms (slow): -# $ ./translate_emulated mandelbrot.mu +# $ ./translate_emulated apps/mandelbrot.mu # Run: # $ qemu-system-i386 code.img diff --git a/mandelbrot.mu b/apps/mandelbrot.mu index 278fafc2..218fd4fa 100644 --- a/mandelbrot.mu +++ b/apps/mandelbrot.mu @@ -4,9 +4,9 @@ # $ git clone https://github.com/akkartik/mu # $ cd mu # Build on Linux: -# $ ./translate mandelbrot.mu +# $ ./translate apps/mandelbrot.mu # Build on other platforms (slow): -# $ ./translate_emulated mandelbrot.mu +# $ ./translate_emulated apps/mandelbrot.mu # Run: # $ qemu-system-i386 code.img diff --git a/rpn.mu b/apps/rpn.mu index a634c791..1f432365 100644 --- a/rpn.mu +++ b/apps/rpn.mu @@ -4,7 +4,7 @@ # Division not implemented yet. # # To build: -# $ ./translate rpn.mu +# $ ./translate apps/rpn.mu # # Example session: # $ qemu-system-i386 code.img diff --git a/ex1.mu b/ex1.mu deleted file mode 100644 index 0b379f60..00000000 --- a/ex1.mu +++ /dev/null @@ -1,3 +0,0 @@ -fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) { - loop -} diff --git a/linux/README.md b/linux/README.md index 8b81a386..0b8bc6fb 100644 --- a/linux/README.md +++ b/linux/README.md @@ -3,7 +3,7 @@ kernel. To run programs under this directory, you must first `cd` into it. ```sh $ cd linux/ - $ ./translate hello.mu # generates a.elf + $ ./translate apps/hello.mu # generates a.elf $ ./a.elf Hello world! ``` @@ -22,11 +22,11 @@ Some programs to try out: * `browse`: [A text-mode browser for a tiny subset of Markdown](https://mastodon.social/@akkartik/104845344081779025). -* `ex*`: small stand-alone examples that don't need any of the shared code at +* `apps/ex*`: small stand-alone examples that don't need any of the shared code at the top-level. They each have a simple pedagogical goal. Read these first. -* `factorial*`: A simple program to compute factorials in 5 versions, showing - all the different syntax sugars and what they expand to. +* `apps/factorial*`: A simple program to compute factorials in 5 versions, + showing all the different syntax sugars and what they expand to. The Mu compiler toolchain is also here in the following phases: diff --git a/linux/advent2017/1a.mu b/linux/apps/advent2017/1a.mu index 2f639080..aae12989 100644 --- a/linux/advent2017/1a.mu +++ b/linux/apps/advent2017/1a.mu @@ -7,7 +7,7 @@ # To build on Linux: # $ git clone https://github.com/akkartik/mu # $ cd mu/linux -# $ ./translate advent2017/1a.mu # emits a.elf +# $ ./translate apps/advent2017/1a.mu # emits a.elf # To run on Linux: # Download https://adventofcode.com/2017/day/1/input # $ ./a.elf < input diff --git a/linux/advent2020/1a.mu b/linux/apps/advent2020/1a.mu index 886329f1..da71340a 100644 --- a/linux/advent2020/1a.mu +++ b/linux/apps/advent2020/1a.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/1a.mu +# $ ./translate apps/advent2020/1a.mu # $ ./a.elf < input # found # 1353 667 diff --git a/linux/advent2020/1b.mu b/linux/apps/advent2020/1b.mu index bfdbe47c..a99709b8 100644 --- a/linux/advent2020/1b.mu +++ b/linux/apps/advent2020/1b.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/1b.mu +# $ ./translate apps/advent2020/1b.mu # $ ./a.elf < input # found # 143 407 1470 diff --git a/linux/advent2020/2a.mu b/linux/apps/advent2020/2a.mu index ce678eb8..44d50d46 100644 --- a/linux/advent2020/2a.mu +++ b/linux/apps/advent2020/2a.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/2a.mu +# $ ./translate apps/advent2020/2a.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/2b.mu b/linux/apps/advent2020/2b.mu index 121e9dfa..d0d23998 100644 --- a/linux/advent2020/2b.mu +++ b/linux/apps/advent2020/2b.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/2b.mu +# $ ./translate apps/advent2020/2b.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/3a.mu b/linux/apps/advent2020/3a.mu index d2dfc15e..6f95ddf1 100644 --- a/linux/advent2020/3a.mu +++ b/linux/apps/advent2020/3a.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/3a.mu +# $ ./translate apps/advent2020/3a.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/3b.mu b/linux/apps/advent2020/3b.mu index 7db91eea..8a4f442d 100644 --- a/linux/advent2020/3b.mu +++ b/linux/apps/advent2020/3b.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/3a.mu +# $ ./translate apps/advent2020/3a.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/4a.mu b/linux/apps/advent2020/4a.mu index 1b16712d..2efe475a 100644 --- a/linux/advent2020/4a.mu +++ b/linux/apps/advent2020/4a.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/4a.mu +# $ ./translate apps/advent2020/4a.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/4b.mu b/linux/apps/advent2020/4b.mu index 2dc6c6a2..e92e96e4 100644 --- a/linux/advent2020/4b.mu +++ b/linux/apps/advent2020/4b.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/4b.mu +# $ ./translate apps/advent2020/4b.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/5a.mu b/linux/apps/advent2020/5a.mu index 19d342c4..34e2e113 100644 --- a/linux/advent2020/5a.mu +++ b/linux/apps/advent2020/5a.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/5a.mu +# $ ./translate apps/advent2020/5a.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/5b.mu b/linux/apps/advent2020/5b.mu index e6a3520f..197ea885 100644 --- a/linux/advent2020/5b.mu +++ b/linux/apps/advent2020/5b.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/5b.mu +# $ ./translate apps/advent2020/5b.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/vimrc.vim b/linux/apps/advent2020/vimrc.vim index 348fe364..348fe364 100644 --- a/linux/advent2020/vimrc.vim +++ b/linux/apps/advent2020/vimrc.vim diff --git a/linux/arith.mu b/linux/apps/arith.mu index 5a9d5032..4393a34c 100644 --- a/linux/arith.mu +++ b/linux/apps/arith.mu @@ -7,7 +7,7 @@ # No division yet. # # To build: -# $ ./translate arith.mu +# $ ./translate apps/arith.mu # # Example session: # $ ./a.elf diff --git a/linux/crenshaw2-1.subx b/linux/apps/crenshaw2-1.subx index ade0399a..73c0f16e 100644 --- a/linux/crenshaw2-1.subx +++ b/linux/apps/crenshaw2-1.subx @@ -3,7 +3,7 @@ # except that we support hex digits. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx crenshaw2-1.subx -o crenshaw2-1 +# $ bootstrap/bootstrap translate [01]*.subx apps/crenshaw2-1.subx -o crenshaw2-1 # $ echo '3' |bootstrap/bootstrap run crenshaw2-1 # Expected output: # # syscall(exit, 3) diff --git a/linux/crenshaw2-1b.subx b/linux/apps/crenshaw2-1b.subx index d5b8194e..033c69c5 100644 --- a/linux/crenshaw2-1b.subx +++ b/linux/apps/crenshaw2-1b.subx @@ -3,7 +3,7 @@ # except that we support hex numbers of multiple digits. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx crenshaw2-1b.subx -o crenshaw2-1b +# $ bootstrap/bootstrap translate [01]*.subx apps/crenshaw2-1b.subx -o crenshaw2-1b # $ echo '1a' |bootstrap/bootstrap run crenshaw2-1b # Expected output: # # syscall(exit, 1a) diff --git a/linux/ex1.mu b/linux/apps/ex1.mu index fbf38d0c..36304803 100644 --- a/linux/ex1.mu +++ b/linux/apps/ex1.mu @@ -1,8 +1,10 @@ # First example: return the answer to the Ultimate Question of Life, the # Universe, and Everything. # +# Same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html +# # To run: -# $ ./translate ex1.mu +# $ ./translate apps/ex1.mu # $ ./a.elf # Expected result: # $ echo $? diff --git a/linux/apps/ex1.subx b/linux/apps/ex1.subx new file mode 100644 index 00000000..0406dbe8 --- /dev/null +++ b/linux/apps/ex1.subx @@ -0,0 +1,20 @@ +# First example: return the answer to the Ultimate Question of Life, the +# Universe, and Everything. +# +# Same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html +# +# To run: +# $ bootstrap/bootstrap translate apps/ex1.subx -o ex1 +# $ bootstrap/bootstrap run ex1 +# Expected result: +# $ echo $? +# 42 + +== code + +Entry: +# exit(42) +bb/copy-to-ebx 0x2a/imm32 # 42 in hex +e8/call syscall_exit/disp32 + +# . . vim:nowrap:textwidth=0 diff --git a/linux/ex10.subx b/linux/apps/ex10.subx index 2be53012..c4ce7e2d 100644 --- a/linux/ex10.subx +++ b/linux/apps/ex10.subx @@ -1,7 +1,7 @@ # String comparison: return 1 iff the two args passed in at the commandline are equal. # # To run: -# $ bootstrap/bootstrap translate ex10.subx -o ex10 +# $ bootstrap/bootstrap translate apps/ex10.subx -o ex10 # $ bootstrap/bootstrap run ex10 abc abd # Expected result: # $ echo $? diff --git a/linux/ex11.subx b/linux/apps/ex11.subx index d8596b8e..0ec5cc1a 100644 --- a/linux/ex11.subx +++ b/linux/apps/ex11.subx @@ -6,7 +6,7 @@ # a null-terminated 'kernel string' with a size-prefixed 'SubX string'. # # To run: -# $ bootstrap/bootstrap translate ex11.subx -o ex11 +# $ bootstrap/bootstrap translate apps/ex11.subx -o ex11 # $ bootstrap/bootstrap run ex11 # runs a series of tests # ...... # all tests pass # diff --git a/linux/ex12.subx b/linux/apps/ex12.subx index 4f1617a7..476d8cda 100644 --- a/linux/ex12.subx +++ b/linux/apps/ex12.subx @@ -2,7 +2,7 @@ # Create a new segment using mmap, save the address, write to it. # # To run: -# $ bootstrap/bootstrap translate ex12.subx -o ex12 +# $ bootstrap/bootstrap translate apps/ex12.subx -o ex12 # $ bootstrap/bootstrap run ex12 # You shouldn't get a segmentation fault. diff --git a/linux/ex13.subx b/linux/apps/ex13.subx index 862bf897..56028a05 100644 --- a/linux/ex13.subx +++ b/linux/apps/ex13.subx @@ -1,7 +1,7 @@ # Compare 3 and 3. # # To run: -# $ bootstrap/bootstrap translate ex13.subx -o ex13 +# $ bootstrap/bootstrap translate apps/ex13.subx -o ex13 # $ bootstrap/bootstrap run ex13 # Expected result: # $ echo $? diff --git a/linux/ex14.subx b/linux/apps/ex14.subx index 531bae7a..70aa8629 100644 --- a/linux/ex14.subx +++ b/linux/apps/ex14.subx @@ -1,7 +1,7 @@ # Multiply 2 numbers. # # To run: -# $ bootstrap/bootstrap translate ex14.subx -o ex14 +# $ bootstrap/bootstrap translate apps/ex14.subx -o ex14 # $ bootstrap/bootstrap run ex14 # Expected result: # $ echo $? diff --git a/linux/ex2.mu b/linux/apps/ex2.mu index 21dee1df..b3b74613 100644 --- a/linux/ex2.mu +++ b/linux/apps/ex2.mu @@ -1,7 +1,7 @@ # Add 3 and 4, and return the result in the exit code. # # To run: -# $ ./translate ex2.mu +# $ ./translate apps/ex2.mu # $ ./a.elf # Expected result: # $ echo $? diff --git a/linux/ex2.subx b/linux/apps/ex2.subx index 5ca39872..40955104 100644 --- a/linux/ex2.subx +++ b/linux/apps/ex2.subx @@ -1,7 +1,7 @@ # Add 3 and 4, and return the result in the exit code. # # To run: -# $ bootstrap/bootstrap translate ex2.subx -o ex2 +# $ bootstrap/bootstrap translate apps/ex2.subx -o ex2 # $ bootstrap/bootstrap run ex2 # Expected result: # $ echo $? diff --git a/linux/ex3.2.mu b/linux/apps/ex3.2.mu index 8ca6c992..c5992963 100644 --- a/linux/ex3.2.mu +++ b/linux/apps/ex3.2.mu @@ -1,7 +1,7 @@ # Unnecessarily use an array to sum 1..10 # # To run: -# $ ./translate ex3.2.mu +# $ ./translate apps/ex3.2.mu # $ ./a.elf # $ echo $? # 55 diff --git a/linux/ex3.mu b/linux/apps/ex3.mu index f96fd099..4ae3e93d 100644 --- a/linux/ex3.mu +++ b/linux/apps/ex3.mu @@ -1,7 +1,7 @@ # Add the first 10 numbers, and return the result in the exit code. # # To run: -# $ ./translate browse.mu +# $ ./translate ex3.mu # $ ./a.elf # Expected result: # $ echo $? diff --git a/linux/ex3.subx b/linux/apps/ex3.subx index 5b74d76c..f4b5fed7 100644 --- a/linux/ex3.subx +++ b/linux/apps/ex3.subx @@ -1,7 +1,7 @@ # Add the first 10 numbers, and return the result in the exit code. # # To run: -# $ bootstrap/bootstrap translate ex3.subx -o ex3 +# $ bootstrap/bootstrap translate apps/ex3.subx -o ex3 # $ bootstrap/bootstrap run ex3 # Expected result: # $ echo $? diff --git a/linux/ex4.subx b/linux/apps/ex4.subx index ee78ce7d..3bf62551 100644 --- a/linux/ex4.subx +++ b/linux/apps/ex4.subx @@ -1,7 +1,7 @@ # Read a character from stdin, save it to a global, write it to stdout. # # To run: -# $ bootstrap/bootstrap translate ex4.subx -o ex4 +# $ bootstrap/bootstrap translate apps/ex4.subx -o ex4 # $ bootstrap/bootstrap run ex4 == data diff --git a/linux/ex5.subx b/linux/apps/ex5.subx index e8957ea7..220a4246 100644 --- a/linux/ex5.subx +++ b/linux/apps/ex5.subx @@ -1,7 +1,7 @@ # Read a character from stdin, save it to a local on the stack, write it to stdout. # # To run: -# $ bootstrap/bootstrap translate ex5.subx -o ex5 +# $ bootstrap/bootstrap translate apps/ex5.subx -o ex5 # $ bootstrap/bootstrap run ex5 == code diff --git a/linux/ex6.subx b/linux/apps/ex6.subx index 5715e94f..cf6309e6 100644 --- a/linux/ex6.subx +++ b/linux/apps/ex6.subx @@ -1,7 +1,7 @@ # Print out a (global variable) string to stdout. # # To run: -# $ bootstrap/bootstrap translate ex6.subx -o ex6 +# $ bootstrap/bootstrap translate apps/ex6.subx -o ex6 # $ bootstrap/bootstrap run ex6 # Hello, world! diff --git a/linux/ex7.subx b/linux/apps/ex7.subx index ad1a50b6..c14fc19d 100644 --- a/linux/ex7.subx +++ b/linux/apps/ex7.subx @@ -5,7 +5,7 @@ # the character read. # # To run: -# $ bootstrap/bootstrap translate ex7.subx -o ex7 +# $ bootstrap/bootstrap translate apps/ex7.subx -o ex7 # $ bootstrap/bootstrap run ex7 # Expected result: # $ echo $? diff --git a/linux/ex8.subx b/linux/apps/ex8.subx index 909d1adb..2d962be4 100644 --- a/linux/ex8.subx +++ b/linux/apps/ex8.subx @@ -1,7 +1,7 @@ # Example reading commandline arguments: compute length of first arg. # # To run: -# $ bootstrap/bootstrap translate ex8.subx -o ex8 +# $ bootstrap/bootstrap translate apps/ex8.subx -o ex8 # $ bootstrap/bootstrap run ex8 abc de fghi # Expected result: # $ echo $? diff --git a/linux/ex9.subx b/linux/apps/ex9.subx index cbab3aa9..27520191 100644 --- a/linux/ex9.subx +++ b/linux/apps/ex9.subx @@ -4,7 +4,7 @@ # letter of second arg. # # To run: -# $ bootstrap/bootstrap translate ex9.subx -o ex9 +# $ bootstrap/bootstrap translate apps/ex9.subx -o ex9 # $ bootstrap/bootstrap run ex9 z x # Expected result: # $ echo $? diff --git a/linux/factorial.mu b/linux/apps/factorial.mu index 7eccc1ec..959d3bc0 100644 --- a/linux/factorial.mu +++ b/linux/apps/factorial.mu @@ -1,7 +1,7 @@ # compute the factorial of 5, and return the result in the exit code # # To run: -# $ ./translate factorial.mu +# $ ./translate apps/factorial.mu # $ ./a.elf # $ echo $? # 120 diff --git a/linux/factorial.subx b/linux/apps/factorial.subx index 1bcc0a9d..e36f892d 100644 --- a/linux/factorial.subx +++ b/linux/apps/factorial.subx @@ -1,7 +1,7 @@ ## compute the factorial of 5, and print the result # # To run: -# $ bootstrap/bootstrap translate [01]*.subx factorial.subx -o factorial +# $ bootstrap/bootstrap translate [01]*.subx apps/factorial.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? diff --git a/linux/factorial2.subx b/linux/apps/factorial2.subx index 16af9008..95450b3a 100644 --- a/linux/factorial2.subx +++ b/linux/apps/factorial2.subx @@ -4,7 +4,7 @@ # rm32 operands # # To run: -# $ ./translate_subx init.linux [01]*.subx factorial.subx -o factorial +# $ ./translate_subx init.linux [01]*.subx apps/factorial2.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? diff --git a/linux/factorial3.subx b/linux/apps/factorial3.subx index 72b76963..deb30377 100644 --- a/linux/factorial3.subx +++ b/linux/apps/factorial3.subx @@ -5,7 +5,7 @@ # function calls # # To run: -# $ ./translate_subx init.linux [01]*.subx factorial.subx -o factorial +# $ ./translate_subx init.linux [01]*.subx apps/factorial3.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? diff --git a/linux/factorial4.subx b/linux/apps/factorial4.subx index 219fce41..0707cfdd 100644 --- a/linux/factorial4.subx +++ b/linux/apps/factorial4.subx @@ -6,7 +6,7 @@ # control flow # # To run: -# $ ./translate_subx init.linux [01]*.subx factorial.subx -o factorial +# $ ./translate_subx init.linux [01]*.subx apps/factorial4.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? diff --git a/linux/hello.mu b/linux/apps/hello.mu index ac280b8a..debdf916 100644 --- a/linux/hello.mu +++ b/linux/apps/hello.mu @@ -1,7 +1,7 @@ # Meaningless conventional example. # # To run: -# $ ./translate hello.mu +# $ ./translate apps/hello.mu # $ ./a.elf fn main -> _/ebx: int { diff --git a/linux/parse-int.mu b/linux/apps/parse-int.mu index 8f572784..0f8c71d1 100644 --- a/linux/parse-int.mu +++ b/linux/apps/parse-int.mu @@ -1,7 +1,7 @@ # parse a decimal int at the commandline # # To run: -# $ ./translate parse-int.mu +# $ ./translate apps/parse-int.mu # $ ./a.elf 123 # $ echo $? # 123 diff --git a/linux/print-file.mu b/linux/apps/print-file.mu index 6dded6ba..75ce2e39 100644 --- a/linux/print-file.mu +++ b/linux/apps/print-file.mu @@ -2,7 +2,7 @@ # only ascii right now, just like the rest of Mu # # To run: -# $ ./translate print-file.mu +# $ ./translate apps/print-file.mu # $ echo abc > x # $ ./a.elf x # abc diff --git a/linux/raytracing/1.cc b/linux/apps/raytracing/1.cc index 254f531c..254f531c 100644 --- a/linux/raytracing/1.cc +++ b/linux/apps/raytracing/1.cc diff --git a/linux/raytracing/1.cc.0 b/linux/apps/raytracing/1.cc.0 index 13d5a1b6..13d5a1b6 100644 --- a/linux/raytracing/1.cc.0 +++ b/linux/apps/raytracing/1.cc.0 diff --git a/linux/raytracing/1.mu b/linux/apps/raytracing/1.mu index 8c92710f..dfb4ec13 100644 --- a/linux/raytracing/1.mu +++ b/linux/apps/raytracing/1.mu @@ -3,8 +3,8 @@ # # To run (on Linux): # $ git clone https://github.com/akkartik/mu -# $ cd mu -# $ ./translate raytracing/1.mu +# $ cd mu/linux +# $ ./translate apps/raytracing/1.mu # $ ./a.elf > 1.ppm fn main -> _/ebx: int { diff --git a/linux/raytracing/1.ppm b/linux/apps/raytracing/1.ppm index 902cc97f..902cc97f 100644 --- a/linux/raytracing/1.ppm +++ b/linux/apps/raytracing/1.ppm diff --git a/linux/raytracing/2.mu b/linux/apps/raytracing/2.mu index 7de89518..92e457d3 100644 --- a/linux/raytracing/2.mu +++ b/linux/apps/raytracing/2.mu @@ -2,8 +2,8 @@ # # To run (on Linux): # $ git clone https://github.com/akkartik/mu -# $ cd mu -# $ ./translate raytracing/2.mu +# $ cd mu/linux +# $ ./translate apps/raytracing/2.mu # $ ./a.elf > 2.ppm fn main -> _/ebx: int { diff --git a/linux/raytracing/2.ppm b/linux/apps/raytracing/2.ppm index 902cc97f..902cc97f 100644 --- a/linux/raytracing/2.ppm +++ b/linux/apps/raytracing/2.ppm diff --git a/linux/raytracing/3.expected.ppm b/linux/apps/raytracing/3.expected.ppm index 6d5b91ca..6d5b91ca 100644 --- a/linux/raytracing/3.expected.ppm +++ b/linux/apps/raytracing/3.expected.ppm diff --git a/linux/raytracing/3.mu b/linux/apps/raytracing/3.mu index c64ea035..beb37136 100644 --- a/linux/raytracing/3.mu +++ b/linux/apps/raytracing/3.mu @@ -2,8 +2,8 @@ # # To run (on Linux): # $ git clone https://github.com/akkartik/mu -# $ cd mu -# $ ./translate raytracing/3.mu +# $ cd mu/linux +# $ ./translate apps/raytracing/3.mu # $ ./a.elf > 3.ppm fn ray-color _in: (addr ray), _out: (addr rgb) { diff --git a/linux/raytracing/3.ppm b/linux/apps/raytracing/3.ppm index 6d5b91ca..6d5b91ca 100644 --- a/linux/raytracing/3.ppm +++ b/linux/apps/raytracing/3.ppm diff --git a/linux/raytracing/README.md b/linux/apps/raytracing/README.md index cc31c1af..cc31c1af 100644 --- a/linux/raytracing/README.md +++ b/linux/apps/raytracing/README.md diff --git a/linux/raytracing/color.h b/linux/apps/raytracing/color.h index a8a34b26..a8a34b26 100644 --- a/linux/raytracing/color.h +++ b/linux/apps/raytracing/color.h diff --git a/linux/raytracing/color.mu b/linux/apps/raytracing/color.mu index 86b3d0b6..86b3d0b6 100644 --- a/linux/raytracing/color.mu +++ b/linux/apps/raytracing/color.mu diff --git a/linux/raytracing/main.cc b/linux/apps/raytracing/main.cc index 35177279..35177279 100644 --- a/linux/raytracing/main.cc +++ b/linux/apps/raytracing/main.cc diff --git a/linux/raytracing/ray.h b/linux/apps/raytracing/ray.h index ed65168a..ed65168a 100644 --- a/linux/raytracing/ray.h +++ b/linux/apps/raytracing/ray.h diff --git a/linux/raytracing/ray.mu b/linux/apps/raytracing/ray.mu index 20cc42e9..20cc42e9 100644 --- a/linux/raytracing/ray.mu +++ b/linux/apps/raytracing/ray.mu diff --git a/linux/raytracing/vec.mu b/linux/apps/raytracing/vec.mu index 7caf7e88..7caf7e88 100644 --- a/linux/raytracing/vec.mu +++ b/linux/apps/raytracing/vec.mu diff --git a/linux/raytracing/vec3.h b/linux/apps/raytracing/vec3.h index d8341d36..d8341d36 100644 --- a/linux/raytracing/vec3.h +++ b/linux/apps/raytracing/vec3.h diff --git a/linux/raytracing/vimrc.vim b/linux/apps/raytracing/vimrc.vim index 348fe364..348fe364 100644 --- a/linux/raytracing/vimrc.vim +++ b/linux/apps/raytracing/vimrc.vim diff --git a/linux/rpn.mu b/linux/apps/rpn.mu index f849e05d..28132470 100644 --- a/linux/rpn.mu +++ b/linux/apps/rpn.mu @@ -4,7 +4,7 @@ # No division yet. # # To build: -# $ ./translate rpn.mu +# $ ./translate apps/rpn.mu # # Example session: # $ ./a.elf diff --git a/linux/texture.mu b/linux/apps/texture.mu index 8178424b..038a9790 100644 --- a/linux/texture.mu +++ b/linux/apps/texture.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate texture.mu +# $ ./translate apps/texture.mu # $ ./a.elf > a.ppm fn main -> _/ebx: int { diff --git a/linux/tui.mu b/linux/apps/tui.mu index b34c3e0a..4e58b986 100644 --- a/linux/tui.mu +++ b/linux/apps/tui.mu @@ -1,7 +1,7 @@ # Test some primitives for text-mode. # # To run: -# $ ./translate tui.mu +# $ ./translate apps/tui.mu # $ ./a.elf fn main -> _/ebx: int { diff --git a/linux/bootstrap/build b/linux/bootstrap/build index de5b432d..ee4b5546 100755 --- a/linux/bootstrap/build +++ b/linux/bootstrap/build @@ -99,7 +99,7 @@ grep -h "^\s*void test_" bootstrap.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |u older_than bootstrap_bin bootstrap.cc *_list && { $CXX $CXXFLAGS bootstrap.cc -o bootstrap_bin - echo + echo >&2 } exit 0 diff --git a/linux/ex1.subx b/linux/ex1.subx deleted file mode 100644 index 183c014a..00000000 --- a/linux/ex1.subx +++ /dev/null @@ -1,18 +0,0 @@ -# First program: same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html -# Just return 42. -# -# To run: -# $ bootstrap/bootstrap translate ex1.subx -o ex1 -# $ bootstrap/bootstrap run ex1 -# Expected result: -# $ echo $? -# 42 - -== code - -Entry: -# exit(42) -bb/copy-to-ebx 0x2a/imm32 # 42 in hex -e8/call syscall_exit/disp32 - -# . . vim:nowrap:textwidth=0 |