Syntax: STORE ProgramSlot
Designate a program slot for the READ and WRITE instructions to operate upon.
† Note: On the BS2pe, slots 8 - 15 are only available for data (READ and WRITE); they cannot be used to run programs.
|BS2p and BS2px||BS2pe|
|Program Slot Range||0 - 7||0 - 15|
|Related Commands||READ, WRITE|
STORE tells the BS2p, BS2pe, or BS2px which program slot to use when a READ or WRITE instruction is executed. The STORE command only affects the READ and WRITE instructions.
The STORE command allows a program to access all EEPROM locations that exist on the BS2p, BS2pe, and BS2px, regardless of which program is running or which program slot is active. The READ and WRITE commands can only access locations 0 to 2047 within a single program slot. The STORE command switches the program slot that the READ and WRITE commands operate on. This short subroutine demonstrates the use of STORE:
Move_Block: FOR idx = 0 TO (blockLen - 1) ' move blockLen bytes STORE srcSlot ' point to source slot READ srcAddr + idx, eeByte ' read source byte STORE tgtSlot ' point to target slot WRITE tgtAddr + idx, eeByte ' write byte to target slot NEXT RETURN
The default program slot that the READ and WRITE instructions operate on is the currently running program. The STORE command can be used to temporarily change this, to any program slot. The change will remain in effect until another STORE command is issued, or until another program slot is executed. The current slot used by READ and WRITE (as set by STORE) can be read from byte 127 of the Scratchpad RAM. Example:
#SELECT $STAMP #CASE BS2 pgmSlot = 0 ' everything in slot 0 rwSlot = 0 #CASE BS2E, BS2SX GET 63, pgmSlot ' read current slot rwSlot = pgmSlot ' READ/WRITE slot is same #CASE BS2P, BS2PE, BS2PX GET 127, pgmSlot ' get slot control byte rwSlot = rwSlot.HIGHNIB ' READ/WRITE in high nibble pgmSlot = pgmSlot.LOWNIB ' pgm slot in low nibble #ENDSELECT
BASIC Stamp Help Version 2.5.4
Copyright © Parallax Inc.