In this program we will see how to add odd numbers in a given series
Write 8086 Assembly language program to add the odd numbers stored in a given series starts from memory offset 501. The size of the series is stored at memory offset 500.
To do this task we are initializing the Source Index (SI) register to the starting address of the series. We are also taking the series size into CL. The CL will be used as counter. To store add we are using AL register. Initially set AL to 0. To check the number is even or odd, we have used TEST 01 instruction. This instruction performs ANDing with the data and 01H. So if the LSB is 0, the total result will be 0, otherwise it will be 1. When LSB is 1, it indicates that the number is odd, then add them into one.
Also the carry flag will be 1, after doing this task