English
Language : 

45111 Datasheet, PDF (105/184 Pages) List of Unclassifed Manufacturers – 14-DAY MONEY BACK GUARANTEE
10 SX Special Features and Coding Tips
The following code snippet demonstrates this:
RESET Main
Idx
EQU $08
; Define index symbol
Table
; 8-bit data table
,
ORG $0
DW 'ABCDEFG'
; Store text
DW 10, 300, 4095, 0 ; Store numbers
Main
MOV Idx, #Table
; Reset table index
MainLoop
MOV M, #Table>>8
MOV W, Idx
IREAD
;
{use the data}
INC Idx
CJNE Idx, #11, Main
; upper 4-bits of table address
; lower 8-bits of table index
; Retrieve data
; Increment table index
; Continue
Both table methods shown above will only access a maximum of 256 elements, however, the DW
method can easily be modified to access every possible address. If speed is desired, the DW method,
above, is 4 cycles shorter per element than the RETW method.
10.6 Dealing with Code Pages
10.6.1 Branching Across Pages
The SX chip’s program memory is organized into pages of 512 words each. If a program won’t fit within
a single page, special care must be taken when branching across page boundaries to avoid misdirected
jumps.
All instructions that perform a jump, except JMP W, JMP and PC+W, use a 9-bit address as the operand.
This limits the jump range to the current page only (512 words). To jump across a page boundary, the
page select bits (the upper bits of the Status register) must first be set to the appropriate page before
executing the jump. The SX assembler provides a convenient method of doing this, as shown below.
To jump across page boundaries:
Specify the jump command (JMP, JB, CJE, etc) with the page-set option (the @ sign preceding the
address).
SX-Key/Blitz Development System Manual 2.0 • Parallax, Inc. • Page 105