English

Consider Accumulator contains FFH and register C contains 4DH. Execute following instructions one after the other and write contents of Accumulator after each instruction: - Computer Science 2

Advertisements
Advertisements

Question

Consider Accumulator contains FFH and register C contains 4DH. Execute following instructions one after the other and write contents of Accumulator after each instruction: 

  1. XRA A
  2. ADD C
  3. CPI 4D H
  4. SUB C
Long Answer

Solution

  1. XRA A = 00H
  2. ADD C = 4DH
  3. CPI 4D H = 4DH
  4. SUB C = 00H

Accumulator (A) = FFH = 1111      1111

Consider weight,

Register C  ∴ 4D = 0100   1101

(i) XRA A 

Accumulator = A = FFH      1111      1111
            XRA   = A = FFH      1111      1111
                                            0000      0000
                                               0            0

∴ After XRA A accumulator content = 00H

(ii) ADD C

Accumulator (A) = 00H      0000     0000
               ADD C = 4DH      0100    1101
                                           0100    1101
                                              4         D

∴ After ADD C accumulator content = 4DH

(iii) CPI 4D H

Accumulator A = 4D     0100      1101
                   CPI = 4D    0100      1101
                                     1011      0010
                                   +                   1
                                     1011      0011
                              +     0100      1101
Complementary           
carry 1                          0000      0000
         0                             0           0

Cy = 0 and Z = 1

∴ After CPI 4D accumulator content = 4DH

Because of immediate comparison, the accumulator's content does not change.

(iv) SUB C

ACcumulator A = 4D             0100     1101
               SUB C = 4D             0100     1101
                                               1011     0010
                                             +                  1
                                               1011     0011
Complementary carry 1          0100    1101
                                    0          0000    0000
                                                  0           0

∴ After SUB C accumulator content = 00H

shaalaa.com
  Is there an error in this question or solution?
2023-2024 (March) Official
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×