S[[ ]=[ ]#### [E|F|P]] where [ ] means zero or more spaces, "####" is a pointer (0 to 65535, 0 to 0xFFFF, -1 to -255), the "E" or "F" or "P" selects a pointer type: "E" means the pointer is to an EEPROM address, and "F" or "P" means the pointer is to a FLASH or PROGRAM addressNotes:
This is a script invocation, or a script address change, or a script status request commmand.
If there is no '=' in the command line, it is always treated as a status request, even if there is a numeric value specified. Only EEPROM or FLASH (or PROGRAM) memory can be selected as the script source, not SRAM. If a pointer is specified, it is saved without validating it, so -1, for example, can always be given to "park" the pointer (i.e., stop the script), whether it is pointing to EEPROM or FLASH.
Since this command specifies a script pointer, it should point to text. An invalid address is one which points to a first byte which is greater than 126 (i.e., 0x7F to 0xFF), which is not text. Pointing to a NULL terminator byte of an ASCIIz string is also considered invalid. Pointing to any invalid text stops the script logic for the rest of that second.
If an EEPROM address less than the value in EEptrScript is specified, the script at the EEptrScript address will be executed. This is intended to be the startup, or boot initialization, script. It is always in EEPROM. So, if the SRAM pointer at startup is zero, it will execute that startup script. The upside is that the "S = 0" command, for example, will simply run the initialization script again.
When any form of the "S" command is executed, it displays the script status: the operation pointer and the text line to which it points, if valid. If a new address is given, it is stored before the status is output. The script processing logic is enabled (or disabled) with bit B00100000, or 0x20, or 32, in EEPROM byte 1, which is EEbSystemMode.
> >S Next operation pointer: 0x00FA >DE+ 0 16 ; Check the value of EEPROM byte 1 EEPROM contents: 0000: 10 21 00 9F 00 01 84 FF-04 22 0E FF 28 3C 50 FF .!......."..(.P. >E 1 != 0x20 ; Disable the script processing logic >DES EEPROM contents: 0000: 10 21 00 9F 01 00 84 FF-04 22 0E FF 28 3C 50 FF .!......."..(.P. 0010: C0 00 3F FF 60 08 03 67-FF 25 74 FF FF FF FF FF ..?.`..g.%t..... 0020: 24 28 05 FF FF 40 FF FF-FF 14 FF 20 00 40 FF FF $(...@..... .@.. 0030: 80 16 FF FF FF FF FF FF-90 00 B0 00 90 01 FF FF ................ 0040: FF FF FF FF FF FF 00 2F-FF FF FF FF FF FF FF FF ......./........ >DE+ 0xB0 80 ; From the WORD at address 0x3A (= 0x00B0) EEPROM contents: 00B0: 3B 20 42 6F 6F 74 75 70-20 49 6E 69 74 3A 20 00 ; Bootup Init: . 00C0: 45 20 31 20 7E 3D 20 30-78 43 30 00 4E 2A 2A 00 E 1 ~= 0xC0.N**. 00D0: 4E 44 2B 00 45 53 20 34-37 39 3D 35 38 00 45 20 ND+.ES 479=58.E 00E0: 30 78 31 39 20 3D 20 30-78 32 35 00 45 20 30 78 0x19 = 0x25.E 0x 00F0: 32 30 20 3D 20 30 78 32-34 00 FF FF FF FF FF FF 20 = 0x24....... >S = 0xB0 Next operation pointer: 0x00B0 ; Bootup Init: >; Type a ']' as the first character on the next line; it will not display >E 1 |= 32 > <==> Next operation pointer: 0x00B0 ; Bootup Init: <==> Next operation pointer: 0x00C0 E 1 ~= 0xC0 <==> Next operation pointer: 0x00CC N** > <==> Next operation pointer: 0x00CC N** <==> Next operation pointer: 0x00D0 ND+ > <==> Next operation pointer: 0x00D0 ND+ <==> Next operation pointer: 0x00D4 ES 479=58 > <==> Next operation pointer: 0x00D4 ES 479=58 <==> Next operation pointer: 0x00DE E 0x19 = 0x25 > <==> Next operation pointer: 0x00DE E 0x19 = 0x25 <==> Next operation pointer: 0x00EC E 0x20 = 0x24 > <==> Next operation pointer: 0x00EC E 0x20 = 0x24 <==> Next operation pointer: 0x00FA >s = -1 F Next operation pointer: 0xFFFF FLASH >S = -1 E Next operation pointer: 0xFFFF >
Now we can see which text lines were executed since they are printed as the "Next operation pointer: 0x00FA", as shown in the first line at the top of the example box above. The reason that many lines are repeated is because the script tries to execute each line until it finds one that had to be sent to the Command Processor. So, the first line is just a comment (as is any line with a ';') and was immediately discarded. The next line was read during the same cycle and placed in the command buffer. The third line could not execute until the second line's command had been processed. It shows as the second '>' at the start of the next line as the command is actually readied for execution by being placed in the buffer for the Command Processor.
At most, only nine (9) instructions can be executed during one cycle (not "second", but "cycle") in order to prevent any script from simply taking over the Foreground process.
As already mentioned, script detail reporting can be enabled using the ']' first key. To show the number of script lines executed in the prior second, use BIT_RTC_SEC_SCRIPT_HZ in EEbFlags_RTC. Script line change information can be suppressed using the '['toggle key. Using both results in a cryptic series of "<==>" and ">" being output. Even the prompt can be suppressed using BIT_OS_NO_PROMPT in EEbFlags_OS for "stealthy" script execution.
See also:
Commands only available in Scripts, other
script details and examples.