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 dword 3043274211
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 eax,num
call writebin
mov al,byte ptr num
mov ah,byte ptr num+1
XOR al,ah
mov ah,byte ptr num+2
XOR al,ah
mov ah,byte ptr num+3
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
Check Parity of 16-bit Number Assembly Program
Check Parity of 8 -bit Number Assembly Program
include irvine32.inc
.data
num dword 3043274211
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 eax,num
call writebin
mov al,byte ptr num
mov ah,byte ptr num+1
XOR al,ah
mov ah,byte ptr num+2
XOR al,ah
mov ah,byte ptr num+3
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