Friday 1 April 2011

Instruction for Data Transfer

The general instruction for transferring data is MOV instruction. This instructions is used for byte and bit oriented that are grouped in to several category, such as immediate addressing mode, direct addressing mode, register indirect addressing mode and stack data transfer.

Another word to describe immediate addressing mode is immediate constant addressing, that refers to the source data is a constant. The example of this mode is describe below :

org 00h

mov a, #10h

mov a, #11111010b

mov r0, #28

...

...

The beginning code is org 00h, has means that the origin of the code is occupy at 00h.

mov a, #10h is putting 10 h in to the accumulator

mov a, #11111010b is putting 11111010b in to the accumulator

mov a, #28 is putting 28 in to the accumulator

This mode refers to specifying an internal data registers by its address. The example of this mode is describe below :

org 8000h

mov a, 70h

mov r0, #11111010b

mov 70h, r0

...

...

The beginning code is org 8000h, has means that the origin of the code is occupy at 8000h.

mov a, 70h is copying contents of register that has address 70h to the accumulator

mov r0, #11111010b is putting 11111010b in to the register r0

mov 70h, r0 is copying contents of r0 (11111010b) to the register that has address 70h

In this mode, the address of the source is not given explicitly but include in the target register. The example of this mode is describe below :

org 00h

mov r0, #70h

mov @r0, #28h

...

...

The beginning code is org 00h, has means that the origin of the code is occupy at 00h.

mov r0, #70h is putting 70 h in to regisrtor r0

mov @r0, #28h is putting 28h in to the address that saved in register r0


source : http://trensains.com/data_transfer.htm

No comments: