[comp.binaries.ibm.pc] switch, demonstrates how to read command line switches

cgs@umd5.umd.edu (Chris Sylvain) (09/24/88)

[ One of three programs received as a single package.  I edited the
submitter's description.  -- R.D. ]

SWITCH demonstrates one way to read single-letter switches from the
command line.  The command line switches are received by the program
from the program segment prefix (PSP) beginning at offset 80h.  The
executable and assembly source are supplied.

The program uses a single memory word (one bit per switch) to store
information for 16 switches, assumed to be /A through /P.  All switches
are treated as toggles.  The code commenting, wording of printing
messages and some of the code itself have been changed in a number of
places.

This is one of three programs, being posted consecutively to this
newsgroup, that was written using MASM 5.0 by Hardin Brothers for the
April 1988 issue of PC Resource magazine, (C) Copyright 1988 by IDG
Communications/Peterborough, Inc.

Hardin Brothers is a freelance programmer and technical writer. Write
to him at 280 N. Campus Ave., Upland, CA  91786. Enclose a self-
addressed, stamped envelope for a reply.

[
Uudecode this article normally or feed to the "combine" script.

checksum     size (bytes)  file
   49901         3545      this uuencoded posting
   61009         2552      switch.arc

-- R.D.
]

BEGIN--cut here--cut here
begin 644 switch.arc
M&@A35TE40T@N05--`%Y>N0@``"41U&5JCX<.```,8]ZT:5/&#9T$?!HH4)B`
M"IHT<T#`D?/FC)PP;4"0*=/FC9LY="[2*1/18QD0=\+D`4'G#0@Y9<*0`3$G
MC9LS;,JTR$EGI!R:=]+0&8.&)`@S%-LPI%,41,"!8=S,9&.SC`L0#D\^;1-U
M:E6@0HD:#0/S99DQ9=+8*3-3S$JF91A.K'@Q(U*!+)O.M8B19IDS!`U*A&DF
M#1X0**!,@9("A)B_-MW8/`,B#!T0;\R8F5/F,@X8:%PH9)AU,-V^=3A'#$-S
M<DX0!#O*67GGC9R9*$PZ%BJQS,\Y08>B:=R29DN8#&V:L<V53AJ/1VV#B&$#
MK'"2+"K/F5.'X,SBCT&\")*78ITS:,1#N1J$#1OK8N<P)'LR9,R1,\-$;'D&
M)\FKI06TD5,"!>;<3=G5=MMDF)DQF$T'GL$00=N%<<984M$DT$F9Y:75&P,*
MQ1D;#J(1QEJ.E5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