' content='index, nofollow'/>
summary refs log blame commit diff stats
path: root/TODO
blob: 44de45aa0cfdd3b8fcbe2b248be75501428aeb58 (plain) (tree)
b54
# Draw pixels in response to keyboard events, starting from the top-left
# and in raster order.
#
# To build a disk image:
#   ./translate apps/ex3.mu        # emits code.img
# To run:
#   qemu-system-i386 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)

fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
  var x/ecx: int <- copy 0
  var y/edx: int <- copy 0
  {
    var key/eax: byte <- read-key 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
  }
}
e='Blame the previous revision' href='/akspecs/ranger/blame/TODO?h=v1.9.1&id=f24e301824daff6cd5513c6931a05bd305ba11e5'>^
1
2
3
4
5
6
7
8
9
10
11