Click to See Complete Forum and Search --> : about assembly language


aliseek
March 30th, 2009, 02:36 AM
please sir help me of this programe i confuse

Write a program in assembly language that calculates the sum of first five odd numbers (1, 3, 5, 7, 9) and stores the result in AX register.
You can do it with the help of loop (initialize AX register with value 0 and BX with value 1, and then on each iteration of loop add BX into AX and add value 2 in BX).
You are NOT allowed to define the data (like num1: dw 1, 3, 5, 7, 9)

aliseek
March 30th, 2009, 01:00 PM
i wait your response

rxbagain
March 30th, 2009, 04:58 PM
You already enumerated the steps so it should be easy. I won't show the exact code but I'll just give you the guide

initialize ax to 0
initialize bx to 1
initilize cx to 5
next_number:
ax = ax + bx
bx = bx + 2
loop next_number ; loop until counter = 0