8086 - Assembly CMP result differs depending on used register? -
i've been working on assembly project , came across fact can't understand.
i have word-array called "lent" filled numbers. when print under 0 index shows ascii 0 (null). however, when use cmp check if value 0, trouble. here code:
mov di,offset lent mov cx,0d cmp ds:[di],cx
it returns not equal, if [di] did not contain zero. however:
mov di,offset lent mov cl,0d cmp ds:[di],cl
returns equal, , there makes me confused. need first case working in code. if lame question, sorry, not able find appropriate answer on internet. in advance
sparky's answer correct. avoid confusion , detect bugs, try use size prefixes like
mov di, offset lent mov cl, 0d cmp byte ptr [di], cl
if try use word ptr prefix, like
cmp word ptr [di], cl
using debug.exe, show error msg.
Comments
Post a Comment