48 lines
726 B
NASM
48 lines
726 B
NASM
;###############################
|
|
;
|
|
; MINIMUM IN X64
|
|
;
|
|
;##############################
|
|
|
|
; =============================
|
|
; Find smallest number
|
|
; rax = current item
|
|
; rbx = index of data_items
|
|
; rcx = smallest item found
|
|
; rdi = return value
|
|
; =============================
|
|
|
|
format ELF64 executable 0
|
|
|
|
segment readable executable
|
|
|
|
entry main
|
|
main:
|
|
mov rbx, 0
|
|
mov rax, [data_items + rbx * 8]
|
|
mov rcx, rax
|
|
|
|
loop_through:
|
|
cmp rax, 255
|
|
je exit
|
|
inc rbx
|
|
|
|
mov rax, [data_items + rbx * 8]
|
|
cmp rax, rcx
|
|
jge loop_through
|
|
|
|
mov rcx, rax
|
|
jmp loop_through
|
|
|
|
print:
|
|
mov rax, 0x01
|
|
mov rdi, 1
|
|
mov esi
|
|
|
|
exit:
|
|
mov rax, 0x3c
|
|
syscall
|
|
|
|
segment readable writable
|
|
data_items dq 3, 67, 34, 222, 45, 75, 54, 34, 44, 33, 22, 11, 66, 255
|