https://github.com/akkartik/mu/blob/main/ex7.mu
1
2
3
4
5
6
7
8
9
10
11
12
13 fn main {
14 var space/eax: grapheme <- copy 0x20
15 set-cursor-position 0/screen, 0, 0
16 {
17 draw-cursor 0/screen, space
18 var key/eax: byte <- read-key 0/keyboard
19 {
20 compare key, 0x68/h
21 break-if-!=
22 draw-code-point-at-cursor 0/screen, 0x2d/dash, 0x31/fg, 0/bg
23 move-cursor-left 0
24 }
25 {
26 compare key, 0x6a/j
27 break-if-!=
28 draw-code-point-at-cursor 0/screen, 0x7c/vertical-bar, 0x31/fg, 0/bg
29 move-cursor-down 0
30 }
31 {
32 compare key, 0x6b/k
33 break-if-!=
34 draw-code-point-at-cursor 0/screen, 0x7c/vertical-bar, 0x31/fg, 0/bg
35 move-cursor-up 0
36 }
37 {
38 compare key, 0x6c/l
39 break-if-!=
40 var g/eax: code-point <- copy 0x2d/dash
41 draw-code-point-at-cursor 0/screen, 0x2d/dash, 0x31/fg, 0/bg
42 move-cursor-right 0
43 }
44 loop
45 }
46 }