Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4: INTRODUCTION TO THE THUMB INS... > 4.5 SINGLE-REGISTER LOAD-STORE INSTR...

4.5 SINGLE-REGISTER LOAD-STORE INSTRUCTIONS

The Thumb instruction set supports load and storing registers, or LDR and STR. These instructions use two preindexed addressing modes: offset by register and offset by immediate.

image

LDR load word into a register Rd <- mem32[address]
STR save word from a register Rd -> mem32[address]
LDRB load byte into a register Rd <- mem8[address]
STRB save byte from a register Rd -> mem8[address]
LDRH load halfword into a register Rd <- mem16[address]
STRH save halfword into a register Rd -> mem16[address]
LDRSB load signed byte into a register Rd <- SignExtend(mem8[address])
LDRSH load signed halfword into a register Rd <- SignExtend(mem16[address])

You can see the different addressing modes in Table 4.3. The offset by register uses a base register Rn plus the register offset Rm. The second uses the same base register Rn plus a 5-bit immediate or a value dependent on the data size. The 5-bit offset encoded in the instruction is multiplied by one for byte accesses, two for 16-bit accesses, and four for 32-bit accesses.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint