- 2068 Magh · 8 marks
8085 ALP: copy data within a range
Short answer
Compare each byte: CPI 70H, skip if no carry (≥70H) using JNC; CPI 25H, skip if carry (<25H) using JC. Only bytes from 25H to 6FH are stored at A030H, advancing the destination pointer only when a byte is copied.
Ten no. of 8-bit data is started in memory at A000H. Write a program for 8085 microprocessor to copy the data to next table at A030H if the data is less than 70H and greater than 24H.
Data is copied only if 24H < data < 70H, i.e. 25H ≤ data ≤ 6FH. Two compares are used:
CPI 70H: no carry means data ≥ 70H, so skip.CPI 25H: carry means data < 25H (data ≤ 24H), so skip.
The destination pointer advances only when a byte is copied, so the selected bytes are stored consecutively from A030H.
LXI H,0A000H ; HL = source table
LXI D,0A030H ; DE = destination table
MVI C,0AH ; ten data bytes
NEXT: MOV A,M ; A = data
CPI 70H ; A - 70H
JNC SKIP ; A >= 70H -> not in range
CPI 25H ; A - 25H
JC SKIP ; A < 25H (i.e. <= 24H) -> not in range
STAX D ; 25H <= A <= 6FH : copy
INX D ; advance destination only on copy
SKIP: INX H ; next source byte
DCR C
JNZ NEXT
HLT
Example: data 10H, 30H, 24H, 25H, 70H, 6FH, 90H ... → copied bytes are 30H, 25H, 6FH (24H and 70H are excluded since the limits are strict).
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- 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: square of ten numbers · Microprocessor, chapter 2
- 8085 ALP: transfer with bit set/reset · Microprocessor, chapter 2
- 8085 ALP: odd parity transfer with bit change · Microprocessor, chapter 2
- 8085 ALP: multiplication table of a number · Microprocessor, chapter 2
- 3-phase IM principle; speed less than sync · Electrical Machine, chapter 5
- Detection gain of DSB-AM is less than 1 · Communication Systems, chapter 9
- When terminal voltage is less or more than emf · Electric Machines II, chapter 1
- True/false: series motor started at no load · Electrical Machine, chapter 4