• FEATURED POSTS
  • LATEST POSTS
  • SERVICES

Sunday, 30 December 2012

Finding Max Number in Assembly Language

This is an assembly language program, let's you find the maximum number in array. You require Irvine32.lib for running this program but if you don't have you can still see what is happening in the program for better understanding.

[ALSO SEE: BUBBLE SORTING IN ASSEMBLY LANGUAGE]

[code lang="html"]TITLE MASM Template (main.asm)

; Description:
;
; Revision date:
INTERGER=4;
INCLUDE Irvine32.inc
.data
prompt1 byte "First is Larger ",0;
prompt2 byte "Second is Larger ",0;
prompt3 byte "Third is Larger ",0;
firstNum dword 62d;
secondNum dword 12d;
thirdnum dword 60d;

array dword 56,12,25,67,45,21,3,1,95;
max dword 0;

.code
main PROC
mov esi, offset array;
mov ecx,0;
mov ecx,9;
call dumpregs;

call searching;
mov eax,max;
call writeint;


call dumpregs;

exit
main ENDP
searching proc
push esi;
push ecx;

l2:
mov eax,[esi];
mov max,eax;
jmp l3;

L1:
mov eax,max;
cmp eax,[esi];
jbe l2;
l3:
add esi, type array;
loop l1;
pop ecx;
pop esi;
exit;
searching endp;

end main[/code]

[You May Like: SEARCHING A NUMBER IN ARRAY IN ASSEMBLY LANGUAGE]

0 comments

Posts a comment

 
© 2011 myTestBlog
Designed by Blog Thiết Kế
Back to top