diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-12-29 21:08:05 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-12-29 21:08:05 -0800 |
commit | 0daf12c59aa8a6b9d996f56797b6f74c3aa0a738 (patch) | |
tree | f10222abdb7e7273cd6ff4974bd31280b808b645 /baremetal/ex2.mu | |
parent | 63a247fcd4c7597c93e28fc92e489a7882ae2d7c (diff) | |
download | mu-0daf12c59aa8a6b9d996f56797b6f74c3aa0a738.tar.gz |
7469 - first working baremetal Mu program
It doesn't _quite_ do what it should, so this is more precisely the first _buggy_ baremetal Mu program. But the tooling works, at least.
Diffstat (limited to 'baremetal/ex2.mu')
-rw-r--r-- | baremetal/ex2.mu | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/baremetal/ex2.mu b/baremetal/ex2.mu new file mode 100644 index 00000000..091cb1d0 --- /dev/null +++ b/baremetal/ex2.mu @@ -0,0 +1,31 @@ +# Test out the video mode by filling in the screen with pixels. +# +# To build a disk image: +# ./translate_subx_baremetal baremetal/ex2.subx # emits disk.img +# To run: +# qemu-system-i386 disk.img +# Or: +# bochs -f baremetal/boot.bochsrc # boot.bochsrc loads disk.img +# +# Expected output: +# html/baremetal.png + +fn main { + var y/eax: int <- copy 0 + { + compare y, 0x300 # 768 + break-if->= + var color/ecx: int <- copy y + color <- and 0xff + var x/edx: int <- copy 0 + { + compare x, 0x400 # 1024 + break-if->= + pixel 0, x, y, color + x <- increment + loop + } + y <- increment + loop + } +} |