blob is binary.
7cf300273d3548da2e0'>^
index : mu | |
Soul of a tiny new machine. More thorough tests → More comprehensible and rewrite-friendly software → More resilient society. | Kartik K. Agaram <vc@akkartik.com> |
about summary refs log blame commit diff stats |
# Draw pixels in response to keyboard events, starting from the top-left
# and in raster order.
#
# To build a disk image:
# ./translate_mu_baremetal baremetal/ex3.mu # emits disk.img
# To run:
# qemu-system-i386 disk.img
# Or:
# bochs -f baremetal/boot.bochsrc # boot.bochsrc loads disk.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)
fn main {
var x/ecx: int <- copy 0
var y/edx: int <- copy 0
{
var key/eax: byte <- read-key 0/keyboard
compare key, 0
loop-if-= # busy wait
pixel-on-real-screen x, y, 0x31/green
x <- increment
compare x, 0x400/screen-width=1024
{
break-if-<
y <- increment
x <- copy 0
}
loop
}
}