Professional Documents
Culture Documents
When doing data transfer, data stored at source address should be moved to
destination address. The ways by which these addresses are specified are called
addressing modes.
Data transfer from source to destinations may be divided into three main types:
i. MOV destination, source
ii. PUSH source or POP destination
iii. XCH destination, source
Method 2
MNEMONIC COMMENT
Method 1
MNEMONIC COMMENT
Method 2
MNEMONIC COMMENT
Eg. MOV A, R4
There are 4 register banks named 0,1,2 and 3. Each bank has 8 registers named
from R0 to R7, so a total of 32 registers.
Register banks are selected
by the RS0 and RS1 bits of
the Special Function
Register (SFR) named
Processor Status Word
(PSW).
So in Register addressing
mode, data is transferred to
accumulator from the
register (based on which
register bank is selected).
Register Direct Addressing Mode:
Eg. MOV A, R4
This opcode is stored
The opcode for MOV A, R4 is EC in program memory
address 0202 and
when it is executed
the control goes
directly to R4 of the
respected register
bank (selected in
PSW)
Data from R4 (2F
stored at 04H) of
register bank #0 is
then moved to
accumulator.
Program counter will
increment by 1 and
stand in 0203, since it
is 1 byte instruction,
executed in 1 cycle.
MOV A, #17h Moves data 17 into Accumulator
Method 2
MNEMONIC COMMENT
Method 2
MNEMONIC COMMENT
Method 1
MNEMONIC COMMENT
4. Method 4: Push the contents of TCON into direct address 02h (R2)
Set the timer T0 to an initial setting of 1234h. Use the direct address with an
immediate number to set TH0 and TL0.
2. Method 2: Using the immediate number in each instruction uses bytes; use a
register to hold the number.
Method 3: There must be a way to avoid naming each address, the PUSH
opcode can increment to each address.