EasyManua.ls Logo

ST ST10F276E - Figure 215. Local Registers

ST ST10F276E
564 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
DocID13284 Rev 2 553/564
UM0404 System programming
Figure 215. Local registers
Software to provide the local register bank for the example in Figure 215 is very compact:
After entering the subroutine:
Before exiting the subroutine:
27.4 Table searching
A number of features have been included to decrease the execution time required to search
tables. First, branch delays are eliminated by the branch target cache after the first iteration
of the loop. Second, in non-sequentially searched tables, the enhanced performance of the
ALU allows more complicated hash algorithms to be processed to obtain better table
distribution. For sequentially searched tables, the auto-increment indirect addressing mode
and the E (end of table) flag stored in the PSW decrease the number of overhead
instructions executed in the loop.
Two examples below illustrate searching of ordered and non-ordered tables, respectively:
Note: The last entry in the table must be greater than the largest possible target.
Note: The last entry in the table must be equal to the lowest signed integer (8000h).
SUB SP, #10D ; Free 5 Words in the current system stack
SCXT CP, SP ; Set the new register bank pointer
POP CP ; Restore the old register bank
ADD SP, #10D ; Release the 5 Word of the current system stack
Old Stack
Area
Newly
Allocated
Register
Bank
R4
R3
R2
R1
R0
Old CP Contents
Old SP
New SP
New CP
New Stack
Area
MOV R0, #BASE ;Move table base into R0
LOOP: CMP R1, [R0+] ;Compare target to table entry
JMPR cc_SGT, LOOP ;Test whether target has not been found
MOV R0, #BASE ;Move table base into R0
LOOP: CMP R1, [R0+] ;Compare target to table entry
JMPR cc_NET, LOOP ;Test whether target is not found AND the end of table
;...has not been reached.

Table of Contents

Related product manuals