Advertisements
Advertisements
प्रश्न
Write an assembly language program to get Binary Coded Decimal (BCD) sum of series of 1-byte numbers stored at locations beginning 2600 H. Length of series is at 25FF H. Store the 1-byte result in 2700 H.
लघु उत्तर
Advertisements
उत्तर
| Label | Mnemonics code | Comments |
| LXI H, 25FF H | ; Load addr of block | |
| ; Length in HL pair | ||
| ; Memory value in M | ||
| MOV B, M | ; Copy block length in B | |
| SUB A | ; Clear (A) to 00H | |
| Back: | INX H | ; Go to next memory |
| ADD M | ; Add data into A | |
| DA A | ; Convert into BCD | |
| DCR B | ; decrease B by 1 | |
| JNZ Back | ; check z flag if z = 0 | |
| ; then jump back to | ||
| ; loop, i.e. B ≠ 0 | ||
| STA 2700H | ; Store final 1-byte | |
| ; Sum from A into memory | ||
| HLT | ; Halt the process |
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
