- 2069 Poush · 8 marks
8085 ALP: odd parity transfer with bit change
Short answer
Check for end marker 51H (not transferred). Use ORA A and JPO to detect odd parity: copy byte unchanged if odd; else clear bit D5 (AND DFH) and set bit D3 (OR 08H) then store. Example: 07H stays 07H, 03H becomes 0BH.
Write a program in 8085 to transfer bytes of data with odd parity from location 9205H to A200H, else transfer the data by clearing bit D5 and setting bit D3. The end of the data bytes is indicated by 51H in the data.
A byte has odd parity when it contains an odd number of 1s. After ORA A the 8085 parity flag P = 1 for even parity, so JPO (jump if parity odd) detects odd parity. The end marker 51H is tested first and is not transferred.
Algorithm
- HL → 9205H (source), DE → A200H (destination).
- Read a byte; if it equals 51H, stop.
- Test parity (
ORA A). If odd, store it unchanged. - If even, clear D5 (AND with DFH = 1101 1111) and set D3 (OR with 08H), then store.
- Advance both pointers and repeat.
LXI H,9205H ; HL = source pointer
LXI D,0A200H ; DE = destination pointer
NEXT: MOV A,M ; get data byte
CPI 51H ; end of data?
JZ DONE ; yes -> stop (51H is not transferred)
ORA A ; set flags, P=1 for even parity
JPO STORE ; odd parity -> transfer unchanged
ANI 0DFH ; even parity: clear bit D5
ORI 08H ; and set bit D3
STORE: STAX D ; store byte at destination
INX H ; next source byte
INX D ; next destination location
JMP NEXT
DONE: HLT
Example: 07H (three 1s, odd) is copied as 07H. 03H (two 1s, even) becomes 03H AND DFH = 03H, OR 08H = 0BH. 20H (one 1, odd) is copied as 20H.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- 8085 ALP: transfer with bit set/reset · Microprocessor, chapter 2
- 8085 ALP: interchange two bits of bytes · Microprocessor, chapter 2
- 8085 ALP: transfer data with more than 3 ones · Microprocessor, chapter 2
- 8085 ALP: compare two tables of 16-bit data · Microprocessor, chapter 2
- 8085 ALP: divide two bytes · Microprocessor, chapter 2
- 8085 ALP: copy data within a range · Microprocessor, chapter 2
- Parity bits and 3-bit odd parity generator · Digital Logic, chapter 4 · asked 2×
- (4,3) even parity code is linear, odd parity is not · Communication Systems, chapter 8
- C program: sum of two 8-bit BCD numbers · Embedded System, chapter 9
- 3-bit even parity generator and 4-bit checker · Digital Logic, chapter 4