Check parity of 16-bit number Assembly Program

See Also: Check Parity of 32-bit Number Assembly Program
                 Check Parity of 16-bit Number Assembly Program
                 Check Parity of 8  -bit Number Assembly Program


include irvine32.inc
.data
   
num word 39263
msg  byte "Parity Flag is set   : PF=EVEN ",0,13h,10h
msg1 byte "Parity flag is clear : PF=ODD  ",0,13h,10h

.code
main proc
call clrscr
call crlf
mov ax,num
call writebin
mov ax,num
XOR al,ah
cmp al,0
JP L1
JNP L2
L2:
call crlf
mov edx,offset msg1
call writestring
jmp e

L1:
call crlf
mov edx,offset msg
call writestring
jmp e
e:
exit
main endp
end main

0 comments:

Post a Comment

My Instagram