हिंदी

Write an Assembly Language Program to find the largest number in a block of memory locations begins from 2400H, block length is stored at 23 FFH. Store the largest number after the end of the block. - Computer Science 2

Advertisements
Advertisements

प्रश्न

Write an Assembly Language Program to find the largest number in a block of memory locations begins from 2400H, block length is stored at 23 FFH. Store the largest number after the end of the block.

कोड लेखन
Advertisements

उत्तर

Label            Instruction                                            Comments

START:  LXI H, 23FFH     ; Address for count in HL pair
        MOV C, M         ; Get count in register C
        SUB A            ; Clear accumulator

LOOP:   INX H            ; Go to next memory location
        CMP M            ; Compare memory with accumulator
        JNC AHEAD        ; If A ≥ M, jump to AHEAD
        MOV A, M         ; Get larger number in accumulator

AHEAD:  DCR C            ; Decrement count
        JNZ LOOP         ; Repeat loop if count not zero
        INX H            ; Increment memory location
        MOV M, A         ; Store result in memory

END:    HLT              ; Stop execution
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2022-2023 (March) Official
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×