Академический Документы
Профессиональный Документы
Культура Документы
RCR AL,01 \\here the no is placed in ‘A’,then check the carry flag by ‘JC’ or
’JNC’
______________________________________________
MOV BL,00
MOV SI,3000
ADD BL,[SI] \\ADD CONTENT OF BL WITH CURRENT LOCATION DATA AND SAVE IN BL
L1: INC SI
LOOP L2
HLT
2. To find an element in an array(same as finding the string lenth of an array,here the end
of string variable is taken from an memory location)?
MOV AL,[2500]
MOV BL,01
MOV SI,[3000]
L2:CMP AL,[SI]
JZ L1
INC BL
INC SI
JMP L2
L1:MOV [3000],BL
HLT
3. FIND (A+B)2=A2+2AB+B2
MOV SI,2500
MOV AL,[SI]
MOV BL,AL
MUL BL
INC SI
MOV AL,[SI]
MUL AL
ADD AL,BL
MOV [3000],AL
HLT
4.FIND {(A+B)*(A-B)}/A
MOV [3000],00
L1:MOV AL,CL
MUL AL
ADD [3000],AL
HLT
Hint:in mp the hexa decimal operation only takes place.,,to convert hex value to corresponding
decimal value we have to use an instruction
For to use thos instruction we hav to use an addition operation before DAA
Then
ADD AL,00
DAA
Thats all,then we get result in deciamal format then save the sum of array in any location
7.find the number of occurance of a specific number in an array,then check the value of number
of occurance is odd then save a value 01 to 3000;
MOV SI,3000
L2:CMP AL,[SI]
JNZ L1
INC BL
LI: INC SI
LOOP L2
MOV AL,BL
RCR AL,01
JNC L2
MOV [3000],01
HLT
8. GENERATE 1,2,5,10,17,26,......
MOV CL,[2500]
MOV SI,3000
MOV BLL,00
L1:MOV AL,BL
MUL AL
ADD AL,01
DAA
MOV [SI],AL
INC SI
INC BL
LOOP L1
HLT
9. GENETRATE THE SERIES 1,9,28,65,......