https://github.com/akkartik/mu/blob/master/apps/tile/box.mu
 1 fn draw-box screen: (addr screen), row1: int, col1: int, row2: int, col2: int {
 2   draw-horizontal-line screen, row1, col1, col2
 3   draw-vertical-line screen, row1, row2, col1
 4   draw-horizontal-line screen, row2, col1, col2
 5   draw-vertical-line screen, row1, row2, col2
 6 }
 7 
 8 fn draw-hatching screen: (addr screen), row1: int, col1: int, row2: int, col2: int {
 9   var c/eax: int <- copy col1
10   var r1/ecx: int <- copy row1
11   r1 <- increment
12   c <- add 2
13   {
14     compare c, col2
15     break-if->=
16     draw-vertical-line screen, r1, row2, c
17     c <- add 2
18     loop
19   }
20 }
21 
22 fn draw-horizontal-line screen: (addr screen), row: int, col1: int, col2: int {
23   var col/eax: int <- copy col1
24   move-cursor 0, row, col
25   {
26     compare col, col2
27     break-if->=
28     print-code-point screen, 0x2500
29     col <- increment
30     loop
31   }
32 }
33 
34 fn draw-vertical-line screen: (addr screen), row1: int, row2: int, col: int {
35   var row/eax: int <- copy row1
36   {
37     compare row, row2
38     break-if->=
39     move-cursor 0, row, col
40     print-code-point screen, 0x2502
41     row <- increment
42     loop
43   }
44 }
45 
46 # erase parts of screen the slow way
47 fn clear-rect screen: (addr screen), row1: int, col1: int, row2: int, col2: int {
48   var i/eax: int <- copy row1
49   {
50     compare i, row2
51     break-if->
52     var j/ecx: int <- copy col1
53     move-cursor screen, i, j
54     {
55       compare j, col2
56       break-if->
57       print-grapheme screen 0x20  # space
58       j <- increment
59       loop
60     }
61     i <- increment
62     loop
63   }
64 }
65 
66 fn clear-rect2 screen: (addr screen), row1: int, col1: int, w: int, h: int {
67   var i/eax: int <- copy 0
68   var curr-row/esi: int <- copy row1
69   {
70     compare i, w
71     break-if->=
72     move-cursor screen, curr-row, col1
73     var j/ecx: int <- copy 0
74     {
75       compare j, h
76       break-if->=
77       print-grapheme screen 0x20  # space
78       j <- increment
79       loop
80     }
81     i <- increment
82     curr-row <- increment
83     loop
84   }
85 }