Home » Archimedes archive » Acorn User » AU 1998-08.adf » Regulars » StarInfo/Vibe/MULTIPARM

StarInfo/Vibe/MULTIPARM

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1998-08.adf » Regulars
Filename: StarInfo/Vibe/MULTIPARM
Read OK:
File size: 027B bytes
Load address: 0000
Exec address: 0000
File contents
   10REM > MULTIPARM
   20
   30REM This small program reads a series of parameters after
   40REM the program name. Any number of parameters up to 10
   50REM read in by this program.
   60REM
   70REM The syntax is *PROGNAME parm1 parm2 ... parm10
   80REM or in the case of this program:
   90REM
  100REM *MULTIPARM parm1 parm2 ... parm10
  110
  120
  130DIM PARMLST$(10)
  140SYS "OS_GetEnv" TO PWORK%
  150PCNT%=0:WHILE (PCNT%?PWORK%)>31:PCNT%+=1:ENDWHILE:PCNT%?PWORK%=13
  160PARM$=MID$($PWORK%,INSTR($PWORK%,CHR$34+" ")+2)
  170PCNT%=0:P1%=0:PARM$+=" "
  180REPEAT
  190P2%=INSTR(PARM$," ",P1%+1)
  200IFP2%<>0 PCNT%+=1:PARMLST$(PCNT%)=MID$(PARM$,P1%+1,P2%-P1%-1):P1%=P2%
  210UNTILP2%=0
  220
  230FORN%=1TOPCNT%:PRINT"'"PARMLST$(N%)"'":NEXT

� > MULTIPARM

;� This small program reads a series of parameters after
(9� the program name. Any number of parameters up to 10
2� read in by this program.
<�
F4� The syntax is *PROGNAME parm1 parm2 ... parm10
P%� or in the case of this program:
Z�
d'� *MULTIPARM parm1 parm2 ... parm10
n
x
�� PARMLST$(10)
�ș "OS_GetEnv" � PWORK%
�;PCNT%=0:ȕ (PCNT%?PWORK%)>31:PCNT%+=1:�:PCNT%?PWORK%=13
�'PARM$=�$PWORK%,�$PWORK%,�34+" ")+2)
�PCNT%=0:P1%=0:PARM$+=" "
��
�P2%=�PARM$," ",P1%+1)
�D�P2%<>0 PCNT%+=1:PARMLST$(PCNT%)=�PARM$,P1%+1,P2%-P1%-1):P1%=P2%
�
�P2%=0
�
�%�N%=1�PCNT%:�"'"PARMLST$(N%)"'":�
�
00000000  0d 00 0a 11 f4 20 3e 20  4d 55 4c 54 49 50 41 52  |..... > MULTIPAR|
00000010  4d 0d 00 14 04 0d 00 1e  3b f4 20 54 68 69 73 20  |M.......;. This |
00000020  73 6d 61 6c 6c 20 70 72  6f 67 72 61 6d 20 72 65  |small program re|
00000030  61 64 73 20 61 20 73 65  72 69 65 73 20 6f 66 20  |ads a series of |
00000040  70 61 72 61 6d 65 74 65  72 73 20 61 66 74 65 72  |parameters after|
00000050  0d 00 28 39 f4 20 74 68  65 20 70 72 6f 67 72 61  |..(9. the progra|
00000060  6d 20 6e 61 6d 65 2e 20  41 6e 79 20 6e 75 6d 62  |m name. Any numb|
00000070  65 72 20 6f 66 20 70 61  72 61 6d 65 74 65 72 73  |er of parameters|
00000080  20 75 70 20 74 6f 20 31  30 0d 00 32 1e f4 20 72  | up to 10..2.. r|
00000090  65 61 64 20 69 6e 20 62  79 20 74 68 69 73 20 70  |ead in by this p|
000000a0  72 6f 67 72 61 6d 2e 0d  00 3c 05 f4 0d 00 46 34  |rogram...<....F4|
000000b0  f4 20 54 68 65 20 73 79  6e 74 61 78 20 69 73 20  |. The syntax is |
000000c0  2a 50 52 4f 47 4e 41 4d  45 20 70 61 72 6d 31 20  |*PROGNAME parm1 |
000000d0  70 61 72 6d 32 20 2e 2e  2e 20 70 61 72 6d 31 30  |parm2 ... parm10|
000000e0  0d 00 50 25 f4 20 6f 72  20 69 6e 20 74 68 65 20  |..P%. or in the |
000000f0  63 61 73 65 20 6f 66 20  74 68 69 73 20 70 72 6f  |case of this pro|
00000100  67 72 61 6d 3a 0d 00 5a  05 f4 0d 00 64 27 f4 20  |gram:..Z....d'. |
00000110  2a 4d 55 4c 54 49 50 41  52 4d 20 70 61 72 6d 31  |*MULTIPARM parm1|
00000120  20 70 61 72 6d 32 20 2e  2e 2e 20 70 61 72 6d 31  | parm2 ... parm1|
00000130  30 0d 00 6e 04 0d 00 78  04 0d 00 82 12 de 20 50  |0..n...x...... P|
00000140  41 52 4d 4c 53 54 24 28  31 30 29 0d 00 8c 1b c8  |ARMLST$(10).....|
00000150  99 20 22 4f 53 5f 47 65  74 45 6e 76 22 20 b8 20  |. "OS_GetEnv" . |
00000160  50 57 4f 52 4b 25 0d 00  96 3b 50 43 4e 54 25 3d  |PWORK%...;PCNT%=|
00000170  30 3a c8 95 20 28 50 43  4e 54 25 3f 50 57 4f 52  |0:.. (PCNT%?PWOR|
00000180  4b 25 29 3e 33 31 3a 50  43 4e 54 25 2b 3d 31 3a  |K%)>31:PCNT%+=1:|
00000190  ce 3a 50 43 4e 54 25 3f  50 57 4f 52 4b 25 3d 31  |.:PCNT%?PWORK%=1|
000001a0  33 0d 00 a0 27 50 41 52  4d 24 3d c1 24 50 57 4f  |3...'PARM$=.$PWO|
000001b0  52 4b 25 2c a7 24 50 57  4f 52 4b 25 2c bd 33 34  |RK%,.$PWORK%,.34|
000001c0  2b 22 20 22 29 2b 32 29  0d 00 aa 1c 50 43 4e 54  |+" ")+2)....PCNT|
000001d0  25 3d 30 3a 50 31 25 3d  30 3a 50 41 52 4d 24 2b  |%=0:P1%=0:PARM$+|
000001e0  3d 22 20 22 0d 00 b4 05  f5 0d 00 be 19 50 32 25  |=" ".........P2%|
000001f0  3d a7 50 41 52 4d 24 2c  22 20 22 2c 50 31 25 2b  |=.PARM$," ",P1%+|
00000200  31 29 0d 00 c8 44 e7 50  32 25 3c 3e 30 20 50 43  |1)...D.P2%<>0 PC|
00000210  4e 54 25 2b 3d 31 3a 50  41 52 4d 4c 53 54 24 28  |NT%+=1:PARMLST$(|
00000220  50 43 4e 54 25 29 3d c1  50 41 52 4d 24 2c 50 31  |PCNT%)=.PARM$,P1|
00000230  25 2b 31 2c 50 32 25 2d  50 31 25 2d 31 29 3a 50  |%+1,P2%-P1%-1):P|
00000240  31 25 3d 50 32 25 0d 00  d2 0a fd 50 32 25 3d 30  |1%=P2%.....P2%=0|
00000250  0d 00 dc 04 0d 00 e6 25  e3 4e 25 3d 31 b8 50 43  |.......%.N%=1.PC|
00000260  4e 54 25 3a f1 22 27 22  50 41 52 4d 4c 53 54 24  |NT%:."'"PARMLST$|
00000270  28 4e 25 29 22 27 22 3a  ed 0d ff                 |(N%)"'":...|
0000027b