Here is an example of Assembly Language code for 8086. This example illustrates how the 2'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.
NEG AL // this instruction will negate the
content of the accumulator by
finding 2'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
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.
NEG AL // this instruction will negate the
content of the accumulator by
finding 2'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