https://github.com/akkartik/mu/blob/master/apps/tui.mu
 1 # Test some primitives for text-mode.
 2 #
 3 # To run:
 4 #   $ ./translate_mu apps/tui.mu
 5 #   $ ./a.elf
 6 
 7 fn main -> exit-status/ebx: int {
 8   var nrows/eax: int <- copy 0
 9   var ncols/ecx: int <- copy 0
10   nrows, ncols <- screen-size
11   enable-screen-grid-mode
12   move-cursor 5, 35
13   start-color 1, 0x7a
14   start-blinking
15   print-string "Hello world!"
16   reset-formatting
17   move-cursor 6, 35
18   print-string "tty dimensions: "
19   print-int32-to-screen nrows
20   print-string " rows, "
21   print-int32-to-screen ncols
22   print-string " rows\n"
23 
24   print-string "press a key to see its code: "
25   enable-keyboard-immediate-mode
26   var x/eax: byte <- read-key
27   enable-keyboard-type-mode
28   enable-screen-type-mode
29   print-string "You pressed "
30   print-int32-to-screen x
31   print-string "\n"
32   exit-status <- copy 0
33 }