Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.

For parsing command line arguments intelligently, see Parsing command-line arguments.

Example command line:

myprogram -c "alpha beta" -h "gamma"

argv   IS    $1
argc   IS    $0
i      IS    $2
 
       LOC   #100
Main   LOC   @
       SETL  i,1               % i = 1
Loop   CMP   $3,argc,2         % argc < 2 ?
       BN    $3,1F             % then jump to end
       XOR   $255,$255,$255    % clear $255
       8ADDU $255,i,argv       % i*8 + argv
       LDOU  $255,$255,0       % argv[i]
       TRAP  0,Fputs,StdOut    % write the argument
       GETA  $255,NewLine      % add a newline
       TRAP  0,Fputs,StdOut
       INCL  i,1               % increment index
       SUB   argc,argc,1       % argc--
       BP    argc,Loop         % argc > 0? then Loop
1H     LOC   @
       XOR   $255,$255,$255    % exit(0)
       TRAP  0,Halt,0
 
NewLine BYTE #a,0