This Assembly Language program for 8086 microprocessor will calculate the number of negative numbers from the list of hexa decimal numbers
LDA 2200H
MOV C,A
MVI B,00
LXI H,2201H
BACK: MOV A,M
ANI 80H
JZ SKIP
INR B
SKIP: INX H
DCR C
JNZ BACK
MOV A,B
STA 2300H
HLT
the program works as follows
first initialize the counter for total number of numbers to search for (C)
put the initial value for negative numbers is equals to zero ( B=0)
initialize the pointer to the memory location of the data
then get the number and check the most significant bit if it is 1 then the number is negative (verify this your self )
increment B that is negative number count
increment pointer
decrement number count C
repeat the process of the total numbers
store the result and stop the program .
You might be also interested in:
:: Assembly Language Source Codes
:: why there are two ground pins in 8086
:: Program to display ASCII characters on the display unit
No comments:
Post a Comment