Jump added

This commit is contained in:
2019-03-15 19:54:33 +01:00
parent 96391dd93c
commit 6a037ea2ec
2 changed files with 152 additions and 0 deletions

34
x86_64/3_homework.asm Normal file
View File

@@ -0,0 +1,34 @@
global _start
; Program that finds the highest number in the byte array declared below
section .data
data: db 0, 15, 57, 2, 43, 87, 2
dataSize: equ 7
section .bss
section .text
_start:
xor rbx, rbx
xor rcx, rcx
mov rax, 1 ; iterator value
mov cl, byte [data] ; default value for the result
loop_start:
cmp rax, dataSize
jge loop_end
mov bl, byte [rax + data] ; load next candidate
cmp cl, bl ; compare to (default) value
jge loop_inc ; skip if cl >= bl
mov cl, bl ; set higher value
loop_inc:
inc rax
jmp loop_start
loop_end:
mov rax, 60
mov rdi, rcx ; return the highest number as exit code
syscall