I'm very beginner in Assembly, And I'm trying to write a program that find the square root of a perfect square root number . my variables does not change when I move something immediately, check variables Box in screen shots
my code:
.data
number dw ?
result dw ?
.code
main proc
mov [number],400
mov cx,0
calc:
mov ax,cx
mul cx
cmp ax,[number]
jz save
inc cx
jmp calc
save:
mov [7102],cx
hlt
endp
end main
CodePudding user response:
I accidentally found the answers to my question, in order to see the changes of the variables, you have to save your data segment address in the DS register, for this you can use the following code!
mov AX,[DATA] ;[DATA] means the address of data segment like &DATA in C
mov DS,AX
Note that you can not directly store the data segment address in the DS register, because the DS register does not have direct access to memory!