-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbinary_reverse.txt
60 lines (56 loc) · 1.21 KB
/
binary_reverse.txt
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
Call:6027()
if reg.0 != 0: | 6027
goto(6035) |-----
reg.0 = reg.1 + 1 | 6030
Ret | 6034
if reg.1 != 0: | 6035
goto(6048) |
reg.0 = reg.0 - 1 | 6038
reg.1 = reg.7 | 6042
Call:6027() | 6045
Ret | 6047
stack.push(reg.0) | 6048
reg.1 = reg.1 - 1 | 6050
Call:6027() | 6054
reg.1 = reg.0 | 6056
reg.0 = stack.pop() | 6059
reg.0 = reg.0 - 1 | 6061
Call:6027() | 6065
Ret | 6067
Call:6027()
if reg.0 != 0: | 6027
goto(6035) |-----
if reg.1 != 0: | 6035
goto(6048) |
stack.push(reg.0) | 6048
reg.1 = reg.1 - 1 | 6050
Call:6027() | 6054
reg.1 = reg.0 | 6056
reg.0 = stack.pop() | 6059
reg.0 = reg.0 - 1 | 6061
Call:6027() | 6065
Ret | 6067
reg.0 = reg.0 - 1 | 6038
reg.1 = reg.7 | 6042
Call:6027() | 6045
Ret | 6047
reg.0 = reg.1 + 1 | 6030
Ret | 6034
reg = [0]*8
stack = []
def run():
if reg[0] != 0:
if reg[1] !=0:
stack.push(reg[0])
reg[1] -= 1
run()
reg[1] = reg[0]
reg[0] = stack.pop() - 1
run()
return
reg[0] -= 1
reg[1] = reg[7]
run()
return
reg[0] = reg[1] + 1
return