0% found this document useful (0 votes)
21 views

Ch06 Data Movement Instructions Slides

The document discusses different addressing modes for the MOV instruction in embedded systems, including register, immediate, and absolute modes. Examples are provided to demonstrate moving data between registers and memory locations using each addressing mode. Key aspects like specifying sources and destinations, register notation, and immediate value notation are covered.

Uploaded by

2611khanh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Ch06 Data Movement Instructions Slides

The document discusses different addressing modes for the MOV instruction in embedded systems, including register, immediate, and absolute modes. Examples are provided to demonstrate moving data between registers and memory locations using each addressing mode. Key aspects like specifying sources and destinations, register notation, and immediate value notation are covered.

Uploaded by

2611khanh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 67

EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.1 THE MOV INSTRUCTION WITH REGISTER MODE (RN)
ADDRESSING

BROCK J. LAMERES, PH.D.


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION


• MOV – mnemonic; the primary information is to be copied to.
instruction to copy information
within the computer system. • The src and dst can either be
CPU registers or locations in
• src - the location of where the memory.
information is to be copied from.

Image Courtesy of
Recording Connection of Canada

• dst – the location of where the


6.1 THE MOV INSTRUCTION WITH REGISTER MODE (RN)
CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION


• The move instruction performs both 16-bit (.w) and 8-bit (.b)
operations. If no extension is used, the instruction is assumed to
be a 16-bit operation.

Image Courtesy of
Recording Connection of Canada

6.1 THE MOV INSTRUCTION WITH REGISTER MODE (RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

ADDRESSING MODE USAGE

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION WITH REGISTER MODE (RN)


ADDRESSING
• Addressing mode – the way • Rn – the syntax to denote
that the src and dst locations are register mode addressing int eh
specified in the operand of an MSP430 documentation.
instruction.
• The instruction operates on the
• Register mode – the operand for data held within the register
either the source and/or name provided.
destination are CPU registers.

Image Courtesy of
Recording Connection of Canada

6.1 THE MOV INSTRUCTION WITH REGISTER MODE (RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: REGISTER MODE (RN) ADDRESSING


• Let’s move some information around the CPU registers.
• We can use PC and SP as the initial src since they have values.
• We’ll watch the
information move
between registers
in the debugger.

6.1 THE MOV INSTRUCTION WITH REGISTER MODE (RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: REGISTER MODE (RN) ADDRESSING


Step 1: Create a new Empty Assembly-only CCS project titled:
Asm_AddrMode1_Regsiter

Step 2: Type the following


code into the main.asm file
where the comments say
“Main loop here”

6.1 THE MOV INSTRUCTION WITH REGISTER MODE (RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: REGISTER MODE (RN) ADDRESSING


Step 3: Debug your program. Correct any errors until your program is
successfully downloaded.

Step 4: Set a breakpoint before the first instruction


mov.w PC, R4

Step 5: Open the register viewer and expand the Core Registers item to
see the CPU registers.

Step 6: Run your program to the breakpoint.


Image Courtesy of https://neodem.wp.horizon.ac.uk/

6.1 THE MOV INSTRUCTION WITH REGISTER MODE (RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: REGISTER MODE (RN) ADDRESSING


Step 7: Step your program through each instruction and observe the
data movement in the register viewer.

6.1 THE MOV INSTRUCTION WITH REGISTER MODE (RN)


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.1 THE MOV INSTRUCTION WITH REGISTER MODE (RN)
ADDRESSING

www.youtube.com/c/DigitalLogicProgramming_LaMeres

BROCK J. LAMERES, PH.D.


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.2 THE MOV INSTRUCTION WITH IMMEDIATE MODE (#N)
ADDRESSING

BROCK J. LAMERES, PH.D.


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION WITH IMMEDIATE MODE (#N)


ADDRESSING
• Immediate Mode – the operand for the dst; it is only valid for the
for the src is a numeric constant. src field.

• A # is placed in front of the


number to indicate it is to be
used as a constant.

• Immediate mode cannot be used


6.2 THE MOV INSTRUCTION WITH IMMEDIATE MODE (#N)
CH. 6: DATA MOVEMENT INSTRUCTIONS

ADDRESSING MODE USAGE

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: IMMEDIATE MODE (#N) ADDRESSING


• Let’s move some constants into the CPU registers.
• We’ll experiment with providing the values in different formats.
• We’ll watch the data move using the debugger.

6.2 THE MOV INSTRUCTION WITH IMMEDIATE MODE (#N)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: IMMEDIATE MODE (#N) ADDRESSING


Step 1: Create a new Empty Assembly-only CCS project titled:
Asm_AddrMode2_Immediate

Step 2: Type the following code into the main.asm file where the
comments say “Main loop here”

6.2 THE MOV INSTRUCTION WITH IMMEDIATE MODE (#N)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: IMMEDIATE MODE (#N) ADDRESSING


Step 3: Debug your program. Correct any errors until your program is
successfully downloaded.

Step 4: Set a breakpoint before the first instruction


mov.w #1234h, R4

Step 5: Open the register viewer and expand the Core Registers item to
see the CPU registers.

Step 6: Run your program to the breakpoint.


Image Courtesy of https://neodem.wp.horizon.ac.uk/

6.2 THE MOV INSTRUCTION WITH IMMEDIATE MODE (#N)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: IMMEDIATE MODE (#N) ADDRESSING


Step 7: Step your program and observe the constants appear in each
register.

6.2 THE MOV INSTRUCTION WITH IMMEDIATE MODE (#N)


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.2 THE MOV INSTRUCTION WITH IMMEDIATE MODE (#N)
ADDRESSING

www.youtube.com/c/DigitalLogicProgramming_LaMeres

BROCK J. LAMERES, PH.D.


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.3 THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)
ADDRESSING

BROCK J. LAMERES, PH.D.


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)


ADDRESSING
• Absolute Mode – the src and/or • To denote absolute addressing,
dst is a 16-bit address value. the value must be preceded by
an &.
• The term absolute means that
the address provided is the
actual address to access and not
a variable name or label.

Image Courtesy of
Recording Connection of Canada

6.3 THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)


ADDRESSING
• Precede hex values that state
with a letter with a “0.”

• We will need to use the .data


directive to allocate some
variable space in data memory.

Image Courtesy of
Recording Connection of Canada

6.3 THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)


CH. 6: DATA MOVEMENT INSTRUCTIONS

ADDRESSING MODE USAGE

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: ABSOLUTE MODE (&) ADDRESSING


• Let’s define some constants in data memory.
• Let’s also reserve some space in data memory.
• We’ll then move the constant values from one address in memory to
the reserved address using their absolute addresses.
• We’ll watch the movement using the Memory Browser in the
debugger.

Image Courtesy of
Recording Connection of Canada

6.3 THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: ABSOLUTE MODE (&) ADDRESSING


Step 1: Create a new Empty Assembly-only CCS project titled:
Asm_AddrMode3_Absolute

Step 2: We are going to create a main program and also initialize some
space in memory that we can access. We will put that .data section
directly after the main program code. Type the following code into the
main.asm file where the comments say “Main loop here”

Image Courtesy of
Recording Connection of Canada

6.3 THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: ABSOLUTE MODE (&) ADDRESSING

Image Courtesy of
Recording Connection of Canada

6.3 THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: ABSOLUTE MODE (&) ADDRESSING


Step 3: Debug your program. Fix errors as needed.

Step 4: Set a breakpoint before the first instruction


mov.w &2000h, R4

Step 5: Open the register viewer and memory browser. Inspect the
memory starting at 2000h.

Image Courtesy of https://neodem.wp.horizon.ac.uk/


Image Courtesy of
Recording Connection of Canada

6.3 THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: ABSOLUTE MODE (&) ADDRESSING


Step 6: Run & step your program while observing the registers and
memory.

Image Courtesy of
Recording Connection of Canada

6.3 THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.3 THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)
ADDRESSING

www.youtube.com/c/DigitalLogicProgramming_LaMeres

BROCK J. LAMERES, PH.D.


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.4 THE MOV INSTRUCTION WITH SYMBOLIC MODE
ADDRESSING

BROCK J. LAMERES, PH.D.


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION WITH SYMBOLIC MODE


ADDRESSING
• Symbolic Mode – allows the • If the assembler sees any non-
use of address labels as numeric character in an operand,
operands. it treats it as an address label.

• In symbolic mode, the address • Supports labels for 16-bit


label is simply inserted in either addresses so it can only access
the src or dst fields without any memory between 0 → 65,535 or
preceding indicator. 0000h → FFFFh.

Image Courtesy of
Recording Connection of Canada

6.4 THE MOV INSTRUCTION WITH SYMBOLIC MODE


CH. 6: DATA MOVEMENT INSTRUCTIONS

ADDRESSING MODE USAGE

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: SYMBOLIC MODE (&) ADDRESSING


• Let’s define some constants in data memory with labels.
• Let’s also reserve some space in data memory with labels.
• We’ll then move the constant values from one address in memory to
the reserved address using their labels.
• We’ll watch the movement using the Memory Browser in the
debugger.

6.4 THE MOV INSTRUCTION WITH ABSOLUTE MODE (&)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: SYMBOLIC MODE ADDRESSING


Step 1: Create a new Empty Assembly-only CCS project titled:
Asm_AddrMode4_Symbolic

Step 2: We are going to create a main program and also initialize some
space in memory that we can access. We will put that .data section
directly after the main program code. Type the following code into the
main.asm file where the comments say “Main loop here”

6.4 THE MOV INSTRUCTION WITH SYMBOLIC MODE


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: SYMBOLIC MODE ADDRESSING

Image Courtesy of
Recording Connection of Canada

6.4 THE MOV INSTRUCTION WITH SYMBOLIC MODE


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: SYMBOLIC MODE ADDRESSING


Step 3: Debug your program. Fix errors as needed.

Step 4: Set a breakpoint before the first instruction


mov.w Const1, R4

Step 5: Open the register viewer and memory browser. Inspect the
memory starting at 2000h.

Image Courtesy of https://neodem.wp.horizon.ac.uk/


Image Courtesy of
Recording Connection of Canada

6.4 THE MOV INSTRUCTION WITH SYMBOLIC MODE


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: SYMBOLIC MODE ADDRESSING


Step 6: Run & step your program while observing the registers and
memory.

Image Courtesy of
Recording Connection of Canada

6.4 THE MOV INSTRUCTION WITH SYMBOLIC MODE


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.4 THE MOV INSTRUCTION WITH SYMBOLIC MODE
ADDRESSING

www.youtube.com/c/DigitalLogicProgramming_LaMeres

BROCK J. LAMERES, PH.D.


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.5 THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE
(@RN) ADDRESSING

Image Courtesy of
Recording Connection of Canada

BROCK J. LAMERES, PH.D.


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE


(@RN) ADDRESSING
• Indirect Register Mode – a CPU • Provides the address in a way
register is used to provide the that the CPU register can be
address of where the info to be modified by subsequent
accessed is stored. instructions.

Image Courtesy of
Recording Connection of Canada

6.5 THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE (@RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE


(@RN) ADDRESSING
• To indicate that a register is to • Indirect register mode is only
be used as an address pointer, valid in the src of an instruction.
an @ is inserted before the
register name. • This is the same concept as a
pointer in the language C.

Image Courtesy of
Recording Connection of Canada

6.5 THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE (@RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE


(@RN) ADDRESSING
• Provides a way to access blocks
of memory by incrementing the
address pointer in a loop.

Image Courtesy of
Recording Connection of Canada

6.5 THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE (@RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

ADDRESSING MODE USAGE

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDIRECT REGISTER MODE (@RN)


ADDRESSING
• Let’s define some constants in data memory with labels.
• Let’s also reserve some space in data memory with labels.
• We’ll then move the constant values from one address in memory to
the reserved address using indirect register mode.
• We’ll watch the movement using the debugger.

6.5 THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE (@RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDIRECT REGISTER MODE (@RN)


ADDRESSING
Step 1: Create a new Empty Assembly-only CCS project titled:
Asm_AddrMode5_Indirect_Register

Step 2: We are going to create a main program and also initialize some
space in memory that we can access. We will put that .data section
directly after the main program code. Type the following code into the
main.asm file where the comments say “Main loop here”

Image Courtesy of https://neodem.wp.horizon.ac.uk/


Image Courtesy of
Recording Connection of Canada

6.5 THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE (@RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDIRECT REGISTER MODE (@RN)


ADDRESSING

Image Courtesy of
Recording Connection of Canada

6.5 THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE (@RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDIRECT REGISTER MODE (@RN)


ADDRESSING
Step 3: Debug your program. Fix errors as needed.

Step 4: Set a breakpoint before the first instruction


mov.w #2000h, R4

Step 5: Open the register viewer and memory browser. Inspect the
memory starting at 2000h.

Image Courtesy of https://neodem.wp.horizon.ac.uk/


Image Courtesy of
Recording Connection of Canada

6.5 THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE (@RN)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDIRECT REGISTER MODE (@RN)


ADDRESSING
Step 6: Run & step your program while observing the registers and
memory.

Image Courtesy of
Recording Connection of Canada

6.5 THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE (@RN)


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.5 THE MOV INSTRUCTION WITH INDIRECT REGISTER MODE
(@RN) ADDRESSING

www.youtube.com/c/DigitalLogicProgramming_LaMeres

BROCK J. LAMERES, PH.D.


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.6 THE MOV INSTRUCTION WITH INDIRECT
AUTOINCREMENT MODE (@RN+) ADDRESSING

BROCK J. LAMERES, PH.D.


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION WITH INDIRECT


AUTOINCREMENT MODE (@RN+) ADDRESSING
• Indirect Autoincrement Mode • The pointing register can be
– the pointing register is incremented by 1 or 2 depending
automatically incremented after on the type of the size of the
the completion of the instruction. operation dictated by .w and .b .

• Only allowed in the src

Image Courtesy of
Recording Connection of Canada

6.6 THE MOV INSTRUCTION WITH INDIRECT AUTOINCREMENT MODE (@RN+)


CH. 6: DATA MOVEMENT INSTRUCTIONS

ADDRESSING MODE USAGE

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDIRECT AUTOINCREMENT MODE (@RN+)


ADDRESSNG
• Let’s define a block of constants in memory.
• Then we’ll move their values into CPU registers using Indirect
Autoincrement Mode to automatically provide the address.
• We’ll watch the data move in the debugger.

Image Courtesy of
Recording Connection of Canada

6.6 THE MOV INSTRUCTION WITH INDIRECT AUTOINCREMENT MODE (@RN+)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDIRECT AUTOINCREMENT MODE (@RN+)


ADDRESSNG
Step 1: Create a new Empty Assembly-only CCS project titled:
Asm_AddrMode6_Indirect_Autoincrement

Step 2: Type the following code into the main.asm file where the
comments say “Main loop here”

Image Courtesy of https://neodem.wp.horizon.ac.uk/


Image Courtesy of
Recording Connection of Canada

6.6 THE MOV INSTRUCTION WITH INDIRECT AUTOINCREMENT MODE (@RN+)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDIRECT AUTOINCREMENT MODE (@RN+)


ADDRESSNG

Image Courtesy of
Recording Connection of Canada

6.6 THE MOV INSTRUCTION WITH INDIRECT AUTOINCREMENT MODE (@RN+)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDIRECT AUTOINCREMENT MODE (@RN+)


ADDRESSNG
Step 3: Debug your program. Fix errors as needed.

Step 4: Set a breakpoint before the first instruction


mov.w #Block1, R4

Step 5: Open the register viewer and memory browser. Inspect the
memory starting at 2000h.

Image Courtesy of https://neodem.wp.horizon.ac.uk/


Image Courtesy of
Recording Connection of Canada

6.6 THE MOV INSTRUCTION WITH INDIRECT AUTOINCREMENT MODE (@RN+)


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDIRECT AUTOINCREMENT MODE (@RN+)


ADDRESSNG
Step 6: Run & step your program while observing the registers and
memory.

Image Courtesy of
Recording Connection of Canada

6.6 THE MOV INSTRUCTION WITH INDIRECT AUTOINCREMENT MODE (@RN+)


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.6 THE MOV INSTRUCTION WITH INDIRECT
AUTOINCREMENT MODE (@RN+) ADDRESSING

www.youtube.com/c/DigitalLogicProgramming_LaMeres

BROCK J. LAMERES, PH.D.


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))
ADDRESSING

Image Courtesy of
Recording Connection of Canada

BROCK J. LAMERES, PH.D.


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


ADDRESSING
• Indexed Mode – allows a • Similar to indirect register made
numeric constant to be added to in that a register name is
the contents of the register. provided that holds the address
of where to access the
• Offset – numeric constant; information.
16-bit, signed number.

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


ADDRESSING
• The syntax to indicate indexed • Works in both the src and dst
register mode is to put the name fields.
of the register in parenthesis ()
with the numeric constant in
front.

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

ADDRESSING MODE USAGE

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDEXED MODE (X(RN)) ADDRESSING


Let’s initialize a block of constants in memory.
Let’s reserve a block of memory.
We’ll then copy the constants into the open space using knowledge
about the address offset with indexed mode.

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDEXED MODE (X(RN)) ADDRESSING


Step 1: Create a new Empty Assembly-only CCS project titled:
Asm_AddrMode7_Indexed

Step 2: Type the following code into the main.asm file where the
comments say “Main loop here”

Image Courtesy of https://neodem.wp.horizon.ac.uk/


Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDEXED MODE (X(RN)) ADDRESSING

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDEXED MODE (X(RN)) ADDRESSING


Step 3: Debug your program. Fix errors as needed.

Step 4: Set a breakpoint before the first instruction


mov.w #Block1, R4

Step 5: Open the register viewer and memory browser. Inspect the
memory starting at 2000h.

Image Courtesy of https://neodem.wp.horizon.ac.uk/


Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


CH. 6: DATA MOVEMENT INSTRUCTIONS

EXAMPLE: INDEXED MODE (X(RN)) ADDRESSING


Step 6: Run & step your program while observing the registers and
memory.

Image Courtesy of
Recording Connection of Canada

6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))


EMBEDDED SYSTEMS DESIGN

CHAPTER 6: DATA MOVEMENT INSTRUCTIONS


6.7 THE MOV INSTRUCTION WITH INDEXED MODE (X(RN))
ADDRESSING

www.youtube.com/c/DigitalLogicProgramming_LaMeres

Image Courtesy of
Recording Connection of Canada

BROCK J. LAMERES, PH.D.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy