# edi = index of data_items # ebx = largest data item found # eax = current data item .global _start .intel_syntax noprefix .section .text _start: mov edi, 0 # copy 0 into edi - first addresss mov eax, [data_items + edi * 4] # move the first number (edi * 4) to eax jmp start_loop mov ebx, eax # move ebx to eax start_loop: cmp eax, 0 # check if eax is 0, return value stored in EFLAGS register je loop_exit # checks EFLAGS if cmp is equal inc edi # move to the next number (increase index which is edi) mov eax, [data_items + edi * 4] # move the next number (edi * 4) to eax cmp eax, ebx # compare largest item (ebx) to current item (eax) jle start_loop # if eax is less than ebx - jump to start_loop mov ebx, eax # move eax to ebx jmp start_loop # jump back to start_loop loop_exit: mov eax, 1 # move '1' into eax (exit syscall) int 0x80 # call kernel interrupt to exit program .section .data data_items: .long 3, 67, 34, 222, 45, 75, 54, 34, 44, 33, 22, 11, 66, 0