मराठी
महाराष्ट्र राज्य शिक्षण मंडळएचएससी विज्ञान (संगणक विज्ञान) इयत्ता १२ वी

Write an Assembly Language Program to count the number of times data 9DH is found in block of memory locations starting from 8901H. Length of the block is stored in memory location 8900H. - Computer Science 2

Advertisements
Advertisements

प्रश्न

Write an Assembly Language Program to count the number of times data 9DH is found in block of memory locations starting from 8901H. Length of the block is stored in memory location 8900H. Store the result in memory location 8000H.

कोड लेखन
Advertisements

उत्तर

; 8085 Program to count occurrences of 9DH in a memory block

; Block length is at 8900H, Block starts from 8901H

; Result is stored at 8000H

Label    Instructions                          Comments

      LXI H, 8900H    ; Set HL to 8900H
      MOV B, M        ; Move M to B
      MVI C, 00H      ; Set C to 00H
LOOP: INX H           ; Increment HL by 1
      MOV A, M        ; Move M to A
      CPI 9DH         ; Compare 9DH with A
      JNZ SKIP        ; Jump not zero go to SKIP
      INR C           ; Increment C by 1
SKIP: DCR B           ; Decrement B by 1
      JNZ LOOP        ; Jump not zero go to LOOP
      MOV A, C        ; Move C to A
      STA 8000H       ; Store content of A to 8000H
      HLT             ; Stop
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2024-2025 (July) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×