Here is an example of Assembly Language code for 8085. This example illustrates how the addition of two 8 bit numbers using Direct Addressing Mode is done.
This can be done in two ways:
Way 1:
DATA SEGMENT // start of the logical data segment
SUM DB ? // this instruction directs the
assembler to reserve one
memory location and leave
it uninitialized it for the variable named SUM.
DATA ENDS // end of the logical data segment
CODE SEGMENT // start of the logical code segment
ASSUME CS:CODE, DS:DATA // this instruction will inform
the assembler that CS and DS will be assumed names
for the code and data logical
segments respectively.
START: MOV AX, [5000H] // this instruction will move
the operand from the memory
location 5000H to the accumulator.
MOV BX, [5001H] // this instruction will move
the operand from the memory
location 5001H to the Register B.
ADD AX, BX // this instruction will add both
numbers and will move the
result to the accumulator
MOV [1504H], AX // this instruction will move
the result from the accumulator
to the memory location 1504H.
HLT // Halt
CODE ENDS // end of the logical code segment
Way 2:
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, 05H // this instruction will move
the operand 05H to the accumulator.
MOV BL, 03H // this instruction will move
the operand 03H to the Register B.
ADD AL, BL // this instruction will add both
numbers and will move the
result to the accumulator
MOV [2000H], AL // this instruction will move
the result from the accumulator
to the memory location 2000H.
CODE ENDS // end of the logical code segment
This can be done in two ways:
Way 1:
DATA SEGMENT // start of the logical data segment
SUM DB ? // this instruction directs the
assembler to reserve one
memory location and leave
it uninitialized it for the variable named SUM.
DATA ENDS // end of the logical data segment
CODE SEGMENT // start of the logical code segment
ASSUME CS:CODE, DS:DATA // this instruction will inform
the assembler that CS and DS will be assumed names
for the code and data logical
segments respectively.
START: MOV AX, [5000H] // this instruction will move
the operand from the memory
location 5000H to the accumulator.
MOV BX, [5001H] // this instruction will move
the operand from the memory
location 5001H to the Register B.
ADD AX, BX // this instruction will add both
numbers and will move the
result to the accumulator
MOV [1504H], AX // this instruction will move
the result from the accumulator
to the memory location 1504H.
HLT // Halt
CODE ENDS // end of the logical code segment
END START // end of the program
Way 2:
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, 05H // this instruction will move
the operand 05H to the accumulator.
MOV BL, 03H // this instruction will move
the operand 03H to the Register B.
ADD AL, BL // this instruction will add both
numbers and will move the
result to the accumulator
MOV [2000H], AL // this instruction will move
the result from the accumulator
to the memory location 2000H.
CODE ENDS // end of the logical code segment
END START // end of the program
write an assembly language program to add a list of numbers using indirect Addressing
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThanks a lot for help ��
ReplyDelete