English

A 16 bit number beginning with lower order byte is stored from memory location 7000H. Write a Assembly Language Program to find its two’s (2's) compliment and stare the result beginning with lower - Computer Science 2

Advertisements
Advertisements

Question

A 16 bit number beginning with lower order byte is stored from memory location 7000H. Write a Assembly Language Program to find its two’s (2’s) compliment and stare the result beginning with lower order byte from memory location 7500H.

Code Writing
Advertisements

Solution

; 8085 Program to find 2's complement of a 16-bit number
; Input: 16-bit number at 7000H
; Output: 2's complement at 7500H and 7501H
Label Instructions Comments
            LHLD 7000H    ; Load HL from 7000H
            MOV A, L      ; Move L to Acc
            CMA           ; Complement Acc.
            ADI 01H       ; Add 1 to Acc.
            STA 7500H     ; Store A to 7500H
            MOV A, H      ; Move H to A
            CMA           ; Complement Acc.
            ADC 00H       ; Add 00H with carry
            STA 7501H     ; Store A to 7501H
            HLT           ; Stop
shaalaa.com
  Is there an error in this question or solution?
2024-2025 (July) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×