Finding Negative Number In Array

Finding negative number in an array, and yes this is assembly language program. You need Irvine32.lib for running this program but even if you don’t have you can see the logic.

[Also See: Bubble Sorting Program In Assembly Language]

TITLE MASM Template (main.asm)

; Description:
;
; Revision date:
BUFFER=128;

INCLUDE Irvine32.inc
.data

array dword 5,8,7,6,4,1,9,3,-1,-2,2,-3;

sentinel dword 0;

.code
main PROC
mov eax,0;
mov ecx,lengthof array;
mov esi,offset array

L1:
test dword ptr [esi],8000;
pushfd;

;call dumpregs;

add esi,type array;
popfd;

loopz l1;
jz quit
sub esi,type array;

quit:
mov eax,[esi];
call writeint;

call dumpregs;

exit
main ENDP

end main

[Also See: Printing Star Program In Assembly Language]

Author Description

Usama Noman

Usama Noman is Co-Founder of this website, student of Computer Sciences in FAST-NU. I like programming, web development, surfing web, swimming, playing cricket, and a lot of other things for which this is really a small box. Find Me On Twitter @ UsamaNoman and on

No comments yet.

Join the Conversation

You must be logged in to post a comment.