*  explain.a
*
*  Program cmdline help
*

*               nolist
                ifnd    IFILES
IFILES          set     1
                INCLUDE "exec/types.i"
                INCLUDE "libraries/dos.i"
                INCLUDE "libraries/dos_lib.i"
                INCLUDE "call.i"
                endc
*               list


NEWLINE         EQU     $0a

                CSECT   text,0,0,1,2

                XREF    _ConOut,_DOSBase,_Pr

                Func    _Explain
                lea.l   ExplMsg1(pc),a0                 Load introducer
                bsr.s   ConMsg                          Print
                move.l  _Pr(a4),a0                      Load programname from cmdline
                bsr.s   ConMsg                          Print
                lea.l   ExplMsg2(pc),a0                 Rest of the explain text

                Func    ConMsg,@ConMsg                  Print (a0) to the console (Not stdout)
                movem.l d2/d3/a6,-(a7)
                move.l  a0,d2                           String
                beq.s   ConMsgRtn                       No string..
                moveq.l #-1,d3                          Init length parameter
10$             addq.l  #1,d3                           Counter
                tst.b   (a0)+                           String terminator?
                bne.s   10$                             No..
                move.l  _ConOut(a4),d1                  Console file handle
                move.l  _DOSBase(a4),a6
                jsr     _LVOWrite(a6)
ConMsgRtn       movem.l (a7)+,d2/d3/a6
                rts


ExplMsg1
  dc.b 'Syntax:   ',0
ExplMsg2
  dc.b ' {<unit(s)> {<Command(s)>}}',NEWLINE
  dc.b 'Function: Modify a Trackdisk device unit addressed by its unit number',NEWLINE
  dc.b '    <no args>       Show present status',NEWLINE
  dc.b 'Units:',NEWLINE
  dc.b ' 0-3   Unit(s)      Succeeding commands are applied to listed units',NEWLINE
  dc.b '  a    All:         Succeeding commands are applied to all TD units',NEWLINE
  dc.b '  !    Warning      Suppress error if the following unit does not exist',NEWLINE
  dc.b 'Commands:',NEWLINE
  dc.b '<none> TD in RAM:   No special functions, just all known bugs removed',NEWLINE
  dc.b '  s    SectorDisk:  Let Trackdisk only give errors from bad sectors',NEWLINE
  dc.b '  t   .TrackDisk:   Normal: Let TD give errors from bad tracks',NEWLINE
  dc.b '  n    NoClick:     Perform noclick on the unit(s)',NEWLINE
  dc.b '  c   .Click:       Normal: No noclick',NEWLINE
  dc.b '  r    ReadOnly:    Make unit read-only, simulate open disk-tab',NEWLINE
  dc.b '  w   .WriteEnable: Normal: Unit is read/write according to disk-tab',NEWLINE
  dc.b '  v    Verify:      Read written track back and compare',NEWLINE
  dc.b '  b   .Believe:     Normal: Asume track is written well',NEWLINE
  dc.b '  o    Original:    Let TD execute in its original ROM code',NEWLINE
  dc.b '  /    Separator:   F.e. "0/2n"  Units 0 and 2 in RAM, noclick only on 2',NEWLINE
  dc.b '  ?    Explain:     If given (anywhere), no commands are executed',NEWLINE
  dc.b 0


                END


