हिंदी

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 - Computer Science 2

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.

लघु उत्तरीय

उत्तर

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
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2023-2024 (March) Official
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×