Tuesday 27 December 2016

Subtraction of two 8-bit numbers

Here is an example of Assembly Language code for 8085. This example illustrates how the subtraction of two 8 bit numbers 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, 09H                       // this instruction will move                                                                                                the operand 09H to the accumulator.
              MOV BL, 03H                                    // this instruction will move
                                                                              the operand 03H to the Register B.
              SUB  AL, BL                                             // this instruction will subtract the
                                                                              content of the Register B from the
                                                                              content of the accumulator.
              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