Category : BASIC Source Code
Archive   : QB_FOSL.ZIP
Filename : QB_FOSL.BAS

 
Output of file : QB_FOSL.BAS contained in archive : QB_FOSL.ZIP
'*---------------------------------------------------------------------------*
'* *
'* *
'* *
'* QuickBASIC/FOSSIL interface demonstration. *
'* *
'* *
'* *
'* *
'* *
'* *
'* *
'* *
'* *
'* *
'* *
'* *
'* *
'* *
'* *
'*---------------------------------------------------------------------------*
'
'
DEFINT A-Z
'
'*---------------------------------------------------------------------------*
'* DECLARATIONS *
'*---------------------------------------------------------------------------*
'
'*---------------------------------------*
'* Declare our sub & functions *
'*---------------------------------------*
'
DECLARE SUB CarrierDetect ()
DECLARE SUB adios (ErrorLevel)
DECLARE FUNCTION QBFossil (Service AS INTEGER, port AS INTEGER)
'
'
'*---------------------------------------*
'* Fossil service's (specified in AH) *
'*---------------------------------------*
'
CONST FOSSIL.SetBaudRate = &H0 '
CONST FOSSIL.XmitWithWait = &H100 '
CONST FOSSIL.ReceiveWithWait = &H200 '
CONST FOSSIL.GetStatus = &H300 '
CONST FOSSIL.Init = &H400 '
CONST FOSSIL.DeInit = &H500 '
CONST FOSSIL.DTR = &H600 '
CONST FOSSIL.GetTimerTickPrm = &H700 '
CONST FOSSIL.FlushOutputBuffer = &H800 '
CONST FOSSIL.PurgeOutputBuffer = &H900 '
CONST FOSSIL.PurgeInputBuffer = &HA00 '
CONST FOSSIL.XmitNoWait = &HB00 '
CONST FOSSIL.PeekaBoo = &HC00 '
CONST FOSSIL.KeyboardReadNoWait = &HD00 '
CONST FOSSIL.KeyboardReadWithWait = &HE00 '
CONST FOSSIL.FlowControl = &HF00 '
CONST FOSSIL.BreakCheckToggle = &H1000 '
CONST FOSSIL.SetCursorLoc = &H1100 '
CONST FOSSIL.GetCursorLoc = &H1200 '
CONST FOSSIL.VideoANSIWrite = &H1300 '
CONST FOSSIL.WatchdogToggle = &H1400 '
CONST FOSSIL.VideoBIOSWrite = &H1500 '
CONST FOSSIL.TimerTickChain = &H1600 '
CONST FOSSIL.Reboot = &H1700 '
CONST FOSSIL.ReadBufferedBlock = &H1800 '
CONST FOSSIL.WriteBufferedBlock = &H1900 '
CONST FOSSIL.SendBreakSignal = &H1A00 '
CONST FOSSIL.GetDriveInfo = &H1B00 '
CONST FOSSIL.InstallFossilAppendage = &H7E00 '
CONST FOSSIL.DeleteFossilAppendage = &H7F00 '
'
'
'*---------------------------------------*
'* Other declarations *
'*---------------------------------------*
'
CONST CARRIERMASK = &H80 ' May be different for cheap modems
CONST BufferEmptyMASK = &H4000
'
'
'
'*---------------------------------------------------------------------------*
'* MAIN CODE *
'*---------------------------------------------------------------------------*
'
'
'*---------------------------------------*
'* Check our command line *
'*---------------------------------------*
CLS
PRINT "QuickBASIC/FOSSIL demonstration program, v0.00"
PRINT
IF COMMAND$ = "" THEN
PRINT " Usage: QB_FOSL "
adios 0
END IF
SELECT CASE VAL(COMMAND$)
CASE IS > 3
PRINT "A valid 'port' is 0 to 3"
adios 0
CASE ELSE
FossilPort = VAL(COMMAND$)
END SELECT


'*---------------------------------------*
'* Initialize the fossil driver *
'*---------------------------------------*
IF &H1954 <> QBFossil(FOSSIL.Init, FossilPort) THEN
PRINT "There is no fossil driver present."
adios 0
END IF

CarrierDetect


'*---------------------------------------*
'* Write something local - BIOS *
'*---------------------------------------*
'
WriteMe$ = "This is an example of a local BIOS screen write." + CHR$(13) + CHR$(10) + CHR$(13) + CHR$(10)
xpos = 0
WHILE xpos < LEN(WriteMe$)
xpos = xpos + 1
ASCIIchar = ASC(MID$(WriteMe$, xpos, 1))
NULL = QBFossil(FOSSIL.VideoBIOSWrite + ASCIIchar, FossilPort)
WEND


'*---------------------------------------*
'* Write something local - ANSI *
'*---------------------------------------*
'
WriteMe$ = CHR$(27) + "[0;36;mThis is a local " + CHR$(27) + "[32;40;1mANSI " + CHR$(27) + "[0;36;mscreen write." + CHR$(13) + CHR$(10) + CHR$(13) + CHR$(10)
xpos = 0
WHILE xpos < LEN(WriteMe$)
xpos = xpos + 1
ASCIIchar = ASC(MID$(WriteMe$, xpos, 1))
NULL = QBFossil(FOSSIL.VideoANSIWrite + ASCIIchar, FossilPort)
WEND


'*---------------------------------------*
'* Write something local/remote ANSI *
'*---------------------------------------*
'
WriteMe$ = CHR$(27) + "[0;36;mThis is a local " + CHR$(27) + "[32;40;1mand " + CHR$(27) + "[0;36;mremote ANSI screen write." + CHR$(13) + CHR$(10) + CHR$(13) + CHR$(10)
xpos = 0
WHILE xpos < LEN(WriteMe$)
xpos = xpos + 1
ASCIIchar = ASC(MID$(WriteMe$, xpos, 1))
'
' Write it locally...
'
NULL = QBFossil(FOSSIL.VideoANSIWrite + ASCIIchar, FossilPort)
'
' Write it remotely
'
DO WHILE 0 = QBFossil(FOSSIL.XmitNoWait + ASCIIchar, FossilPort)
'
' A 0000h was returned in AX, indicating a full xmit buffer. If
' the buffer wasn't full, a 0001h would of been returned.
'
' You might want to give back a time slice to your m'tasker
' here. We'll just keep on trying to xmit and check the carrier
' along the way.
'
CarrierDetect
LOOP
WEND


'*---------------------------------------*
'* Wait for the output buffer to clear *
'*---------------------------------------*
'
WHILE (QBFossil(FOSSIL.GetStatus, FossilPort) AND BufferEmptyMASK) = 0
'
' Better check the CD
'
CarrierDetect
WEND


'*---------------------------------------*
'* Deinit the fossil & exit *
'*---------------------------------------*
'
NULL = QBFossil(FOSSIL.DeInit, FossilPort)
adios 0

SUB adios (ErrorLevel)


SYSTEM

END SUB

SUB CarrierDetect

SHARED FossilPort

IF (CARRIERMASK AND QBFossil(FOSSIL.GetStatus, FossilPort)) <> CARRIERMASK THEN
CLS
BEEP
PRINT "Woops, we lost the carrier -- exiting."
adios 1
END IF

END SUB



  3 Responses to “Category : BASIC Source Code
Archive   : QB_FOSL.ZIP
Filename : QB_FOSL.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/