!*! Updated on 21-Sep-89 at 2:08 PM by James A. Jarboe IV; edit time: 0:26:51
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! AUXSBR.BAS
!
! Sample program to set up and use AUXSBR.SBR in a Basic program.
!
! This program uses AUXSBR.SBR.
!
! Current release version of AUXSBR.SBR is 1.1(102)
!
! Get:
! AUXSBR.M68 from AMUS
! AUXSBR.DOC from AMUS
! DUMB.M68 from AMUS
!
! Written by:
! James A. Jarboe IV
! Educational Video Network, Inc.
! 1401 19th Street
! Huntsville, TX 77340
! (409)- 295-5767
! GR/AM
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MAP1 FILEN,S,25 ! Filename to print
MAP1 BFLAG,B,1 ! Returned flag from AUXSBR.SBR
MAP1 AUXERR(5),S,40 ! AUXSBR errors
AUXERR(1)="Requested FILENAME not found."
AUXERR(2)="Requested File is a RANDOM file."
AUXERR(3)="DUMB.TDV not found on a TRMDEF. "
AUXERR(4)="File is already in use. (LOKSER)"
AUXERR(5)="Any other File service system error"
MAP1 FRM,F,6
MAP1 I,F,6
MAP1 HELP(50),S,80
HELP(01) = " By James A. Jarboe IV"
HELP(02) = ""
HELP(03) = " This program is provided to give an EXAMPLE and help in the SETUP of"
HELP(04) = ""
HELP(05) = " AUXSBR.SBR"
HELP(06) = ""
HELP(07) = "AUXSBR.SBR allows the Auxiliary port on a terminal to be used as output"
HELP(08) = "of data to any device attached to the terminal's auxiliary port such as"
HELP(09) = "a printer."
HELP(10) =""
HELP(11) =" To setup AUXSBR.SBR so that it works you must have the terminal driver"
HELP(12) =" DSK0:DUMB.TDV[1,6]"
HELP(13) =" on your system and loaded as a terminal driver on a TRMDEF statement"
HELP(14) =" in your .INI file prior to booting the system."
HELP(15) =""
HELP(16) ="EXAMPLE: TRMDEF PRINTER,AM300=3:DUMB,9600,20,20,20"
HELP(17) =""
HELP(18) =" used as a printer driver on any valid printer, or"
HELP(19) =""
HELP(20) =" TRMDEF AUXPRT,PSEUDO,DUMB,1,1,1"
HELP(21) =" "
HELP(22) =" used as driver loaded onto the system at bootup time for usage are both"
HELP(23) =" valid. It is not necessary to use both lines since a driver is loaded "
HELP(24) =" only once into the system."
HELP(25) =""
HELP(26) ="Example of calling AUXSBR.SBR from BASIC:"
HELP(27) =""
HELP(28) =" XCALL AUXSBR, Filename, Flag"
HELP(29) ="Where:"
HELP(30) =" Filename = a STRING variable containing the name of the file"
HELP(31) =" to print through the terminal's auxiliary port."
HELP(32) =""
HELP(33) =" Flag = a BINARY 1 variable in which a status is return to"
HELP(34) =" the basic program."
HELP(35) =" 0 = All ok"
HELP(36) =" 1 = Filename not found"
HELP(37) =" 2 = File is RANDOM"
HELP(38) =" 3 = DUMB.TDV was not found on a TRMDEF statement"
HELP(39) =" 4 = File already in use (LOKSER)."
HELP(40) =" 5 = Any other File service error."
SETUP:
CALL SCREEN ! display help
? TAB(2,1);TAB(-1,10);
? " SETUP"
?
? " To see if your printer is setup correctly to the terminal's auxiliary"
? " port and that your current terminal driver is setup to accept the"
? " correct TCRT calls to turn the auxiliary port ON and OFF,"
? " this program will now use the PRINT TAB(-1,82) and PRINT TAB(-1,83)"
? " TCRT calls."
?:?
? TAB(-1,11);" Turn your printer ";TAB(-1,12);"ON ";
? TAB(-1,11);" and Press a ";TAB(-1,12);"CR ";
INPUT "",Z$
!
!
! tab -1,82 will turn the aux port on if the terminal driver is coded right
!
PRINT TAB(-1,82);
!
! this stuff will print on printer if tab(-1,82) worked.
? " !!!!!! ATTENTION !!!!!!"
? " YOU GOT DATA ON YOUR PRINTER"
!
! send a form feed
? CHR$(12)
!
! tab(-1,83) will turn the aux port off if the terminal driver is coded right
!
PRINT TAB(-1,83);
? "" :? ""
? "If everything worked out right you should have the following printed"
? "out on the printer attached to the terminal's auxiliary port"
? ""
? " !!!!!! ATTENTION !!!!!!"
? " YOU GOT DATA ON YOUR PRINTER"
?
? "If not then check your TERMINAL DRIVER PROGRAM and see that the TCRT calls"
? "82 and 83 are the correct sequence of codes to turn your terminal's"
? "auxiliary port on and off."
CALL PAUSE
? TAB(2,1);TAB(-1,10);
? ""
? " If you did get data printed on your printer, then"
? " this program will now use AUXSBR.SBR to check if the DUMB.TDV is "
? " available on this system and correctly placed on a TRMDEF statement."
OK:
?
? TAB(-1,11);" Enter ";TAB(-1,12);"OK ";TAB(-1,11);
? "and Press a ";TAB(-1,12);" Return. ";
INPUT "",Z$
IF UCS(Z$)[1,2]#"OK" THEN GOTO QUIT
FILEN="@$^%*("
!
! lets call auxsbr and see if DUMB.TDV is attached to a TRMDEF statement
! so that AUXSBR can use it. FILEN has a garbage name in it so that if
! DUMB is located we will get an error flag of BFLAG=1. But we are not going
! to check for it as we are only checking for the location of DUMB at this
! time.
XCALL AUXSBR,FILEN,BFLAG
IF BFLAG=3 THEN GOTO NO'DUMB
! If we got here then .INI file has a TRMDEF with DUMB on it.
GETIT:
? TAB(2,1);TAB(-1,10);
?
?
? " Now we are going to attempt the final test using AUXSBR.SBR."
?
? "This final test is to see if the cable connected to the printer is"
? "set-up correctly to handle handshaking. To do this you are going to"
? "print out a file. If handshaking is working then the file will print"
? "out completely. If handshaking is not working correctly then you will"
? "most probably get data overun and garbage will printout because the"
? "printer will not keep up with the data it receives."
?
? "I suggest printing out AUXSBR.BAS. So......."
?
?
? TAB(-1,11);" Enter a ";TAB(-1,12);"File name ";TAB(-1,11);
? "to print ( go ahead try AUXSBR.BAS) ";TAB(-1,12);
INPUT LINE "",FILEN
IF FILEN="" GOTO DO'XCALL
?
? "The Terminal Auxiliary port should now be on and data should be"
? "printing on the printer attached to the auxiliary Port."
? "Screen Display will cease until file is through printing. "
! Call AUXSBR with filespec and print out file
DO'XCALL:
XCALL AUXSBR,FILEN,BFLAG
LOOP2:
IF BFLAG<>0 THEN GOTO AUXERR
?
FILEN = UCS(FILEN)
? FILEN;" should now be printed out on the printer."
?
? "AUXSBR.SBR will open and close the file to be printed, so "
? "the BASIC program does not have to deal with opening or closing"
? "the file to print. AUXSBR.SBR is LOKSER compatible in that if a"
? "file is already locked in use, AUXSBR.SBR will report with an error"
? "number of '4' in the binary error flag and will not attempt to print"
? "the selected file. AUXSBR.SBR will also work with from within an AMOS"
? "MULTI environment if the screen is a 'full' screen."
?
? "Good Luck !"
? "Program FINISHED."
END
!
! AUXSBR returns a flag to indicate errors
! 0 = all ok
! 1 = filespec not found
! 2 = File was RANDOM
! 3 = DUMB not on a TRMDEF statement in INI file
! 4 = File is already in use. (LOKSER)
! 5 = Any other file service system error.
!
AUXERR:
? TAB(2,1);TAB(-1,10)
?
? TAB(15,1);"AUXSBR.SBR ";TAB(-1,11);
? "returned an error code of ";TAB(-1,12);
? BFLAG
?
? TAB(-1,11);"MEANING: ";TAB(-1,12);
? AUXERR(BFLAG)
END
!
! Display help screen
!
SCREEN:
? TAB(-1,0);TAB(1,80);TAB(-1,33);TAB(1,1);TAB(-1,32);
? TAB(1,27);TAB(-1,11);" AUXSBR.SBR SAMPLE PROGRAM ";TAB(-1,12);
? TAB(1,80);TAB(-1,33)
PAGE1:
FRM=1
PAG:
? TAB(2,1);TAB(-1,10);
FOR I=FRM TO FRM+19
IF I>40 THEN GOTO NXI
? HELP(I)
NXI:
NEXT I
PAUSE:
? TAB(23,1);
? TAB(-1,11);"Press a ";TAB(-1,12);"CR ";TAB(-1,11);"to continue";
? TAB(-1,12);" ";
INPUT "",Z$
FRM=I
IF I<40 THEN GOTO PAG
I=100
RETURN
NO'DUMB:
? TAB(2,1);tab(-1,10);
?
? " OOOPs !!!!"
?
? "DUMB.TDV has not been added to a TRMDEF statement so AUXSBR could not"
? "find it to use it. READ the documentation and add DUMB to a TRMDEF"
? "Statement in your .INI file and REBOOT your system."
?
? "Then try this program again and you will be one step closer to having"
? "AUXSBR.SBR working on your system!."
?
ENDED:
?
? TAB(-1,11);"Program has ";TAB(-1,12);"ENDED."
?
END
QUIT:
? TAB(2,1);TAB(-1,10);
Z$="N"
? TAB(10,18);"ARE YOU SURE YOU WANT TO QUIT? ";
INPUT "",Z$
IF UCS(Z$)#"Y" THEN GOTO OK
END