Assignment 4
section .data
msg db 10,"The maximum number from given array : ",
len equ -newline
arr dw 2h,54h,4h,5h,7h
section .bss
cnt resb 1
buff resb 16
%macro print 2
mov rax,1
mov rdi,1
mov rsi,%1
mov rdx,%2
syscall
%endmacro
section .text
global _start
_start:
mov byte[cnt], 5
mov rsi, arr
mov al, 0
lp:
cmp al, [rsi]
jg skip
xchg al, [rsi]
skip:
inc rsi
dec byte[cnt]
jnz lp
call disp
print msg, len
print buff, 16
print newline, nlen
mov rax, 60
mov rdi, 0
syscall
disp:
mov rbx, rax
mov rdi, buff
mov cx, 16
up1:
rol rbx, 04
mov al, bl
and al, 0fh
cmp al, 09h
jg add_37
add al, 30h
jmp skip1
add_37:
add al, 37h
skip1:
mov [rdi], al
inc rdi
dec cx
jnz up1
ret