https://github.com/akkartik/mu/blob/main/baremetal/503manhattan-line.mu
1 fn draw-box-on-real-screen x1: int, y1: int, x2: int, y2: int, color: int {
2 draw-horizontal-line-on-real-screen x1, x2, y1, color
3 draw-vertical-line-on-real-screen x1, y1, y2, color
4 draw-horizontal-line-on-real-screen x1, x2, y2, color
5 draw-vertical-line-on-real-screen x2, y1, y2, color
6 }
7
8 fn draw-horizontal-line-on-real-screen x1: int, x2: int, y: int, color: int {
9 var x/eax: int <- copy x1
10 {
11 compare x, x2
12 break-if->=
13 pixel-on-real-screen x, y, color
14 x <- increment
15 loop
16 }
17 }
18
19 fn draw-vertical-line-on-real-screen x: int, y1: int, y2: int, color: int {
20 var y/eax: int <- copy y1
21 {
22 compare y, y2
23 break-if->=
24 pixel-on-real-screen x, y, color
25 y <- increment
26 loop
27 }
28 }