Following is the program which would
.begin
in counter
while: load counter
compare zero
jumpeq done
out counter
decrement counter
jump while
done: halt
counter: .data 10
zero: .data 0
.end
So the above program will make the loop run for 10 times
starting from 10 till point 1.
It will keep on checking for the value of the counter and as soon
as it becomes 0 it will move out of the loop.
That was a nice
question to answer
Friend, If you have any doubts in understanding do let me know in
the comment section. I will be happy to help you further.
Thanks
Get Answers For Free
Most questions answered within 1 hours.