-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath.yml
156 lines (153 loc) · 5.92 KB
/
math.yml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
in_source: |
(printi (/
(* 1 2 3 4 5)
(* (mod 166 (- -5 -15)) (+ 2 -5 5 (- 10 10)))))
(printline)
(printi (= -9223372036854775808 (+ 1 9223372036854775807)))
in_stdin: |
out_stdout: |
10
1
out_debug: |-
##### Data memory #####
<address> <length> <data>
0x00000000 1 -9223372036854775808
0x00000001 1 9223372036854775807
##### Instruction memory #####
<address> <hexcode> <mnemonica>
#:
0x00000000 0x0c200038 br *0x38 ('start' function)
printi:
0x00000001 0x06000000 push
0x00000002 0x02400002 ld *spr+0x2
0x00000003 0x10100014 add #0x14
0x00000004 0x03400002 st *spr+0x2
0x00000005 0x02100000 ld #0x0
0x00000006 0x03500002 st **spr+0x2
0x00000007 0x02400000 ld *spr
0x00000008 0x09100000 cmp #0x0
0x00000009 0x0b300005 brge *ipr+0x5
0x0000000a 0x0210002d ld #0x2d
0x0000000b 0x032015b4 st *0x15b4
0x0000000c 0x02400000 ld *spr
0x0000000d 0x14000000 inv
0x0000000e 0x06000000 push
0x0000000f 0x0f10000a mod #0xa
0x00000010 0x10100030 add #0x30
0x00000011 0x0e400003 dec *spr+0x3
0x00000012 0x03500003 st **spr+0x3
0x00000013 0x02400000 ld *spr
0x00000014 0x1310000a div #0xa
0x00000015 0x09100000 cmp #0x0
0x00000016 0x0a300003 bre *ipr+0x3
0x00000017 0x03400000 st *spr
0x00000018 0x0c3ffff7 br *ipr-0x9
0x00000019 0x07000000 pop
0x0000001a 0x02400002 ld *spr+0x2
0x0000001b 0x04200024 call *0x24 ('print' function)
0x0000001c 0x06000000 push
0x0000001d 0x02400001 ld *spr+0x1
0x0000001e 0x09100000 cmp #0x0
0x0000001f 0x0b300002 brge *ipr+0x2
0x00000020 0x0d400000 inc *spr
0x00000021 0x07000000 pop
0x00000022 0x08000000 popn
0x00000023 0x05000000 ret
print:
0x00000024 0x06000000 push
0x00000025 0x02100000 ld #0x0
0x00000026 0x06000000 push
0x00000027 0x02500001 ld **spr+0x1
0x00000028 0x09100000 cmp #0x0
0x00000029 0x0a300008 bre *ipr+0x8
0x0000002a 0x032015b4 st *0x15b4
0x0000002b 0x0d400001 inc *spr+0x1
0x0000002c 0x0d400000 inc *spr
0x0000002d 0x02400000 ld *spr
0x0000002e 0x09100080 cmp #0x80
0x0000002f 0x0a300002 bre *ipr+0x2
0x00000030 0x0c3ffff7 br *ipr-0x9
0x00000031 0x07000000 pop
0x00000032 0x08000000 popn
0x00000033 0x05000000 ret
printline:
0x00000034 0x0210000a ld #0xa
0x00000035 0x032015b4 st *0x15b4
0x00000036 0x02100001 ld #0x1
0x00000037 0x05000000 ret
start:
0x00000038 0x02100002 ld #0x2 ('anon$0' const)
0x00000039 0x06000000 push
0x0000003a 0x0210000a ld #0xa
0x0000003b 0x06000000 push
0x0000003c 0x0210000a ld #0xa
0x0000003d 0x11400000 sub *spr
0x0000003e 0x03400000 st *spr
0x0000003f 0x07000000 pop
0x00000040 0x06000000 push
0x00000041 0x02100005 ld #0x5
0x00000042 0x10400000 add *spr
0x00000043 0x03400000 st *spr
0x00000044 0x021ffffb ld #-0x5
0x00000045 0x10400000 add *spr
0x00000046 0x03400000 st *spr
0x00000047 0x02100002 ld #0x2
0x00000048 0x10400000 add *spr
0x00000049 0x03400000 st *spr
0x0000004a 0x07000000 pop
0x0000004b 0x06000000 push
0x0000004c 0x021ffff1 ld #-0xf
0x0000004d 0x06000000 push
0x0000004e 0x021ffffb ld #-0x5
0x0000004f 0x11400000 sub *spr
0x00000050 0x03400000 st *spr
0x00000051 0x07000000 pop
0x00000052 0x06000000 push
0x00000053 0x021000a6 ld #0xa6
0x00000054 0x0f400000 mod *spr
0x00000055 0x03400000 st *spr
0x00000056 0x07000000 pop
0x00000057 0x12400000 mul *spr
0x00000058 0x03400000 st *spr
0x00000059 0x07000000 pop
0x0000005a 0x06000000 push
0x0000005b 0x02100005 ld #0x5
0x0000005c 0x06000000 push
0x0000005d 0x02100004 ld #0x4
0x0000005e 0x12400000 mul *spr
0x0000005f 0x03400000 st *spr
0x00000060 0x02100003 ld #0x3
0x00000061 0x12400000 mul *spr
0x00000062 0x03400000 st *spr
0x00000063 0x02100002 ld #0x2
0x00000064 0x12400000 mul *spr
0x00000065 0x03400000 st *spr
0x00000066 0x02100001 ld #0x1
0x00000067 0x12400000 mul *spr
0x00000068 0x03400000 st *spr
0x00000069 0x07000000 pop
0x0000006a 0x13400000 div *spr
0x0000006b 0x03400000 st *spr
0x0000006c 0x07000000 pop
0x0000006d 0x04200001 call *0x1 ('printi' function)
0x0000006e 0x08000000 popn
0x0000006f 0x04200034 call *0x34 ('printline' function)
0x00000070 0x02100017 ld #0x17 ('anon$1' const)
0x00000071 0x06000000 push
0x00000072 0x02200001 ld *0x1 (9223372036854775807 const)
0x00000073 0x06000000 push
0x00000074 0x02100001 ld #0x1
0x00000075 0x10400000 add *spr
0x00000076 0x03400000 st *spr
0x00000077 0x07000000 pop
0x00000078 0x06000000 push
0x00000079 0x02200000 ld *0x0 (-9223372036854775808 const)
0x0000007a 0x09400000 cmp *spr
0x0000007b 0x08000000 popn
0x0000007c 0x0a300003 bre *ipr+0x3
0x0000007d 0x02100000 ld #0x0
0x0000007e 0x0c300002 br *ipr+0x2
0x0000007f 0x02100001 ld #0x1
0x00000080 0x04200001 call *0x1 ('printi' function)
0x00000081 0x08000000 popn
0x00000082 0x01000000 halt