https://github.com/akkartik/mu/blob/main/linux/apps/texture.mu
1
2
3
4
5
6
7
8
9 fn main -> _/ebx: int {
10
11
12 var width/esi: int <- copy 0xff
13 var height/edi: int <- copy 0xff
14 print-string 0/screen, "P3\n"
15 print-int32-decimal 0/screen, width
16 print-string 0/screen, " "
17 print-int32-decimal 0/screen, height
18 print-string 0/screen, "\n"
19 print-string 0/screen, "255\n"
20 var row/ecx: int <- copy 0
21 {
22 compare row, height
23 break-if->=
24 var col/edx: int <- copy 0
25 {
26 compare col, width
27 break-if->=
28
29 var tmp/eax: int <- copy col
30 tmp <- multiply row
31 tmp <- and 0x7f
32 tmp <- add 0x80
33 tmp <- copy 0xff
34 print-int32-decimal 0/screen, tmp
35 print-string 0/screen, " "
36
37 tmp <- copy row
38 tmp <- multiply col
39 tmp <- and 0x7f
40 tmp <- add 0x80
41
42 print-int32-decimal 0/screen, tmp
43 print-string 0/screen, " "
44
45 tmp <- copy row
46 tmp <- multiply col
47 tmp <- and 0x7f
48 tmp <- add 0x80
49 print-int32-decimal 0/screen, tmp
50 print-string 0/screen, "\n"
51 col <- increment
52 loop
53 }
54 row <- increment
55 loop
56 }
57 return 0
58 }