Tuesday 27 December 2016

1's Complement

Here is an example of Assembly Language code for 8086. This example illustrates how the 1's complement of an 8-bit number using Direct Addressing Mode is done.


CODE  SEGMENT                                            // start of the logical code segment
          ASSUME CS:CODE                               // this instruction will inform
                                                                           the assembler the assumed name of CS.              START: MOV  AL, 07H                       // this instruction will move                                                                                                the operand 07H to the accumulator.
              NOT  AL                                             // this instruction will flip the
                                                                              content of the accumulator by
                                                                              finding 1's complement of its single
                                                                               operand.
              MOV [2035H], AL                               // the result would be moved to
                                                                                the memory location 2035H.
CODE  ENDS                                                    // end of the logical code segment
     END START                                                // end of the program

No comments:

Post a Comment