Zege 0 Newbie Poster

We are currently using assembly language in one of my classes. I have to write a loop that adds up numbers and takes the sum, however at the end of the loop (when a user types in a negative number) it is supposed to start over... My problem is I dont know how to make it start over and reset the "sum" value to zero.

BR Main
num: .BLOCK d#2 ;Two bytes of memory for num
sum: .WORD d#0 ;0 is the initial value for the sum

Main: LOADA h#000, i
Loop: CHARO c#/E/, i
CHARO c#/n/, i
CHARO c#/t/, i
CHARO c#/e/, i
CHARO c#/r/, i
CHARO c#/ /, i
CHARO c#/a/, i
CHARO c#/ /, i
CHARO c#/n/, i
CHARO c#/u/, i
CHARO c#/m/, i
CHARO c#/b/, i
CHARO c#/e/, i
CHARO c#/r/, i
CHARO c#/:/, i
DECI num, d ;store a dec into num
LOADA num, d ;read num into register
BRLT Done ;jump to Loop if number is negative
ADDA sum, d
STOREA sum, d ;store the register to sum
BR Loop

Done: CHARO c#/S/, i ;print the sum
CHARO c#/u/, i
CHARO c#/m/, i
CHARO c#/:/, i
DECO sum, d ;output the sum
BR Loop
STOP
.END

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.