Untitled

 avatar
unknown
assembly_x86
2 years ago
1.2 kB
3
Indexable
section .bss
    a resb 4
    b resb 4
    c resb 4
    d resb 4

    res1 resb 4
    res2 resb 4

section .text

global _start
_start:
    mov eax, 3
    mov ebx, 0
    mov ecx, a
    mov edx, 4
    int 80h
    mov eax, 3
    mov ebx, 0
    mov ecx, b
    mov edx, 4
    int 80h
    mov eax, 3
    mov ebx, 0
    mov ecx, c
    mov edx, 4
    int 80h
    mov eax, 3
    mov ebx, 0
    mov ecx, d
    mov edx, 4
    int 80h
    mov eax, [a]
    mov ebx, [b]
    cmp eax, ebx
    jle checkA
    mov eax, ebx
checkA:
    mov ebx, [c]
    cmp eax, ebx
    jle checkBC
    mov eax, ebx
checkBC:
    mov ebx, [d]
    cmp eax, ebx
    jle checkCD
    mov eax, ebx
checkCD:
    mov [res1], eax
    mov eax, [a]
    mov ebx, [b]
    cmp eax, ebx
    jge bigA
    mov eax, ebx
bigA:
    mov ebx, [c]
    cmp eax, ebx
    jge bigBC
    mov eax, ebx
bigBC:
    mov ebx, [d]
    cmp eax, ebx
    jge bigCD
    mov eax, ebx
bigCD:
    mov [res2], eax
    mov eax, [res2]
    mov ebx, [res1]
    sub eax, ebx
    add eax, "0"
    mov [res1], eax
    mov eax, 4
    mov ebx, 1
    mov ecx, res1
    mov edx, 1
    int 80h
    mov eax, 1
    int 80h
Editor is loading...
Leave a Comment