The '9' command line parsing loop example

The '9' command is used to illustrate command line numeric value parsing. It was left in place for testing input of numeric strings.

Before beginning this example, do this:

>DS  0x230 48 1 4 42
SRAM contents:
>0230:  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
0240:  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
0250:  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
DS+ 0x230 48 1 4 42
SRAM contents:
0230:  13 44 53 2B 20 30 78 32-33 30 20 34 38 20 31 20  .DS+ 0x230 48 1
0240:  34 20 34 32 00 00 00 00-00 00 00 00 00 00 00 00  4 42............
0250:  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
>                                                                               
Notice that the only difference is the "+" before the first space. The '+' causes the Display command to output in the Foreground rather in the Background. In this case, it means that in the Background, the Parsing Buffer (which is the command line entered) was purged before the Display command was executed. In the Foreground, the Display command was executed while the Parsing Buffer still contained the command line, after which the command line was purged. Another indication of this is where the '>' prompts were output.

Before beginning this, enter "R = 0":

>DS+ 0x230 48 1 4 42 800 0xFFFFE 250 18
SRAM contents:
0230:  26 44 53 2B 20 30 78 32-33 30 20 34 38 20 31 20  &DS+ 0x230 48 1
0240:  34 20 34 32 20 38 30 30-20 30 78 46 46 46 46 45  4 42 800 0xFFFFE
0250:  20 32 35 30 20 31 38 00-00 00 00 00 00 00 00 00   250 18.........
>
>9   0x230 48 1 4 42 800 0xFFFFE 250 18

 10   32   54   76   98  1110 1312 1514 1716 1918 2120 2322 2524 2726 2928 3130
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
0000 04DF 0987 FF28-2204 0000 0000 6000-0021 2000 0D10 0230-0000 023A 0280 314C
0000 04DF 0987 FF28-2204 0000 0000 6000-0021 2000 090A 0030-0000 023D 0280 314C
0000 04DF 0987 FF28-2204 0000 0000 6000-0021 2000 090A 0001-0000 023F 0280 314C
0000 04DF 0987 FF28-2204 0000 0000 6000-0021 2000 090A 0004-0000 0241 0280 314C
0000 04DF 0987 FF28-2204 0000 0000 6000-0021 2000 090A 002A-0000 0244 0280 314C
0000 04DF 0987 FF28-2204 0000 0000 6000-0021 2000 090A 0320-0000 0248 0280 314C
0000 04DF 0987 FF28-2204 0000 0000 6000-0021 2000 0D10 FFFE-000F 0250 0280 314C
0000 04DF 0987 FF28-2204 0000 0000 6000-0021 2000 090A 00FA-0000 0254 0280 314C
0000 04DF 0987 FF28-2204 0000 0000 6000-0021 0000 090A 0012-0000 0000 0280 314C
>                                                                               
The DS+ command simply allows us to see what was in the Parsing Buffer and the location of each substring therein. Issuing the same command with "9 " replacing "DS+" parses each as an LONG INTEGER (LONG, or 32-bit) value into R25:R24:R23:R22, sets the pointer to the next substring in R27:R26 (called 'X') and parsing result status flags in R21.

Line #   Text Parsed   Value in R25:R24:R23:R22   Pointer to next in R27:R26   Status in R21
1 " 0x230" 0x00000230 0x023A 0x0D (nonzero, hex, and valid)
2 " 48" 0x00000030 0x023D 0x09 (nonzero and valid)
3 " 1" 0x00000001 0x023F 0x09
4 " 4" 0x00000004 0x0241 0x09
5 " 42" 0x0000002A 0x0244 0x09
6 " 800" 0x00000320 0x0248 0x09
7 " 0xFFFFE" 0x000FFFFE 0x0250 0x0D
8 " 250" 0x000000FA 0x0254 0x09
9 " 18" 0x000FFFFE 0x0000 (no more strings) 0x09

Here is another set, this time without the buffer display, which still starts at address 0x0230, so the space between the '9' and the '2' is located at address 0x0232):

>9 2 0 -1 -42 14 0xFFFFFFFF 591751049 0x123456789 14
 10   32   54   76   98  1110 1312 1514 1716 1918 2120 2322 2524 2726 2928 3130
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
0000 0360 09C3 FF28-2204 0000 0000 6000-0021 204C 090A 0002-0000 0234 0280 314C
0000 0360 09C3 FF28-2204 0000 0000 6000-0021 204C 010A 0000-0000 0236 0280 314C
0000 0360 09C3 FF28-2204 0000 0000 6000-0021 204C 890A FFFF-FFFF 0239 0280 314C
0000 0360 09C3 FF28-2204 0000 0000 6000-0021 2000 890A FFD6-FFFF 023D 0280 314C
0000 0360 09C3 FF28-2204 0000 0000 6000-0021 2000 090A 000E-0000 0240 0280 314C
0000 0360 09C3 FF28-2204 0000 0000 6000-0021 2000 0D10 FFFF-FFFF 024B 0280 314C
0000 0360 09C3 FF28-2204 0000 0000 6000-0021 2000 090A 6789-2345 0255 0280 314C
0000 0360 09C3 FF28-2204 0000 0000 6000-0021 0901 1C10 0000-0000 0000 0280 314C
>                                                                               
Line #   Text Value Parsed   Value Returned   Pointer to Next Substring   Status
1 " 2" 0x00000002 0x0234 0x09 (nonzero and valid)
2 " 0" 0x00000000 0x0236 0x01 (zero and valid)
3 " -1" 0xFFFFFFFF 0x0239 0x89 (negative, nonzero, and valid
4 " -42" 0xFFFFFFD6 0x023D 0x89
5 " 14" 0x0000000E 0x0240 0x09
6 " 0xFFFFFFFF" 0xFFFFFFFF 0x024B 0x0D (nonzero, hex, and valid)
7 " 591751049" 0x23456789 0x0255 0x0D (nonzero, hex, and valid)
8 " 0x123456789" 0x00000000 0x0000 (no more strings) 0x1C (negative, nonzero, hex, and invalid)
9 " 14" Not parsed; the "invalid" which was returned in line 8 above ended the parsing

See also:
  The ParseValue and ParseValueAfter System Commands.