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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
section .text,"ax",@progbits
assume adl = 1
section .text,"ax",@progbits
public _main
_main:
BB0_1:
ld iy, -3145600
call _os_ClrLCD
call _os_HomeUp
call _os_DrawStatusBar
ld hl, L_.str
push hl
call _printf_
pop hl
call _os_GetKey
ld e, l
ld d, h
ld.sis bc, 149
or a, a
sbc.sis hl, bc
jq z, BB0_4
or a, a
sbc hl, hl
ld l, e
ld h, d
push hl
call _output
pop hl
BB0_3:
call _os_GetCSC
or a, a
jq z, BB0_3
jq BB0_1
BB0_4:
or a, a
sbc hl, hl
ret
section .text,"ax",@progbits
section .text,"ax",@progbits
public _output
_output:
call __frameset0
ld iy, -3145600
call _os_ClrLCD
call _os_HomeUp
call _os_DrawStatusBar
ld de, 143
ld hl, (ix + 6)
or a, a
sbc hl, de
push hl
pop de
ld bc, 6
or a, a
sbc hl, bc
jq c, BB1_3
ld hl, L_.str.7
push hl
call _printf_
pop hl
ld bc, 0
ld e, 0
jq BB1_2
BB1_3:
ld hl, LJTI1_0
add hl, de
add hl, de
add hl, de
ld hl, (hl)
jp (hl)
BB1_4:
ld hl, L_.str.1
push hl
call _printf_
pop hl
call _getInput
push hl
pop bc
ld a, e
ld hl, -1913901
ld e, 67
jq BB1_5
BB1_7:
ld hl, L_.str.2
push hl
call _printf_
pop hl
call _getInput
push hl
pop bc
ld a, e
ld hl, -1913901
ld e, 67
call __fdiv
jq BB1_6
BB1_8:
ld hl, L_.str.3
push hl
call _printf_
pop hl
call _getInput
push de
push hl
call _ozToG
jq BB1_9
BB1_10:
ld hl, L_.str.4
push hl
call _printf_
pop hl
call _getInput
push de
push hl
call _gToOz
BB1_9:
push hl
pop bc
pop hl
pop hl
jq BB1_2
BB1_11:
ld hl, L_.str.5
push hl
call _printf_
pop hl
call _getInput
push hl
pop bc
ld a, e
ld hl, -8388608
ld e, 65
jq BB1_5
BB1_12:
ld hl, L_.str.6
push hl
call _printf_
pop hl
call _getInput
push hl
pop bc
ld a, e
ld hl, -8388608
ld e, 61
BB1_5:
call __fmul
BB1_6:
ld e, a
BB1_2:
push de
push bc
ld hl, L_.str.8
push hl
call _printf_
ld sp, ix
pop ix
ret
section .text,"ax",@progbits
section .rodata,"a",@progbits
lJTI1_0:
private LJTI1_0
LJTI1_0:
dl BB1_4
dl BB1_7
dl BB1_8
dl BB1_10
dl BB1_11
dl BB1_12
section .text,"ax",@progbits
public _lbsToG
_lbsToG:
call __frameset0
ld bc, (ix + 6)
ld a, (ix + 9)
ld hl, -1913901
ld e, 67
call __fmul
push bc
pop hl
ld e, a
pop ix
ret
section .text,"ax",@progbits
section .text,"ax",@progbits
public _getInput
_getInput:
ld hl, -29
call __frameset
ld hl, L_.str.9
xor a, a
ld (ix + -26), a
lea de, ix + -22
ld (ix + -29), de
push hl
call _printf_
pop hl
BB3_1:
call _os_GetKey
ld a, l
sub a, -116
cp a, 2
jq nc, BB3_2
dec l
jq BB3_4
BB3_2:
ld a, l
cp a, 5
jq z, BB3_5
BB3_4:
ld a, l
add a, -94
ld de, 0
ld c, (ix + -26)
ld e, c
ld hl, (ix + -29)
add hl, de
ld (hl), a
inc c
ld (ix + -26), c
ld l, a
rlc l
sbc hl, hl
ld l, a
push hl
ld hl, L_.str.10
push hl
call _printf_
pop hl
pop hl
jq BB3_1
BB3_5:
ld de, 0
ld a, (ix + -26)
ld e, a
ld bc, (ix + -29)
push bc
pop hl
add hl, de
ld (hl), 0
pea ix + -25
push bc
call _strtod
ld sp, ix
pop ix
ret
section .text,"ax",@progbits
section .text,"ax",@progbits
public _gToLbs
_gToLbs:
call __frameset0
ld bc, (ix + 6)
ld a, (ix + 9)
ld hl, -1913901
ld e, 67
call __fdiv
push bc
pop hl
ld e, a
pop ix
ret
section .text,"ax",@progbits
section .text,"ax",@progbits
public _ozToG
_ozToG:
call __frameset0
ld bc, (ix + 6)
ld a, (ix + 9)
ld hl, -8388608
ld e, 61
ld iy, -1913901
ld d, 67
call __fmul
lea hl, iy + 0
ld e, d
call __fmul
push bc
pop hl
ld e, a
pop ix
ret
section .text,"ax",@progbits
section .text,"ax",@progbits
public _gToOz
_gToOz:
call __frameset0
ld bc, (ix + 6)
ld a, (ix + 9)
ld hl, -1913901
ld e, 67
ld iy, -8388608
ld d, 65
call __fdiv
lea hl, iy + 0
ld e, d
call __fmul
push bc
pop hl
ld e, a
pop ix
ret
section .text,"ax",@progbits
section .text,"ax",@progbits
public _lbsToOz
_lbsToOz:
call __frameset0
ld bc, (ix + 6)
ld a, (ix + 9)
ld hl, -8388608
ld e, 65
call __fmul
push bc
pop hl
ld e, a
pop ix
ret
section .text,"ax",@progbits
section .text,"ax",@progbits
public _ozToLbs
_ozToLbs:
call __frameset0
ld bc, (ix + 6)
ld a, (ix + 9)
ld hl, -8388608
ld e, 61
call __fmul
push bc
pop hl
ld e, a
pop ix
ret
section .text,"ax",@progbits
section .rodata,"a",@progbits
private L_.str
L_.str:
db "MassCalc",012o,"Select:",012o,"1. Pounds to Grams",012o,"2. Grams to Pounds",012o,"3. Ounces to Grams",012o,"4. Grams to Ounces",012o,"5. Pounds to Ounces",012o,"6. Ounces to Pounds",012o,"7. Exit",000o
section .rodata,"a",@progbits
private L_.str.1
L_.str.1:
db "Pounds to Grams",012o,000o
section .rodata,"a",@progbits
private L_.str.2
L_.str.2:
db "Grams to Pounds",012o,000o
section .rodata,"a",@progbits
private L_.str.3
L_.str.3:
db "Ounces to Grams",012o,000o
section .rodata,"a",@progbits
private L_.str.4
L_.str.4:
db "Grams to Ounces",012o,000o
section .rodata,"a",@progbits
private L_.str.5
L_.str.5:
db "Pounds to Ounces",012o,000o
section .rodata,"a",@progbits
private L_.str.6
L_.str.6:
db "Ounces to Pounds",012o,000o
section .rodata,"a",@progbits
private L_.str.7
L_.str.7:
db "Invalid",000o
section .rodata,"a",@progbits
private L_.str.8
L_.str.8:
db "",012o,"Output: %f",000o
section .rodata,"a",@progbits
private L_.str.9
L_.str.9:
db "Input: ",000o
section .rodata,"a",@progbits
private L_.str.10
L_.str.10:
db "%c",000o
ident "clang version 12.0.0 (https://github.com/jacobly0/llvm-project 170be88120e3aa88c20eea5615ba76b8f1d6c647)"
extern __Unwind_SjLj_Register
extern __frameset
extern _printf_
extern _os_ClrLCD
extern _os_DrawStatusBar
extern _os_GetKey
extern __fmul
extern __Unwind_SjLj_Unregister
extern __fdiv
extern _strtod
extern _os_GetCSC
extern __frameset0
extern _os_HomeUp
|