-
Notifications
You must be signed in to change notification settings - Fork 0
/
quest3.asm
72 lines (61 loc) · 1021 Bytes
/
quest3.asm
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
%include "io64.inc"
section .text
global CMAIN
CMAIN:
GET_DEC 2, a
GET_DEC 2, b
GET_DEC 2, c
mov ax, [a]
mov bx, [b]
cmp ax, bx
jge lb_greater
mov cx, bx
jmp lb_greater_end
lb_greater:
mov cx, ax
lb_greater_end:
mov ax, [c]
cmp ax, cx
jge lb_set_max
mov [max], cx
jmp lb_set_max_end
lb_set_max:
mov [max], ax
lb_set_max_end:
mov ax, [a]
mov bx, [b]
cmp ax, bx
jle lb_less
mov cx, bx
jmp lb_less_end
lb_less:
mov cx, ax
lb_less_end:
mov ax, [c]
cmp ax, cx
jle lb_set_min
mov [min], cx
jmp lb_set_min_end
lb_set_min:
mov [min], ax
lb_set_min_end:
xor eax, eax
xor edx, edx
mov ax, [max]
mov bx, [min]
mul bx
and ax, 0x0000FFFF
shl dx, 16
or eax, edx
mov [total], eax
PRINT_DEC 4, total
NEWLINE
xor rax, rax
ret
section .bss
a resw 1
b resw 1
c resw 1
max resw 1
min resw 1
total resd 1