- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
8085 program to add even parity to a string of 7 bit ASCII characters.
Here we will see how to add even parity to 7-bit ASCII string using 8085.
Problem Statement
Write a program to add even parity to a string of 7 bit ASCII characters. The length of the string is in memory location 8040 H and the string itself begins at memory location 8041 H. Place even parity in the most significant bit of each character.
Discussion
8085 has parity flat. that flag will be used to check and assign parity with each ASCII character. At first we will clear the most significant bit by masking the number with 7FH. Then use OR instruction, as this effects on parity flag. If the parity is even, then skip, otherwise set most significant bit as 1. This process will repeat until the string is not exhausted.
Input
Address | Data |
---|---|
… | … |
8040 | 06 |
8041 | 7F |
8042 | 55 |
8043 | D5 |
8044 | FF |
8045 | 13 |
8046 | 88 |
… | … |
Flow Diagram
Program
Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|
8000 | 21, 40. 80 | START: | LXI H, 8040 H | H 8040 H Counter pointer |
8003 | 4E | | MOV C, M | C (HL) counter |
8004 | 23 | LOOP: | INX H | HL HL + 1 |
8005 | 7E | | MOV A, M | A (HL); get a word |
8006 | E6, 7F | | ANI 7F H | Mask most significant bit=0 since it will be used for parity bit |
8008 | B7 | | ORA A | To check for parity (ORA affects S, Z, P) |
8009 | EA, 0E, 80 | | JPE DOWN | Is parity even, if yes go to down |
800C | F6, 80 | | ORI 80 H | Add 1 as most significant bit |
800E | 77 | DOWN: | MOV M, A | Store result |
800F | 0D | | DCR C | Counter = Counter – 1 |
8010 | C2, 04, 80 | | JNZ LOOP | Is C = 0? If no then go to loop |
8013 | 76 | | HLT | Stop |
Output
Address | Data |
---|---|
… | … |
8041 | FF |
8042 | 55 |
8043 | 55 |
8044 | FF |
8045 | 93 |
8046 | 88 |
… | … |
Advertisements
To Continue Learning Please Login
Login with Google