section .data
larg_msgdb 'Largest Number is::'
larg_len: equ $-larg_msg
nwlinedb 10
array dd 0fa100001h,0b200002h,0fff0003h,0d400004h, 0500005h
arrcntdd 05h
section .bss
dnum_buffresb 8
large resd 1
%macro dispmsg 2
mov eax,4
mov ebx,1
mov ecx,%1
mov edx,%2
int 80h
%endmacro
section .text
global _start
start:
mov esi,0
movecx,[arrcnt]
mov eax,0
lup1: cmpeax,[array+esi*4]
ja lskip1
moveax,[array+esi*4]
incesi
lskip1: loop lup1
mov [large],eax
dispmsglarg_msg,larg_len
movebx,[large]
call disp_num
dispmsg nwline,1
exit: mov eax,01
mov ebx,0
int 80h
disp_num:
movedi,dnum_buff
mov ecx,8
dispup1:
rol ebx,4
movdl,bl
and dl,0fh
add dl,30h
cmp dl,39h
jbe dispskip1
add dl,07h
dispskip1:
mov [edi],dl
incedi
loop dispup1
dispmsg dnum_buff,8
ret
Output
;[mahendra@(none) alp]$ nasm -f elf64 msmalb01.asm
;[mahendra@(none) alp]$ ld -o msmalb01 msmalb01.o
;[mahendra@(none) alp]$ ./msmalb01
;Largest Number is::FA100001
;[mahendra@(none) alp]$
Comments
Post a Comment