मराठी

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

प्रश्न

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
Advertisements
Share
Notifications



      Forgot password?
Use app×