Implementing a jump table
Under certain circumstances, a jump table provides a very efficient way of implementing a C language switch
statement block. We can define a jump table as a list of unconditional branch instructions—each referencing a different procedure or subroutine. We branch to one of the subroutines by loading the program counter with the address of the unconditional branch that is stored in the jump table. The effective addresses of items in the jump table are formed using a base + offset addressing mode. Base + offset addressing is commonly used to access data items stored in arrays, and a jump table is effectively just an array of address items.
Getting ready
To illustrate a jump table, we'll develop a recipe called asmJumpTable_c4v0 ...
Get ARM® Cortex® M4 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.