I have homework to write assembly code for checking if number is odd or even. I have this code
code_seg SEGMENT
ASSUME cs:code_seg, ds:data_seg;
mov ax, 11;
test ax, 1;
end: jmp end;
code_seg ENDS
And to check if number is even I look if zero flag is set. I know that the test instruction is like logical AND and that if result is 0 it sets zero flag. My question is: how this checks if number is odd/even? Actually I can't figure out why some even (binary) number and (logical and) 1 gives result of 0?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…