programa20.doc
TRANSCRIPT
Microprocessor 8085 Appendix A Explanation : Wehaveanarrayof Nnumbers. For e.g. weinitialize the count with 5. Also we initialize a pointer to point the elementsin the array. Wewill checkfor the MS. !f the MSofnumber is "# the number is negative. !ncrement count for counting the negativenumbers. !ncrement the pointer to point to the ne$telement. %heck if MS is ". &epeat process tillall the numbers are scanne'. Store the count of negative numbers. Algorithm : Step I :!nitialize count for number ofelementsStep II: (et the number.Step III: AN) the number with *+,.Step IV: %heckifMSis". !f yes# gotostep -# else goto step -!.Step V: !ncrement count for countingnegative numbers.Step VI: !ncrement pointer.Step VII: )ecrement count.Step VIII : %heck for count . +. !f yes#gotostep !/ else goto step !!!.Step IX: Store the count for number ofnegative numbers.Step X: Stop. Flowchart : &efer flowchart 00. Program : InstructionCommentLDAD000HMOV C,A ; Initialize countMVIB,00 ; Initialize the Negative number count0L!IH,D00"H ; Initialize #ointer to arra$ BAC%& MOVA,M; 'et the numberFlowchart 22ANI(0H; Chec) *or M+B,-+%I. ; Chec) i* M+B"IN/B; Increment negative number count+%I.& IN!H ; Increment #ointerDC/C ; Decrement count,N-BAC% ; I* count 0 re#eatMOV A, B+0A1000H; +tore the re2ultMicroprocessor 8085 Appendix AHL0 ; 0erminate #rogram e3ecution