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
|
/ get user's x and y
input
store x
input
store y
/ std::cout << y / x;
load y
store divide_top_to_remainder
load x
store divide_bottom
jns divide
load divide_result
output
/ I know this is sus, but we got space until line 150 ...
/
/ y = y % x * 10; std::cout << y / x;
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
jns pass
halt
pass, hex 0
/ y % x
load y
store divide_top_to_remainder
load x
store divide_bottom
jns divide
load divide_top_to_remainder
/ y = (y % x) * 10
store multiply_multiplier
load ten
store multiply_multiplicand
jns multiply
load multiply_result
store y
/ std::cout << y / x;
store divide_top_to_remainder
load one
subt one
store divide_result
load x
store divide_bottom
jns divide
load divide_result
output
jumpi pass
multiply, hex 0
/ result = 0
clear
store multiply_result
/ counter = multiplicand
load multiply_multiplicand
store multiply_counter
_multiply, load multiply_result
/ result += 1
add multiply_multiplier
store multiply_result
/ counter -= 1
load multiply_counter
subt one
store multiply_counter
/ if (AC == 0) { goto _multiply; } else { return; }
skipcond 400
jump _multiply
jumpi multiply
divide, hex 0
_divide, load divide_result
/ result += 1
add one
store divide_result
/ remainder -= divisor
load divide_top_to_remainder
subt divide_bottom
store divide_top_to_remainder
/ if (AC < 0) { goto _divide; }
skipcond 000
jump _divide
/ result -= 1
load divide_result
subt one
store divide_result
/ remainder += divisor
load divide_top_to_remainder
add divide_bottom
store divide_top_to_remainder
jumpi divide
/ user inputs
x, dec 81
y, dec 100
/ multiplication related variables
multiply_multiplier, dec 0
multiply_multiplicand, dec 0
multiply_result, dec 0
multiply_counter, dec 0
/ division related variables
divide_bottom, dec 0
divide_result, dec 0
divide_top_to_remainder, dec 0
/ constants
one, dec 1
ten, dec 10
|