You are on page 1of 1

MOV AL, 00H: AL now has the 1st number from the sequence

MOV SI, 500H: Making the SI point to the output location


MOV [SI], AL: Moving 0 into the first position
ADD SI, 1: Increment SI to point to the next memory location
ADD AL, 1: Now, AL has the 2nd element of the sequence
MOV [SI], AL: Moving 01H into the 2nd position
MOV CX, [0000H]: Moving the value stored at offset 0 into CX(counter)
SUB CX, 02H: Since we have initialised the first 2 elements of the sequence, we
need to decrement the counter by 2
L1: This defines the start of the loop (A label is created)
MOV AL, [SI-1]: Moves the element in the (i-1)th position into AL
ADD AL, [SI]: Moves the (i)th element with the (i-1)th element already present in
AL
ADD SI, 1: Increment SI to point to the next position
MOV [SI], AL: Store the sum in the new position
LOOP L1: The instructions between label L1 and this LOOP instruction are executed
“CX” times
HLT: Ends the program

You might also like