about summary refs log tree commit diff stats
path: root/cpp/.traces/next_ingredient
blob: 9efc9fddb026a3945b4fcf537202d813fd481a77 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
parse/0: instruction: 1001
parse/0:   ingredient: {name: "2", value: 0, type: 0, properties: ["2": "literal"]}
parse/0: instruction: 25
parse/0:   product: {name: "12", value: 0, type: 1, properties: ["12": "integer"]}
parse/0: instruction: 2
parse/0:   ingredient: {name: "1", value: 0, type: 0, properties: ["1": "literal"]}
parse/0:   ingredient: {name: "12", value: 0, type: 1, properties: ["12": "integer"]}
parse/0:   product: {name: "13", value: 0, type: 1, properties: ["13": "integer"]}
after-brace/0: recipe main
after-brace/0: f ...
after-brace/0: recipe f
after-brace/0: next-ingredient ...
after-brace/0: add ...
new/0: routine allocated memory from 1000 to 101000
schedule/0: main
run/0: instruction main/0
run/0: instruction f/0
run/0: product 0 is 2
mem/0: storing 2 in location 12
run/0: instruction f/1
run/0: ingredient 0 is 1
run/0: ingredient 1 is 12
mem/0: location 12 is 2
run/0: product 0 is 3
mem/0: storing 3 in location 13
.com> 2020-10-18 20:18:51 -0700 7056 - orange-pink' href='/akkartik/mu/commit/apps/texture.mu?h=hlt&id=82d1fe7c9cf50d63621233e4958a44afe4af9fbf'>82d1fe7c ^
74f1512f ^

e170b35d ^





c8e41a47 ^
e170b35d ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58




                                              
                            

                     
                       



                                                               





                                               









                                  
                         


                      

                                       

                     
                         


                         

                                       
         

                         

                     

                                       





                      
          
 
# Playing with emitting cool textures.
#
# To run (on Linux):
#   $ git clone https://github.com/akkartik/mu
#   $ cd mu
#   $ ./translate texture.mu
#   $ ./a.elf > a.ppm

fn main -> _/ebx: int {
#?   var width/esi: int <- copy 0x190  # 400
#?   var height/edi: int <- copy 0xe1  # 225; aspect ratio 16:9
  var width/esi: int <- copy 0xff
  var height/edi: int <- copy 0xff
  print-string 0/screen, "P3\n"
  print-int32-decimal 0/screen, width
  print-string 0/screen, " "
  print-int32-decimal 0/screen, height
  print-string 0/screen, "\n"
  print-string 0/screen, "255\n"  # color depth
  var row/ecx: int <- copy 0
  {
    compare row, height
    break-if->=
    var col/edx: int <- copy 0
    {
      compare col, width
      break-if->=
      # r
      var tmp/eax: int <- copy col
      tmp <- multiply row
      tmp <- and 0x7f
      tmp <- add 0x80
      tmp <- copy 0xff
      print-int32-decimal 0/screen, tmp
      print-string 0/screen, " "
      # g
      tmp <- copy row
      tmp <- multiply col
      tmp <- and 0x7f
      tmp <- add 0x80
#?       tmp <- copy 0xcf
      print-int32-decimal 0/screen, tmp
      print-string 0/screen, " "
      # b
      tmp <- copy row
      tmp <- multiply col
      tmp <- and 0x7f
      tmp <- add 0x80
      print-int32-decimal 0/screen, tmp
      print-string 0/screen, "\n"
      col <- increment
      loop
    }
    row <- increment
    loop
  }
  return 0
}