1 ; get arguments from command line (when DOS supports it)
3 ; Freddy Offenga, 4/21/2000
5 MAXARGS = 16 ; max. amount of arguments in arg. table
6 CL_SIZE = 64 ; command line buffer size
7 SPACE = 32 ; SPACE char.
10 .import __argc, __argv
13 .constructor initmainargs,25
24 lda __dos_type ; which DOS?
26 bne argdos ; DOS supports arguments
29 ; Initialize ourcl buffer
34 ; Move SpartaDOS command line to our own buffer
54 sta ourcl,y ; null terminate behind ATEOL
56 ; Turn command line into argv table
60 eatspc: lda ourcl,y ; eat spaces
64 bne rpar ; begin of argument found
68 beq finargs ; only spaces is no argument
70 ; Store argument vector
72 rpar: lda __argc ; low-byte
92 cpx #ATEOL ; end of line?
100 ; End of arg. -> place 0
106 cpx #ATEOL ; was it the last arg?
126 argv: .res (1 + MAXARGS) * 2
128 ; Buffer for command line / argv strings
130 ourcl: .res CL_SIZE+1