-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.mr
More file actions
129 lines (116 loc) · 1.05 KB
/
mod.mr
File metadata and controls
129 lines (116 loc) · 1.05 KB
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
GET
SWAP b
GET
SWAP c
(check if any zero then zero result and jump to end)
RESET a
SWAP b
JZERO 96(end code)
SWAP b
SWAP c
JZERO 2
JUMP 3
SWAP b
JUMP 90(end code)
SWAP c
(fix sign mark h)
RESET h
SWAP c
JNEG 2
JUMP 5
SWAP c
RESET a
SUB c
INC h
SWAP c
SWAP b
JNEG 2
JUMP 6
SWAP b
RESET a
SUB b
INC h
INC h
SWAP b
RESET d (shifted)
RESET e (shifted 1)
RESET g (shift count)
RESET f (1)
INC f
INC e (from 1 or 0?)
SWAP d
ADD c
SWAP d
(beg_pre)
RESET a
ADD b
SUB d
JNEG 9 (end_pre)
SWAP e
SHIFT f
SWAP e
SWAP d
SHIFT f
SWAP d
INC g
JUMP -11 (beg_pre)
(end_pre)
DEC f
DEC f (-1)
DEC g
SWAP e
SHIFT f
SWAP e
SWAP d
RESET a
ADD c
SHIFT g
SWAP d
RESET g
SWAP e
(beg_div)
JZERO 16(end_div)
SWAP e
RESET a
ADD b
SUB d
JNEG 5(skip)
SWAP b
SWAP g
ADD e
SWAP g
(skip)
SWAP d
SHIFT f
SWAP d
SWAP e
SHIFT f
JUMP -15(beg_div)
(end_div)
SWAP h
JZERO 19(end fix)
DEC a
JZERO 11(case 1)
DEC a
JZERO 5(case 2)
(case 3)
RESET a
SUB b
SWAP b
JUMP 11(end fix)
(case 2)
SWAP c
SUB b
SWAP b
JUMP 7(end fix)
(case 1)
SWAP c
SUB b
SWAP b
RESET a
SUB b
SWAP b
(end fix)
SWAP b (mod)
PUT
HALT