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

Write an assembly language program to find smallest number in block which begins from memory location E200H to E210H. Store the result in the accumulator.

Advertisements
Advertisements

प्रश्न

Write an assembly language program to find smallest number in block which begins from memory location E200H to E210H. Store the result in the accumulator.

कोड लेखन
Advertisements

उत्तर

      LXI H, E000H    ; Initialize HL pair with the starting address
      MVI C, 10H      ; Set counter (Assuming block size is 16 elements)*
      MOV A, M        ; Load the first number into Accumulator (Assume it's the smallest)

LOOP: INX H           ; Increment HL to point to the next location
      CMP M           ; Compare Accumulator with the current memory byte (A - M)
      JC SKIP         ; If A < M, Carry = 1. Accumulator is already smaller, so skip.
      MOV A, M        ; If A >= M, the new number is smaller. Update Accumulator.

SKIP: DCR C           ; Decrement the counter
      JNZ LOOP        ; If counter is not zero, repeat the loop
      HLT             ; Stop. The smallest number remains in the Accumulator.
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2025-2026 (March) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×