 Rem File: IO12.bas - Dndedit.bas
 Rem $Include: 'dndedit.inc'

 Function Form$(Var#)
   Form$=Format$(Var#,"#,##0;;"+Chr$(34)+"zero"+Chr$(34))
 End Function

' prepare to display copyright screen
Sub Shell.ANSI.Program(Var%)
 On Local Error Goto ErrTrap9x2
 If Max.Row=41 Or Max.Row=48 Then
    If Max.Row=41 Then VarX=43
    If Max.Row=48 Then VarX=50
    Call CopyScrn(VarX)
 Endif
 Exit Sub
ErrResume9x2:
 Exit Sub
ErrTrap9x2:
 Resume ErrResume9x2
End Sub

' display copyright screen
Sub CopyScrn(VarQ)
 On Local Error Goto End.Copy

 VarX$=Ucase$(Environ$("BLIND"))
 If VarX$="ON" Or VarX$="-1" Or VarX$="TRUE" Then
    Border.Off=-1
 Endif

 VarX$=Ucase$(Environ$("BLINDCHAR"))
 If VarX$="ON" Or VarX$="-1" Or VarX$="TRUE" Then
    Border.Char=-1
 Endif

 ' check ansi extended screen
 IF VarQ THEN
    Var%=VarQ
 END IF

 ' get default directory
 DND.Path$=Environ$("DNDBBS")
 If DND.Path$<>"" Then
    If Right$(DND.Path$,1)<>"\" Then
       DND.Path$=DND.Path$+"\"
    Endif
 Endif

 ' read usage filename from config file
 FileName2$=DND.Path$+"DND.CFG"
 Close #TempFile1
 Open FileName2$ For Input Shared As #TempFile1
 Line Input #TempFile1,Var$
 For Temp1=1 To MaxConfigArray1
    Input #TempFile1,Var!
 Next
 For Temp1=1 To MaxConfigArray2
    Input #TempFile1,Var2%
 Next
 For Temp1=1 To MaxConfigArray3
    Line Input #TempFile1,Var$
    Select Case Temp1
    Case 11
       Var1$=Rtrim$(Var$) ' \dnddat
    Case 51
       Var2$=Rtrim$(Var$) ' usage
    Case 15
       Var3$=Rtrim$(Var$) ' .dat
    End Select
 Next

 ' init usage file
 Close #TempFile1
 FileName2$=Var1$+Var2$+Var3$
 If FileName2$<>"" Then
    Open FileName2$ For Random Shared As #TempFile1 Len=26
    Field #TempFile1,26 As S$
    Lset S$="DND Usage File "+Version$+Chr$(13)+Chr$(10)+Chr$(26)
    Put #TempFile1,1
    Field #TempFile1,10 As D$, 8 As T$, 8 As X$ ' date/time/counter
    If Lof(TempFile1)/26<2 Then
       Lset D$=Format$(Now,"mm-dd-yyyy")
       Lset T$=Format$(Now,"hh:mm:ss")
       Lset X$=Mkd$(0#)
       Put #TempFile1,2
    Endif
    Get #TempFile1,2
    Var#=Cvd(X$)
    If Lof(TempFile1)/26<3 Then
       Lset D$="01-01-1980"
       Lset T$=Format$(Now,"hh:mm:ss")
       Lset X$=Mkd$(0#)
       Put #TempFile1,3
    Endif
 Endif

 ' display 43 line copyright screen
 If Var%=43 Then
    Locate 42, 1
    Color 14, 1
    For Temp = 24 To 43
       Locate Temp, 1
       Print Space$(80);
    Next
    Locate 27, 3, 1
    If Border.Off=0 Then
       If Border.Char=0 Then
          Print Chr$(201); String$(74, 205); Chr$(187);
       Else
          Print "+"; String$(74, "-"); "+";
       Endif
       For Temp = 28 To 42
          Locate Temp, 3, 1
          If Border.Char=0 Then
             Print Chr$(186);
          Else
             Print "|";
          Endif
          Locate Temp, 78, 1
          If Border.Char=0 Then
             Print Chr$(186);
          Else
             Print "|";
          Endif
       Next
       Locate 42, 3, 1
       If Border.Char=0 Then
          Print Chr$(200); String$(74, 205); Chr$(188);
       Else
          Print "+"; String$(74, "-"); "+";
       Endif
    Endif
    Color 15, 1
    Locate 28, 72, 1
    Print "TM";
    Locate 29, 8, 1
    If Border.Off=0 Then
       If Border.Char=0 Then
          Print String$(19, 205); "  F  R  E  E  W  A  R  E  "; String$(19, 205);
       Else
          Print String$(19, "-"); "  F  R  E  E  W  A  R  E  "; String$(19, "-");
       Endif
    Else
       Print String$(19, 32); "  F  R  E  E  W  A  R  E  "; String$(19, 32);
    Endif
    Color 11, 1
    Locate 30, 8, 1
    Print "Dungeons  And  Dragons  Bulletin  Board  System  Adventure  Game";

    Color 14, 1
    Locate 31, 8, 1
    Strng$=Version$+" "+Release$
    Print Strng$;
    Call Amount2(Var#,Var$)
    Strng$="Run: "+RunMode$+Var$
    Temp=72-Len(Strng$)
    Locate 31, Temp, 1
    Print Strng$;

    Color 14, 1
    Locate 33, 8, 1
    Print "Contributions for registration can be made in cash or check to:";
    Locate 35, 25, 1
    Print "Erik Jon Oredson";
    Locate 36, 25, 1
    Print "1615 S. 4th St. #M1605";
    Locate 37, 25, 1
    Print "Mpls., MN., 55454-1174";
    Locate 40, 25, 1
    Print "Support: dndbbs@gmail.com";
    Locate 41, 25, 1
    Print "Url: www.filegate.net/pdn/pdnbasic/";
    Color 15, 1
    Locate 42, 1
    Exit Sub
 Endif

 ' display 50 line copyright screen
 If Var%=50 Then
    Locate 49, 1
    Color 14, 1
    For Temp = 24 To 50
       Locate Temp, 1
       Print Space$(80);
    Next
    Locate 27, 3, 1
    If Border.Off=0 Then
       If Border.Char=0 Then
          Print Chr$(201); String$(74, 205); Chr$(187);
       Else
          Print "+"; String$(74, "-"); "+";
       Endif
       For Temp = 28 To 47
          Locate Temp, 3, 1
          If Border.Char=0 Then
             Print Chr$(186);
          Else
             Print "|";
          Endif
          Locate Temp, 78, 1
          If Border.Char=0 Then
             Print Chr$(186);
          Else
             Print "|";
          Endif
       Next
       Locate 48, 3, 1
       If Border.Char=0 Then
          Print Chr$(200); String$(74, 205); Chr$(188);
       Else
          Print "+"; String$(74, "-"); "+";
       Endif
    Endif
    Color 15, 1
    Locate 28, 72, 1
    Print "TM";
    Locate 29, 8, 1
    If Border.Off=0 Then
       If Border.Char=0 Then
          Print String$(19, 205); "  F  R  E  E  W  A  R  E  "; String$(19, 205);
       Else
          Print String$(19, "-"); "  F  R  E  E  W  A  R  E  "; String$(19, "-");
       Endif
    Else
       Print String$(19, 32); "  F  R  E  E  W  A  R  E  "; String$(19, 32);
    Endif
    Color 11, 1
    Locate 30, 8, 1
    Print "Dungeons  And  Dragons  Bulletin  Board  System  Adventure  Game";

    Color 14, 1
    Locate 31, 8, 1
    Strng$=Version$+" "+Release$
    Print Strng$;
    Call Amount2(Var#,Var$)
    Strng$="Run: "+RunMode$+Var$
    Temp=72-Len(Strng$)
    Locate 31, Temp, 1
    Print Strng$;

    Color 14, 1
    Locate 33, 8, 1
    Print "Contributions for registration can be made in cash or check to:";
    Locate 35, 25, 1
    Print "Erik Jon Oredson";
    Locate 36, 25, 1
    Print "1615 S. 4th St. #M1605";
    Locate 37, 25, 1
    Print "Mpls., MN., 55454-1174";
    Locate 40, 25, 1
    Print "Support: dndbbs@gmail.com";
    Locate 41, 25, 1
    Print "Url: www.filegate.net/pdn/pdnbasic/";
    Color 15, 1
    Locate 43, 8, 1
    Print "Dndbbs may be distributed freely  with the following restrictions:";
    Color 14, 1
    Locate 44, 8, 1
    Print "The program is not changed or modified before distribution. No fee";
    Locate 45, 8, 1
    Print "is charged for using the program.  The program is not sold or used";
    Locate 46, 8, 1
    Print "for profit. The above copyright notices are not altered or removed.";
    Color 11, 1
    Locate 47, 8, 1
    Print "Copyright (c)ejo 1980-"+YearRelease$+", Dndbbs public domain freeware programs.";
    Locate 49, 1
 Endif
Exit.Copy:
 Exit Sub
End.Copy:
 Resume Exit.Copy
End Sub

Sub Amount2(Var#,Var$)
 VarX$=Ltrim$(Str$(Var#)) ' 1.111D308
 V=Instr(VarX$,"D")
 If V Then
    If Mid$(VarX$,2,1)="." Then
       VarX$=Left$(VarX$,1)+Mid$(VarX$,V)
    Endif
    Var$=" "+VarX$
 Else
    Var$=" "+Form$(Var#)
 Endif
End Sub
