Alert 0,"F1-Capture On F2-Capture Off| Right mouse button-Menu Bar| Undo-Exit",1,"Ok",Void%
Hidem
Else
Out 1,C% ! Output character to modem
If Echo! ! Output to screen if half duplex
Out 2,C%
Endif
If C%=13 ! Carriage return
Out 1,10 ! Send linefeed to modem
If Lf! ! Send linefeed to screen if linefeeds on
Out 2,10
Endif
Endif
If Capture! ! Save to capture buffer if on
Capture$=Capture$+Chr$(C%)
If Len(Capture$)>31999 ! Full yet?
Alert 2,"Capture buffer is full!|Would you like to save it?",1,"Yes|No",Answer%
If Answer%=1 ! Yep
@Save_capture ! Ask if they want to save it
Capture!=False ! and turn off capture.
Endif
Endif
Endif
Endif
Endif
Endif
Endif
Until Leave! ! Don't leave until it's time
Return
'
Procedure Gone
@Curs_off ! Shut off cursor
Menu Kill ! Clear the menu bar
Showm ! Show dat mouse
Edit ! Take this out prior to compiling
System ! Get out of Dodge
Return
'
' ************** Menu Stuff *********************************************
'
Procedure Build_menu_bar
Local I%
Menu Kill ! Kill any previous menu bar
Restore Main_list_menu_data
For I%=0 To 59 ! Load data into menu bar
Read Menu_bar$(I%)
Exit If Menu_bar$(I%)="***"
Next I%
Let Menu_bar$(I%)=""
Main_list_menu_data:
Data Desk," Miniscule Term "
Data -------------------
Data 1,2,3,4,5,6,""
Data Options, Terminal ,---------------, Half Duplex , Full Duplex ,---------------, Linefeeds ON , Linefeeds OFF ,---------------, Pulse , Tone ,---------------, Quit ,""
Data Baud, 300 , 1200 , 2400 , 4800 , 9600 ,""
Data Capture, On , Off ,--------------, Load Capture , Save Capture ,--------------, View , Print ,--------------, Send ,--------------, Clear ,""
Data Dialer, Dial ,----------------, Edit Number ,----------------, Load Directory , Save Directory ,----------------, LD String , LD Character ,""
Data Config, Load Configuration , Save Configuration ,""
Data ***
@Clr_screen ! Clear lower section of screen
Menu Menu_bar$() ! Put up menu bar
@Set_checks ! Set menu bar selection checks
Return
'
Procedure Menu_handler
Local M$,N$,Nm$
Local Answer%,Void%,L%,I%,Abort_capture!,Switched!,N%
M$=Menu_bar$(Menu(0)) ! What was selected?
If M$=" Miniscule Term "
Alert 1,"Miniscule Term v"+Version$+"| by Harry Sarber| "+Version_date$,1,"OK",Void%
Endif
If M$=" Terminal " ! Go back to the terminal
Leave_menu_bar!=True
Endif
If M$=" Half Duplex " ! Set duplex
Echo!=True
@Set_checks
Endif
If M$=" Full Duplex "
Echo!=False
@Set_checks
Endif
If M$=" Linefeeds ON " ! Set linefeeds flag
Lf!=True
@Set_checks
Endif
If M$=" Linefeeds OFF "
Lf!=False
@Set_checks
Endif
If M$=" Pulse " ! Pulse/Tone flag
Tone!=False
@Set_checks
Endif
If M$=" Tone "
Tone!=True
@Set_checks
Endif
If M$=" Quit " ! Exit Miniscule Term from Menu Bar
Alert 2,"Quit Miniscule Term?",1,"Yes|No",Answer%
If Answer%=1
@Gone
Endif
Endif
If M$=" 300 " ! Set baud
@Set_baud(Baud%(1))
Bd%=1
@Set_checks
Endif
If M$=" 1200 "
@Set_baud(Baud%(2))
Bd%=2
@Set_checks
Endif
If M$=" 2400 "
@Set_baud(Baud%(3))
Bd%=3
@Set_checks
Endif
If M$=" 4800 "
@Set_baud(Baud%(4))
Bd%=4
@Set_checks
Endif
If M$=" 9600 "
@Set_baud(Baud%(5))
Bd%=5
@Set_checks
Endif
If M$=" On " ! Capture on/off
@Capture_on
@Set_checks
Endif
If M$=" Off "
Capture!=False
@Set_checks
Endif
If M$=" Load Capture " ! Load Capture
Answer%=1
If Capture$<>""
Alert 2,"Loading into the buffer|will delete data presently|in the Capture buffer.",1,"Load|Abort",Answer%
Endif
If Answer%=1
@Load_capture
Endif
Endif
If M$=" Save Capture " ! Save Capture
If Capture$<>""
@Capture_alert
Else
@Do_alert("save")
Endif
Endif
If M$=" View " ! View Capture
If Capture$<>""
Menu Kill
Hidem
Cls
Abort_capture!=False
L%=1
For I%=1 To Len(Capture$)
Print Mid$(Capture$,I%,1);
If Mid$(Capture$,I%,1)=Chr$(13)
Inc L%
If L%=24
L%=1
Print
Print
Print At(19,25);"Left button-Continue Right button-Abort";
Repeat
Until Mousek
If Mousek=2
Abort_capture!=True
Endif
Print
Endif
Endif
Exit If Abort_capture!
Next I%
If Not Abort_capture!
Print At(27,25);"Any button to continue...";
Repeat
Until Mousek=0
Repeat
Until Mousek
Endif
Cls
Showm
Menu Menu_bar$() ! Put menu bar back up
On Menu Gosub Menu_handler
@Set_checks ! Set menu checks
Else
@Do_alert("view")
Endif
Endif
If M$=" Print " ! Print Capture
If Capture$<>""
Alert 2,"Print out Capture buffer?",1,"Yes|No",Answer%
If Answer%=1
Lprint Capture$
Endif
Else
@Do_alert("print")
Endif
Endif
If M$=" Send " ! Send Capture over modem
If Capture$<>""
Alert 2,"Send Capture buffer to modem?",1,"Yes|No",Answer%
If Answer%=1
For I%=1 To Len(Capture$)
Out 1,Asc(Mid$(Capture$,I%,1)) And 127
Next I%
Endif
Else
@Do_alert("send")
Endif
Endif
If M$=" Clear " ! Clear Capture
If Capture$<>""
Alert 2,"Clear the Capture buffer?",2,"Yes|No",Answer%
If Answer%=1
Capture$=""
Endif
Else
@Do_alert("clear")
Endif
Endif
If M$=" Dial " ! Dial a number
Dial_number!=False
Pg%=1
@Show_prompt("Dial")
@Show_dialer
@Show_names
@Show_page
@Show_ld_string
@Get_number
If Number_picked! And Name$(((Pg%-1)*10)+Number%)<>"" And Not Abort_number!
Dial_number!=True
Leave_menu_bar!=True
Endif
Endif
If M$=" Edit Number " ! Edit a number
Pg%=1
@Show_prompt("Edit")
@Show_dialer
@Show_names
@Show_page
@Get_number
If Number_picked! And Not Abort_number!
Hidem
If Name$(((Pg%-1)*10)+Number%)<>""
L%=25
N$=Left$(Name$(((Pg%-1)*10)+Number%),L%)
@Parse_line(N$,L%,*L%)
N$=Left$(N$,L%)
L%=16
Nm$=Right$(Name$(((Pg%-1)*10)+Number%),L%)
@Parse_line(Nm$,L%,*L%)
Nm$=Left$(Nm$,L%)
Endif
@Big_box(134,30,442,40)
Print At(20,5);"New Name:";
Form Input 25 As N$
@Big_box(134,30,442,40)
Print At(20,5);"New Number:";
Form Input 16 As Nm$
N$=N$+Space$(25-Len(N$))
Nm$=Nm$+Space$(16-Len(Nm$))
Name$(((Pg%-1)*10)+Number%)=N$+Space$(1)+Nm$
Deftext 2,,,6
Text 122,(Number%*10)+49,Name$(((Pg%-1)*10)+Number%)+Space$(42-Len(Name$(((Pg%-1)*10)+Number%)))
Repeat ! Sort names
Switched!=False
For N%=1 To 59
If Name$(N%+1)<Name$(N%)
Swap Name$(N%+1),Name$(N%)
Switched!=True
Endif
Next N%
Until Switched!=False
For I%=1 To 59
Exit If Name$(I%)<>""
Next I%
If I%>1
N%=1
For Num_names%=I% To 60
Swap Name$(N%),Name$(Num_names%)
Inc N%
Next Num_names%
Endif
Showm
Endif
Endif
If M$=" Load Directory " ! Load Directory
@Get_filename("DIR"," Load"," Directory")
If Filename$<>"" And Right$(Filename$,1)<>"\"
If Exist(Filename$)
@Load_dial_directory
Else
Alert 3,"File does not exist!",1,"Ok",Void%
Endif
Endif
Endif
If M$=" Save Directory " ! Save Directory
@Get_filename("DIR"," Save"," Directory")
If Filename$<>"" And Right$(Filename$,1)<>"\"
Open "O",#1,Filename$
Print #1;Ld_string$
For I%=1 To 60
If Name$(I%)<>""
Print #1;Name$(I%)
Endif
Next I%
Close #1
Endif
Endif
If M$=" LD String " ! Change long distance string
Hidem
@Big_box(136,30,442,40)
Print At(20,5);"New LD String:";
Form Input 20 As Ld_string$
Showm
Endif
If M$=" LD Character " ! Change long distance character
Hidem
@Big_box(200,30,380,40)
Print At(28,5);"New LD Character:";
Form Input 1 As Ld_char$
Showm
Endif
If M$=" Save Configuration " ! Save present configuration
@Get_filename("CFG"," Save","Configuration")
If Filename$<>"" And Right$(Filename$,1)<>"\"
Open "O",#1,Filename$
Print #1;Echo!
Print #1;Lf!
Print #1;Tone!
Print #1;Dial_string$
Print #1;Bd%
Print #1;Capture!
Print #1;Ld_char$
Close #1
Endif
Endif
If M$=" Load Configuration " ! Load configuration from disk
@Get_filename("CFG"," Load","Configuration")
If Filename$<>"" And Right$(Filename$,1)<>"\"
If Exist(Filename$)
@Load_config_file
Else
Alert 3,"That configuration file|does not exist!",1,"Ok",Void%
Endif
Endif
Endif
Menu Off ! Turn menu selection back off
Repeat
Until Mousek=0
@Clr_screen ! Clear out screen below menu
Return
'
' ***** Supporting procedures *****
'
'
Procedure Parse_line(L$,Ln%,Last%)
While Mid$(L$,Ln%,1)=Space$(1) And Ln%<>0
Dec Ln%
Wend
*Last%=Ln%
Return
'
Procedure Do_alert(A$)
Alert 3,"There is nothing in the|capture buffer to "+A$+"!",1,"Ok",Void%
Return
'
Procedure Clr_screen ! Filled green box
Deffill 3,1,1
Pbox 0,11,639,199
Return
'
Procedure Set_baud(B%) ! Set baud
A=Xbios(15,B%,1,-1,-1,-1,-1)
Return
'
Procedure Curs_on
A=Xbios(21,1,-1) ! Show cursor
A=Xbios(21,2,-1) ! and flash it.
Return
'
Procedure Curs_off
A=Xbios(21,0,-1) ! Hide cursor
Return
'
Procedure Capture_alert ! Save Capture buffer alert
Local Answer%
Alert 2,"Save capture buffer?",1,"Yes|No",Answer%
If Answer%=1
@Save_capture
Endif
Return
'
Procedure Get_filename(E$,L1$,L2$) ! Get a filename with extension E$
Local I%
Deftext 1,,,6
Deffill 0,1,1
@Big_box(10,50,127,71)
Text 16,59,L1$
Text 16,68,L2$
Path_name$=Space$(64) ! Reserve space for path name
Drive%=Gemdos(&H19) ! Get drive number
Ptr%=Varptr(Path_name$) ! Define pointer to variable
Void Gemdos(&H47,L:Ptr%,W:Drive%+1)
For I%=1 To 63
If Asc(Mid$(Path_name$,I%,1))=0
Path_name$=Left$(Path_name$,I%-1)
I%=63
Endif
Next I%
D$=Chr$(Drive%+65)+":"+Path_name$+"\*."+E$ ! Path to search
Fileselect D$,B$,Filename$ ! Get a filename
Return
'
Procedure Save_capture ! Save Capture buffer to file