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