Hey I'm studying assembly language from the book "art of x86 assembly" and I have a question I could'nt figure the answer.
the program goes like this: "in this exercise you will start a program running that examines and operates on values found in mmory. then you will switch to the memory screen and modify values in memory (that is, you will directly access memory while the program continues torun). th program begins by seting mmory location 1000h to zero, then it loops until one of the two conditions is met - either the user toggles the FFF0 switch or the user changes the value in memory location 1000h. Toggling th FFF0 switch terminates the program. Changing the value in memory location 1000h transfers control to a section of the program that adds together n words, where n is the new value in memory location 1000h."
after it sums up these values, it prints their sum using "put"
I have this code :
d: mov cx,0
mov [1000],cx
a: mov cx,[1000]
cmp cx,0
jne c
mov ax,[fff0]
cmp ax,0
je a
halt
c: mov bx,1002
mov ax,0
b: add ax,[bx]
add bx,2
sub cx,1
cmp cx,0
jne b
put
jmp d
anyway, the problem is when I put the value 12h on 1000h, the program outputs 2 values, the sum, and the number 1.
when I step through the program, it outputs 1 value (the sum), but when I run it, it outputs 2 values (the sum and the number 1).
I could'nt figure the cause of this.
thanks for the help