You are on page 1of 1

##################################################

#########################

Program for setting even parity

##################################################
#########################

.aseg value,data
.org 30h
.rseg test,code
mov psw,#01h
mov r0,#04h ;Length of ‘abcd’
mov c,0 ;Setting carry to 0
loop1:
mov dptr,#asci ;Making dptr point to ‘abcd’
mov a,#04h
subb a,r0 ;Setting index
movc a,@a+dptr
mov r1,#08h ;Moving 8 into R1
loop2:
jb acc.7,yes ;If first bit is set
rl a ;Rotate left A
djnz r1,loop2
jnz fin ;one byte finished??
yes:
cpl c ;Complement Carry
djnz r1,loop2
fin:
djnz r0,loop1 ;All bytes finished??
nop
nop
asci .db1 'abcd'
.end

You might also like