Page 286 - FUNDAMENTALS OF COMPUTER
P. 286

NPP













                   286                         Fundamentals of Computers                           NPP


                      Step 1: Represent in 8-bit                  ñQ>on 1… XmoZm| H$mo 8-{~Q>m| _| Xem©Zo na

                                                   (00001111)  –  (11101111)
                      Step 2: Take 2's complement of subtrahend:  ñQ>on 2… KQ>H$ H$m 2's H$m°påßb_|Q> bmo…
                                                          00010001
                      Step 3: Replace (–) with (+) and add.       ñQ>on  3: (-) Ho$ ñWmZ na (+) H$aHo$ Omo‹S>mo …


                                                00001111 + 00010001 = 00100000
                      Since MSB is 0 the integer is positive and  My±{H$ MSB eyÝ` h¡ AV… n[aUm_ YZmË_H$ h¡ d
                  the remaining bits show the magnitude. Thus,  ~mH$s {~Q>| CgH$m n[a_mU ~VmVr h¡Ÿ& AV…

                                                      (+15) – (–17) = (+32)
                      We can draw flow chart for 2's complement   AV… h_  2's  H$m°påßb_|Q> KQ>mZo  H$s  {d{Y H$m
                  subtraction (Signed Integers)               âbmoMmQ>© ~Zm gH$Vo h¢:

                                       Start



                                     Represent
                               Positive Integer in signed-
                                 magnitude form and
                               Negative in 2's complement                         2's


                                                                                's
                                Take 2's complement of
                                 subtrahend. Replace
                                     (-) with (+)



                                  Add & Neglect any
                                     end carry



                                       Stop


                    Flow chart : 2's Complement Subtraction        âbmo MmQ>©… 2's H$m°påßb_|Q> _| KQ>mZm (gmBÝS>
                           method (Signed Integers)                             nyUmªH$)
                       Problem 3.81                                àíZ 3.81
                      Perform subtraction using 2's complement     2's H$m°påßb_|Q> go KQ>mAmo…
                  method :
                                                   (a) (+25) – (+25) (b) (+43) – (–20)
   281   282   283   284   285   286   287   288   289   290   291