Add parity bit to 7-bit ASCII characters

Statement: Add even parity to a string of 7-bit ASCII characters. The length of the string is in memory location 2040H and the string itself begins in memory location 2041H. Place even parity in the most significant bit of each character.

Source program :
  • LXI H, 2040H
  • MOV C ,M : Counter for character
  • REPEAT:INX H : Memory pointer to character
  • MOV A,M : Character in accumulator
  • ORA A : ORing with itself to check parity.
  • JPO PAREVEN : If odd parity place 
  • ORI 80H even parity in D7 (80).
  • PAREVEN:MOV M , A : Store converted even parity character.
  • DCR C : Decrement counter.
  • JNZ REPEAT : If not zero go for next character.
  • HLT : Terminate program execution
Flowchart for program
31-Add parity bit to 7-bit ASCII characters

Post a Comment

0 Comments

Close Menu