--------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3E00049 Date: 03/07/98 From: CHRIS GUNN Time: 05:11pm \/To: JOHN ZORTMAN (Read 3 times) Subj: Fossil Modem Driver Library (1/3) JZ> scratch elsewhere. My main project involves Modems/Terminals/Door JZ> Games that I was going to write using QBSerial 3.10. (Is there a newer JZ> version?) I'd already mixed assembly language and BASIC many years ago JZ> and wrote and ran the "Nut House" BBS, was President of the local Howdy John, I've written some nice door programs with QB4.5. If you peek around inside the EXE's for some door programs, you'll find a lot of them are written in QuickBasic. First advice is just about all BBS programs use the BNU or X00 fossil drivers and so do most Door programs. Part of the advantage is it makes your comm program independent of what COM ports are in use. They also provide hat you need to send ANSI codes to your local screen. The fossil drivers can be installed and work in parallel with a BBS program that works the modem rect. Since it's already available, put the fossil drivers to work. Get rid of the silly QBSerial library and build up your own so you are in full control. Get a copy of BNU*.ZIP and X00*.ZIP. They should be on a BBS in your area. The doc you need for modem interrupts is in X00 and will also work for BNU. At the foot is my MODEMS.BI which is an expansion of QB.BI. I'll put most of the modem related subroutines declared in the next message. Build your own for the others or whack them out and add the ones you've already developed. Among other things, you'll find DOOR.SYS and DORINFO already covered. Once you've got working code, it's not hard to adapt it to the flavors you want. Hollar if you need any of the missing subroutines. Hope this helps ou build some neat stuff. Chris P.S. I don't post this whole thing very often. If folks might decide to play with the modem, they should grab it now. =========================== MODEMS.BI ============================= 'MODEMS.BI Include module for MODEM.BAS ' Christopher G. Gunn 'Last Update: 14MAR91 18MAR91 24MAR91 04JUN91 03AUG91 06AUG94 30AUG96 'Define the type needed for Interrupt TYPE RegType ax AS INTEGER bx AS INTEGER cx AS INTEGER dx AS INTEGER bp AS INTEGER si AS INTEGER di AS INTEGER flags AS INTEGER END TYPE 'Define the type needed for InterruptX TYPE RegTypeX ax AS INTEGER bx AS INTEGER cx AS INTEGER dx AS INTEGER bp AS INTEGER si AS INTEGER di AS INTEGER flags AS INTEGER ds AS INTEGER es AS INTEGER END TYPE 'Generate a software interrupt, loading all but the segment registers DECLARE SUB Interrupt (intnum AS INTEGER, inreg AS RegType, outreg AS egType) 'Generate a software interrupt, loading all registers DECLARE SUB InterruptX (intnum AS INTEGER, inreg AS RegTypeX, outreg AS RegTypeX) DECLARE SUB BeepANSI (Beeps%) DECLARE SUB CheckANSI (Flag%) DECLARE SUB ClearScreen (PClr%, BClr%) DECLARE SUB ClrSpot (Top%, Bot%, Clr%) DECLARE SUB CommInit (Flag%) DECLARE SUB CommRecvBuff (Word$) DECLARE SUB CommSendBuff (Word$) DECLARE SUB CommSendChrs (Word$) DECLARE SUB CommStatus (Bits%()) DECLARE SUB ErrorMsgs () DECLARE SUB Flash (FlashOn%, VF$, VL%, Clr%) DECLARE SUB FlashANSI (VErr$, MLne%, PClr%, BClr%) DECLARE SUB GetMdmField (Word$, Size%, Em%, MLne%, MCur%) DECLARE SUB GetMdmKey (K$, Ki%, CheckTime%) DECLARE SUB HelpWindow (MsgKey$, Top%, Lft%, Shdw%) DECLARE SUB Holding (Dly@) DECLARE SUB ModemColor (Send%, PClr%, BClr%, MColor$) DECLARE SUB ModemPosit (Send%, MLne%, MCur%, Posit$) DECLARE SUB OpenModem (Path$, File$) DECLARE SUB PressANSI (VL%, PClr%, BClr%) DECLARE SUB PrintANSI (BiosAct%, PWord$, PClr%, BClr%) DECLARE SUB PromptANSI (VP$, MLne%, MCur%, PClr%, BClr%) DECLARE SUB SendHigh (Word$, MLne%, MCur%, HighClr%, PClr%, BClr%, AnsiAct%) DECLARE SUB SendMsg (VP$, MLne%, MCur%, PClr%, BClr%, AnsiAct%) DECLARE SUB SndBlip (Blips%) DECLARE SUB SndChirp () DECLARE SUB StripModem () DECLARE SUB SystemLog (VLog$) DECLARE FUNCTION BlankTrim$ (Word$) DECLARE FUNCTION CheckExist% (Path$, File$, NoErr%) DECLARE FUNCTION CheckPaths% (Path$, Make%, NoErr%) DECLARE FUNCTION SwapChar$ (Word$, Find$, With$) COMMON SHARED /Modems/ Regs AS RegType, RegX AS RegTypeX COMMON SHARED /Modems/ DeBug%, EFlag%, VErr$, Demo%, Snd%, SW%, Video$ COMMON SHARED /Modems/ PgmPath$, TourPath$, LogPath$, LogFile$, HelpFile$ COMMON SHARED /Modems/ CPos%, Ext$, Node%, BiosAct%, MaxDim%, SYSOP% COMMON SHARED /Modems/ Updates%, DaysAct%, Approval%, Catalog%, Security% COMMON SHARED /Modems/ Port%, Echo%, Baud%, Bits%(), TimeCtrl%, Caller$() COMMON SHARED /Modems/ Modem$, ANSI%, ClrAct%, TimeOut%, TimeLeft%, Animate% COMMON SHARED /Modems/ C() AS INTEGER, B() AS INTEGER, Mode() AS INTEGER COMMON SHARED /Modems/ Pal%(), Kf%(), DSZPath$, DSZFile$ SW% = 80 REDIM C(10) AS INTEGER REDIM B(10) AS INTEGER REDIM Mode(16) AS INTEGER REDIM Kf%(16) REDIM Pal%(16) 'ANSI character codes CONST ACode = "[" CONST ABell = "" CONST SCHome = "" CONST SCLine = "" CONST SClear = "" CONST WrapOff = "[=7l" CONST WrapOn = "[=7h" 'ANSI Colors CONST ASyst = "" 'Modem Control codes CONST EchoOn = "AT E1" CONST EchoOff = "AT E0" CONST AnsOn = "AT S0=1" CONST AnsOff = "AT S0=0" CONST HangUp = "AT H0" CONST Mon12 = "___JanFebMarAprMayJunJulAugSepOctNovDec" '*********** END MODEM.BI ************** --- FMail 0.96 * Origin: BIZynet - Worldwide Business via the E-Ways (1:15/55.1) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3E00050 Date: 03/07/98 From: CHRIS GUNN Time: 04:38pm \/To: JOHN ZORTMAN (Read 3 times) Subj: Fossil Modem Driver Library (2/3) Howdy John, Here's the module with the subroutines for working the modem using the BNU and X00 fossil drivers. Other fossil drivers should also behave. Chris ==================================================== 'MODEM.BAS Holding module for Modem related subroutines ' Christopher G. Gunn 'Last Update: 14MAR91 17MAR91 19MAR91 25MAR91 08MAY91 12MAY91 26MAY91 'Last Update: 15AUG92 20AUG92 10SEP92 28SEP92 DECLARE SUB BeepANSI (Snd%, Beeps%) DECLARE SUB ClearLineANSI (Top%, Bot%, Hue%) DECLARE SUB Flash (SW%, VF$, VL%, Km%, Snd%, PClr%, BClr%) DECLARE SUB GetMdmKey (K$, Ki%) DECLARE SUB Holding (Dly#) DECLARE SUB HighANSI (Word$, HighClr%, BaseClr%) DECLARE SUB LockModem (Node%, LogPath$) DECLARE SUB ModemColor (Send%, MClr%, MColor$) DECLARE SUB ModemError (EFlag%, LogPath$, VErr$) DECLARE SUB ModemPosit (Send%, MLne%, MCur%, Fetch$) DECLARE SUB PrintANSI (BiosAct%, PWord$, MClr%) DECLARE SUB PromptANSI (VP$, MLne%, MCur%, MClr%) DECLARE SUB RecvModem (Word$) DECLARE SUB SendModem (Word$, Code%, PortIn$) DECLARE SUB SendMsg (VP$, MLne%, MCur%, MClr%) DECLARE SUB SndBlip (Snd%, Blips%) DECLARE SUB ModemStatus (Bits%()) DECLARE SUB StripModem () DECLARE SUB SystemLog (Path$, File$, VLog$) COMMON SHARED /Modem/ DeBug%, EFlag%, VErr$, Snd%, SW%, C(), B(), Text$ COMMON SHARED /Modem/ Node%, BiosAct%, MaxDim%, M() AS STRING REM $INCLUDE: 'D:\QB7\MODULES\MODEMS.BI' TrapNext: EFlag% = ERR RESUME NEXT '**************** END MODEM.BAS ****************** SUB BeepANSI (Snd%, Beeps%) 'Send BELL beeps FOR X% = 1 TO Beeps% Xmit$ = Xmit$ + ABell NEXT X% CALL SendModem(Xmit$, 0, PortIn$) CALL SndBlip(Snd%, Beeps%) IF Echo% THEN CALL StripModem END SUB SUB CheckANSI (Flag%) 'Ansi Detection Routine IF Baud% THEN ' Ensure buffers stripped if Local Echo is active CALL StripModem ' Test for ANSI response Flag% = 0 ' Set ANSI detection flag to false before testing Code$ = ACode + "6n" + CHR$(13) FOR X% = 1 TO 3 PortIn$ = "": 'Send the ansi sequence for "status check" CALL SendModem(Code$, 0, PortIn$) 'three second loop if needed CALL Holding(1): Check$ = "" CALL RecvModem(Check$) IF INSTR(Check$, Code$) THEN Echo% = 1 ELSE Echo% = 0 ' Yes! Ansi detected IF Echo% = 0 AND INSTR(Check$, CHR$(27)) THEN Flag% = 1: EXIT FOR IF INSTR(Check$, "\") THEN Flag% = 1: EXIT FOR NEXT X% IF Echo% THEN VErr$ = "< Local Echo Active! Display errors may occur! >" CALL SystemLog(LogPath$, "ERROR.LOG", VErr$) CALL Flash(SW%, VErr$, 22, Km%, Snd%, 14, 4) END IF END IF END SUB SUB ClearLineANSI (Top%, Bot%, Hue%) 'Clear lines Top to Bot with the Hue% Color IF Top% < 1 THEN Top% = 1 IF Bot% > 25 THEN Bot% = 25 FOR X% = Top% TO Bot% CALL SendMsg(SPACE$(80), X%, 1, Hue%) NEXT X% END SUB SUB ClearScreen 'Clear the screen with ANSI code or Page IF Baud% THEN IF ANSI% THEN CALL SendMsg(SClear, 1, 1, 0) ELSE CALL SendModem(CHR$(12), 0, PortIn$) COLOR 7, 0: CLS END IF ELSE COLOR 7, 0: CLS END IF END SUB SUB FlashANSI (Ki%, VErr$, MLne%, MClr%, Snd%) STATIC Ki% = 0: 'Flash ANSI message in center of uncleared displayed line CALL ClearLineANSI(MLne%, MLne%, 0) IF LEN(VErr$) > 80 - 2 THEN VErr$ = LEFT$(VErr$, 80 - 2) MCur% = (80 - LEN(VErr$)) / 2: 'Set new cursor position Cnt% = 0: X$ = SPACE$(LEN(VErr$)) DO: CALL BeepANSI(Snd%, 1): Cnt% = Cnt% + 1 X% = MCur%: CALL SendMsg(VErr$, MLne%, X%, MClr%) IF Ki% = 0 AND Cnt% < 4 THEN CALL Holding(.5) X% = MCur%: CALL SendMsg(X$, MLne%, X%, MClr%) CALL Holding(.1) END IF LOOP WHILE Ki% = 0 AND Cnt% < 4 IF Echo% THEN CALL StripModem IF VErr$ <> LastErr$ THEN CALL SystemLog(LogPath$, "ERROR.LOG", VErr$) END IF LastErr$ = VErr$: VErr$ = "" END SUB SUB GetInput (VP$, MLne%, MCur%, Size%, Word$) STATIC 'Send prompt to modem and display - then get answer 'If Size%=1 then get single key - else wait for return IF LEN(VP$) > 80 THEN VP$ = LEFT$(VP$, 80) IF MLne% < 1 THEN MLne% = 1 ELSE IF MLne% > 24 THEN MLne% = 24 IF MCur% < 1 THEN MCur% = 1 BseCur% = MCur% IF Size% > 1 THEN 'Set block and color X% = MCur%: CALL SendMsg(STRING$(Size%, ""), MLne%, X%, 3) END IF CALL SendMsg(VP$, MLne%, MCur%, -1): 'Print existing text IF Echo% THEN CALL StripModem: 'Clear anything in buffer IF Size% > 1 THEN Collect$ = Word$ ELSE Collect$ = "" DO: CALL GetMdmKey(K$, Ki%) IF Size% = 1 AND LEN(Word$) THEN IF Ki% = 13 THEN K$ = LEFT$(Word$, 1): Ki% = ASC(K$) IF INSTR("" + Word$ + CHR$(27), UCASE$(K$)) < 2 THEN K$ = "": Ki% = 0 END IF IF Ki% THEN Col% = LEN(Collect$) IF Ki% = 8 THEN 'Do BackSpace IF Col% THEN Collect$ = LEFT$(Collect$, Col% - 1) ELSE Ki% = 0: K$ = "": CALL BeepANSI(Snd%, 1) END IF END IF IF Size% = 1 THEN K$ = UCASE$(K$) IF LEN(Collect$) = Size% AND Ki% > 31 THEN CALL BeepANSI(Snd%, 1) ELSE IF Ki% > 31 THEN Collect$ = Collect$ + K$ IF Ki% <> 27 THEN IF Echo% = 0 THEN CALL SendMsg(K$, MLne%, MCur%, -1): 'Echo back IF Ki% = 8 THEN 'Blank local backspaced character MCur% = MCur% - 2 LOCATE MLne%, MCur%: PRINT ""; : LOCATE MLne%, MCur% END IF END IF END IF IF Size% = 1 THEN Size% = 0 IF Echo% THEN CALL StripModem END IF LOOP UNTIL Ki% = 13 OR Ki% = 27 OR Size% = 0 Word$ = Collect$ CALL SendMsg(SPACE$(Size%), MLne%, BseCur%, Mse%) END SUB SUB GetMdmKey (K$, Ki%) STATIC 'Get single key input from keyboard or Modem K$ = INKEY$: Ki% = 0: K% = 0 CALL RecvModem(K$) IF INSTR(K$, CHR$(27)) THEN ' Ensure get Function and Multi ANSI keys if buffer split IF Baud% > 2400 THEN D# = 1 ELSE D# = .4 CALL Holding(D#) CALL RecvModem(K$) END IF 'load all new keys onto buffer Buffer$ = Buffer$ + K$ IF LEN(Buffer$) THEN TimeOut% = 0: 'Pull oldest key off buffer - if any L% = 1: 'Standard character SELECT CASE ASC(Buffer$) CASE 0: IF LEN(Buffer$) > 1 THEN L% = 2: 'IBM Extended code CASE 27: 'ANSI Codes IF LEN(Buffer$) > 2 THEN IF MID$(Buffer$, 2, 1) = "[" THEN L% = 3: 'Extended key IF MID$(Buffer$, 2, 1) = "O" THEN L% = 3: 'Function key END IF END SELECT K$ = LEFT$(Buffer$, L%) 'Trim Xfered key from Buffer Buffer$ = RIGHT$(Buffer$, LEN(Buffer$) - LEN(K$)) END IF SELECT CASE LEN(K$) CASE 1: Ki% = ASC(K$): 'Standard Alphabet IF Ki% = 127 THEN Ki% = 338: 'ANSI Delete IF Ki% = 9 THEN K$ = "": 'Kill CASE 2: Ki% = ASC(RIGHT$(K$, 1)) + 255: 'IBM key Codes CASE 3: K% = ASC(RIGHT$(K$, 1)): 'ANSI key codes SELECT CASE K% CASE &H41: Ki% = 327: 'Cursor Up [A CASE &H42: Ki% = 335: 'Cursor Down [B CASE &H43: Ki% = 332: 'Cursor Right [C CASE &H44: Ki% = 330: 'Cursor Left [D CASE &H48: Ki% = 326: 'Home [H CASE &H4B: Ki% = 334: 'End [K CASE &H4D: Ki% = 328: 'Page Up [M CASE &H50: Ki% = 314: 'F1 [P CASE &H51: Ki% = 315: 'F2 [Q CASE &H77: Ki% = 316: 'F3 [w CASE &H78: Ki% = 317: 'F4 [x CASE &H74: Ki% = 316: 'F5 [t CASE &H70: Ki% = 317: 'F10 [p CASE ELSE: Ki% = 0: CALL BeepANSI(Snd%, 1) END SELECT END SELECT IF Ki% THEN ' LOCATE 24, 40: PRINT K%; "- "; K$; " "; : 'STOP IF Ki% <> 8 AND (Ki% < 32 OR Ki% > 255) THEN K$ = " " IF Ki% = 13 OR Ki% = 27 THEN K$ = "" TimeCtrl% = 0: 'Clear inactivity count END IF IF LEN(K$) > 2 THEN K$ = "" END SUB SUB GetMdmPrompt (K$, Km%) 'Get upper case key for menus/prompts 'IF K$ is bigger than one char then use as filter IF LEN(K$) > 1 THEN Tst$ = UCASE$(K$) ELSE Tst$ = "" DO: CALL GetMdmKey(K$, Ki%): Z% = Ki% IF Z% > 0 THEN K$ = UCASE$(K$): IF Ki% > 32 THEN Km% = ASC(K$) IF Tst$ > "" THEN Z% = INSTR(Tst$, K$) END IF LOOP UNTIL Z% > 0 OR Ki% = 13 OR Ki% = 27 IF Ki% > 27 THEN CALL SendModem(K$, 0, PortIn$): PRINT K$; END SUB SUB HighANSI (Word$, HighClr%, BaseClr%) STATIC 'Insert HighLight with color strings IF INSTR(Word$, "<") AND ANSI% > 0 THEN M$ = "": CALL ModemColor(0, BaseClr%, M$) H$ = "": CALL ModemColor(0, HighClr%, H$) MID$(H$, 8, 2) = MID$(M$, 8, 2) K% = 1: 'Highlight any Prompt characters DO: K% = INSTR(K%, Word$, "<") + 1: Z% = INSTR(K% + 1, Word$, ">") IF K% > 1 THEN Word$ = LEFT$(Word$, K% - 1) + H$ + MID$(Word$, K%, Z% - K%) + M$ + RIGHT$(Word$, LEN(Word$) - Z% + 1) END IF LOOP WHILE K% > 1 END IF END SUB SUB LockModem (Node%, LogPath$) ' Envoke BNU to pickup phone line for return to BBS ' Close comm port and set DTR high again IF Baud% THEN CALL StripModem: 'Clear the modem buffer DIM Regs AS RegType DIM Bits%(7) Regs.ax = &H400: '(AH/AL) Reinitialize the fossil driver Regs.dx = Port% - 1: '(DH/DL) Set the active comm port CLOSE : 'Release comm port CALL Interrupt(&H14, Regs, Regs): 'Reinit the fossil driver CALL ModemStatus(Bits%()) IF Bits%(7) THEN EXIT SUB: ' Carrier Detected X% = 0 CALL SystemLog(LogPath$, "ERROR.LOG", "Node:" + STR$(Node%) + " Try: " + STR$(X%) + " Testing carrier present!") FOR X% = 1 TO 5 Regs.ax = &H601: '(AH/AL) Force DTR high for insurance Regs.dx = Port% - 1: '(DH/DL) Set the active comm port CALL Interrupt(&H14, Regs, Regs) CALL ModemStatus(Bits%()): 'Get Fossil Driver status IF Bits%(7) THEN ' Carrier Detected EXIT FOR ELSE IF X% = 5 THEN CALL ModemError(17, LogPath$, VErr$): VErr$ = "" END IF NEXT X% END IF END SUB SUB ModemColor (Send%, MClr%, MColor$) IF ANSI% OR ClrAct% THEN SELECT CASE C(MClr%) CASE 0: C$ = "0;30;" 'Black CASE 1: C$ = "0;34;" 'Blue CASE 2: C$ = "0;32;" 'Green CASE 3: C$ = "0;36;" 'Cyan CASE 4: C$ = "0;31;" 'Red CASE 5: C$ = "0;35;" 'Purple CASE 6: C$ = "0;33;" 'Brown CASE 7: C$ = "0;37;" 'Silver CASE 8: C$ = "1;30;" 'Dark Grey CASE 9: C$ = "1;34;" 'Lt Blue CASE 10: C$ = "1;32;" 'Lt Green CASE 11: C$ = "1;36;" 'Lt Cyan CASE 12: C$ = "1;31;" 'Lt Red CASE 13: C$ = "1;35;" 'Magenta CASE 14: C$ = "1;33;" 'Yellow CASE 15: C$ = "1;37;" 'White END SELECT SELECT CASE B(MClr%) CASE 0, 8: B$ = "40m" 'Black CASE 1, 9: B$ = "44m" 'Blue CASE 2, 10: B$ = "42m" 'Green CASE 3, 11: B$ = "46m" 'Cyan CASE 4, 12: B$ = "41m" 'Red CASE 5, 13: B$ = "45m" 'Purple CASE 6, 14: B$ = "43m" 'Brown CASE 7, 15: B$ = "47m" 'Silver END SELECT MColor$ = ACode + C$ + B$ IF Send% THEN 'Output Color to Modem and Screen CALL SendModem(MColor$, 0, Fetch$) CALL PrintANSI(BiosAct%, MColor$, MClr%) END IF ELSE MColor$ = "" END IF END SUB SUB ModemError (EFlag%, LogPath$, VErr$) SELECT CASE EFlag% CASE 14: X$ = "Out of String Space" CASE 17: X$ = "Carrier Dropped!" CASE 24: X$ = "Modem Timeout" CASE 25: X$ = "Modem Fault" CASE 50: X$ = "Buffer Field Overflow" CASE 52: X$ = "Bad Name/Port Number" CASE 57: X$ = "Modem I/O Error" CASE 68: X$ = "Modem Unavailable" CASE 69: X$ = "Comm Buffer Overflow" END SELECT IF EFlag% THEN VErr$ = "< Node:" + STR$(Node%) + " ERROR" + STR$(EFlag%) + " " + X$ + "! >" SWAP EFlag%, Flag% CALL SystemLog(LogPath$, "ERROR.LOG", VErr$) IF Flag% <> 69 THEN CALL Flash(SW%, VErr$, 20, Km%, Snd%, 14, 4) SWAP EFlag%, Flag% END IF END SUB SUB ModemPosit (Send%, MLne%, MCur%, Posit$) STATIC 'Set modem display position and color IF Baud% OR ClrAct% THEN IF MLne% < LastMLne% THEN X$ = "H" ELSE X$ = "f" Posit$ = ACode + LTRIM$(STR$(MLne%)) + ";" + LTRIM$(STR$(MCur%)) + X$ IF Send% THEN 'Output position CALL SendModem(Posit$, 0, Fetch$) CALL PrintANSI(BiosAct%, Posit$, MClr%) END IF ELSE Posit$ = "" COLOR C(MClr%), B(MClr%): LOCATE MLne%, MCur% END IF LastMLne% = MLne% END SUB SUB ModemStatus (Bits%()) STATIC 'Get Fossil Driver status IF New% = 0 THEN REDIM Bits%(7): New% = 1 DIM Regs AS RegType END IF Regs.ax = &H300: '(AH/AL) Get Modem Status Regs.dx = Port% - 1: '(DH/DL) CALL Interrupt(&H14, Regs, Regs) ' 1 - Characters in Input buffer Bits%(0) = Regs.ax AND &H1 ' 2 - Input Buffer Overrun Bits%(1) = Regs.ax AND &H2 ' 4 - Not Used Bits%(2) = Regs.ax AND &H4 ' 8 - Always set Bits%(3) = Regs.ax AND &H8 ' 16 - Not Used Bits%(4) = Regs.ax AND &H10 ' 32 - Output Buffer Not full Bits%(5) = Regs.ax AND &H20 ' 64 - Output Buffer Empty Bits%(6) = Regs.ax AND &H40 '128 - Carrier Detected Bits%(7) = Regs.ax AND &H80 END SUB SUB OpenModem (Path$, File$, Modem$, LogFile$, Caller$()) 'Load the information from the Door Info file and open the modem port ' Check for existance of Path$ & File$ before calling REDIM Caller$(10) IF File$ = "" THEN File$ = "DORINFO1.DEF" EFlag% = 0: VErr$ = "": ON ERROR GOTO TrapNext OPEN Path$ + File$ FOR INPUT AS #1 LINE INPUT #1, X$: X% = 1 DO: IF INSTR(UCASE$(File$), "DORINFO") THEN SELECT CASE X% CASE 1: Caller$(1) = X$: 'BBS name CASE 2: Sysop$ = X$ CASE 3: Sysop$ = Sysop$ + " " + X$: Caller$(2) = Sysop$ CASE 4: Port% = VAL(RIGHT$(X$, 1)): Caller$(3) = X$ CASE 5: IF Baud% = 0 THEN Baud% = VAL(X$) Caller$(4) = X$ Parity% = 0 Bits% = 8 StpBit% = 1 CASE 6: IF X$ <> "0" THEN VErr$ = "< DORINFO file corrupt! >" CASE 7: Name$ = X$: 'Callers Name CASE 8: Name$ = Name$ + " " + X$: Caller$(5) = Name$ CASE 9: IF LEN(X$) THEN Caller$(6) = X$ ELSE Caller$(6) = "Unknown": 'City CASE 10: IF VAL(X$) < 1 THEN VErr$ = "< DORINFO file error! >" CASE 11: Security% = VAL(X$) CASE 12: TimeLeft% = VAL(X$) END SELECT ELSEIF INSTR(UCASE$(File$), "DOOR.") THEN SELECT CASE X% CASE 51: Caller$(1) = X$: 'BBS CASE 50: Sysop$ = X$: Caller$(2) = Sysop$ CASE 1: Caller$(3) = LEFT$(X$, 4): Port% = VAL(MID$(X$, 4, 1)) CASE 2: IF VAL(X$) > Baud% THEN Baud% = VAL(X$) Caller$(4) = X$ Parity% = 0 Bits% = 8 StpBit% = 1 CASE 5: IF VAL(X$) > Baud% THEN Baud% = VAL(X$) CASE 7: 'Parity% = INSTR("NOE", X$) - 1 CASE 3: 'Bits% = VAL(X$) CASE 4: 'StpBit% = VAL(X$) CASE 6: Caller$(6) = "Unknown": 'City is not available for WildCat CASE 10: Name$ = X$: Caller$(5) = Name$ CASE 14: Security% = VAL(X$) CASE 16: TimeLeft% = VAL(X$) CASE 35: Sysop$ = X$: Caller$(2) = Sysop$ END SELECT END IF LINE INPUT #1, X$: X% = X% + 1 LOOP WHILE NOT EOF(1) CLOSE #1 IF Baud% = 0 THEN Port% = 0 IF VErr$ = "" THEN Port$ = LTRIM$(STR$(Port%)) Baud$ = LTRIM$(STR$(Baud%)) IF Bits% > 7 THEN Parity% = 0 Parity$ = MID$("NOE", Parity% + 1, 1) Bits$ = LTRIM$(STR$(Bits%)) StpBit$ = LTRIM$(STR$(StpBit%)) Modem$ = "COM" + Port$ + ": " + Baud$ + "," + Parity$ + "," + Bits$ + "," + StpBit$ + ",BIN" CLOSE : 'Ensure all files are closed IF Port% THEN ' Open the modem communication port 'OPEN COM [speed] [,[parity] [,[data] [,[stop]]]][,Options] OPEN Modem$ FOR RANDOM AS #Port% END IF END IF IF EFlag% THEN CALL ModemError(EFlag%, LogPath$, VErr$) ELSE VLog$ = Name$ + " from: " + Caller$(6) + " " + VErr$ IF Port% = 0 THEN Baud% = 0: VLog$ = VLog$ + " {LOCAL}" IF LogFile$ > "" THEN CALL SystemLog(LogPath$, LogFile$, VLog$) END IF END SUB SUB PressANSI (K$, Ki%, VL%, MClr%) ' Retain cursor location and wait for keypress ' Will adjust center on Screen Width (SW%) IF SW% = 0 THEN SW% = 80 VP$ = " < Press any to continue > " KL% = CSRLIN: KC% = POS(0): IF SW% = 80 THEN VC% = 24 ELSE VC% = 4 CALL SendMsg(SPACE$(SW%), VL%, 1, 0) CALL SendMsg(VP$, VL%, VC%, MClr%) DO: CALL GetMdmKey(K$, Ki%): LOOP WHILE Ki% = 0 CALL SendMsg(SPACE$(SW%), VL%, 1, 0) CALL ModemPosit(1, KL%, KC%, Fetch$) END SUB SUB PrintANSI (BiosAct%, PWord$, MClr%) STATIC IF BiosAct% THEN 'Print PWord$ direct to display adapter for ANSI control IF PWord$ = "" THEN EXIT SUB IF New% = 0 THEN 'Load RegTypeX DIM Regs AS RegTypeX: New% = 1 END IF TIMER STOP FOR Px% = 1 TO LEN(PWord$) Regs.ax = &H200: '(AH/AL) Output direct to video display Regs.dx = ASC(MID$(PWord$, Px%, 1)): '(DH/DL) Output character CALL InterruptX(&H21, Regs, Regs) NEXT Px% TIMER ON ELSE 'Print screens direct for speed K% = INSTR(PWord$, ACode): Cnt% = 0 WHILE K% AND Cnt% < 25 IF K% THEN Z% = 1: WHILE Z% > 0 AND Z% <= K%: Z% = INSTR(Z% + 1, PWord$, "f"): WEND IF Z% - K% > 10 OR Z% = 0 THEN Z% = 1 IF Z% <= K% THEN WHILE Z% > 0 AND Z% <= K%: Z% = INSTR(Z% + 1, PWord$, "H"): WEND IF Z% > K% AND Z% - K% < 8 THEN 'Get line and cursor position Posit$ = MID$(PWord$, K%, Z% - K% + 1) PWord$ = LEFT$(PWord$, K% - 1) + RIGHT$(PWord$, LEN(PWord$) - Z%) VL% = VAL(MID$(Posit$, INSTR(Posit$, "[") + 1, 3)) VC% = VAL(MID$(Posit$, INSTR(Posit$, ";") + 1, 3)) END IF END IF K% = INSTR(PWord$, ACode) IF K% THEN Z% = 1: 'Get color intensity WHILE Z% > 0 AND Z% <= K%: Z% = INSTR(Z% + 1, PWord$, "m"): WEND IF Z% > K% AND Z% - K% < 10 THEN 'PClr$ = MID$(PWord$, K%, Z% - K% + 1) PWord$ = LEFT$(PWord$, K% - 1) + RIGHT$(PWord$, LEN(PWord$) - Z%) END IF END IF K% = INSTR(PWord$, SClear) IF K% THEN COLOR C(MClr%), B(MClr%): CLS : 'Clear Local screen PWord$ = LEFT$(PWord$, K% - 1) + RIGHT$(PWord$, LEN(PWord$) - 4) END IF K% = INSTR(PWord$, SCLine) IF K% THEN 'Clear rest of line PWord$ = LEFT$(PWord$, K% - 1) + RIGHT$(PWord$, LEN(PWord$) - K% - 2) LOCATE VL%, VC%: PRINT SPACE$(SW% - VC% + 1); END IF K% = INSTR(PWord$, ACode): Cnt% = Cnt% + 1 WEND COLOR 7, 0 IF PWord$ = CHR$(13) THEN PWord$ = "" IF VL% < 1 THEN VL% = 1 ELSE IF VL% > 24 THEN VL% = 24 IF VC% < 1 THEN VC% = 1 ELSE IF VC% > 80 THEN VC% = 1 COLOR C(MClr%), B(MClr%) LOCATE VL%, VC%: PRINT PWord$; END IF END SUB SUB PromptANSI (VP$, MLne%, MCur%, MClr%) 'Clear and set Prompt line. Center if MCur% = 0 CALL ClearLineANSI(MLne%, MLne%, 0) IF LEN(VP$) = 80 THEN MCur% = 1 ELSE IF MCur% = 0 THEN MCur% = 40 - (LEN(VP$) / 2) END IF CALL SendMsg(VP$, MLne%, MCur%, MClr%) MCur% = MCur% - 2 CALL ModemPosit(1, MLne%, MCur%, X$) LOCATE MLne%, MCur%: 'Set local screen position VP$ = "" END SUB SUB RecvModem (PortIn$) STATIC IF Baud% THEN EFlag% = 0: ON ERROR GOTO TrapNext WHILE LOC(Port%) X$ = INPUT$(LOC(Port%), #Port%) PortIn$ = PortIn$ + X$ IF EFlag% THEN GOSUB RECVTRAP: EFlag% = 0 WEND END IF EXIT SUB RECVTRAP: CALL ModemError(EFlag%, LogPath$, VErr$) IF EFlag% = 52 THEN SYSTEM: 'Modem error - Bad Port # IF EFlag% = 57 THEN SYSTEM: 'Modem error - I/O Device error RETURN END SUB SUB SendModem (Word$, Code%, PortIn$) STATIC 'Send Word$ to Modem IF New% = 0 THEN REDIM Bits%(7): New% = 1 DlySet# = .5: TimeStart# = TIMER DlySet# = INT(DlySet# * 100) / 100 END IF Cnt% = 0 WHILE ABS(TIMER - TimeStart#) < DlySet#: Cnt% = Cnt% + 1 IF INT(Cnt% / 10) = Cnt% / 10 THEN DlySet# = DlySet# - .001 DlySet# = ABS(INT(DlySet# * 1000) / 1000) WEND IF Cnt% < 5 THEN DlySet# = DlySet# + .001 EFlag% = 0: ON ERROR GOTO TrapNext IF Baud% THEN ' Loop until output buffer available DO: CALL ModemStatus(Bits%()) IF Bits%(5) = 0 THEN CALL SndBlip(Snd%, 1): ' STOP: 'Buffer Full LOOP UNTIL Bits%(5) OR Bits%(7) IF Code% THEN ' "AT" code or return required PRINT #Port%, Word$ ELSE Cnt% = 0 DO: EFlag% = 0: ' Send Text/Prompt lines PRINT #Port%, Word$; IF EFlag% THEN Cnt% = Cnt% + 1: DlySet# = DlySet# + .02 CALL Flash(SW%, STR$(DlySet#) + "< Modem Problem! >", 24, Km%, Snd%, 14, 5)'STOP END IF LOOP WHILE EFlag% AND Cnt% < 50 EFlag% = Cnt% TimeStart# = TIMER END IF PortIn$ = Word$: 'Forced Echo IF Echo% OR Code% THEN PortIn$ = "": 'Clear occasional first pass error CALL RecvModem(PortIn$) IF EFlag% THEN CALL ModemError(EFlag%, LogPath$, VErr$) END IF X% = 0 WHILE Code% AND INSTR(PortIn$, "OK") = 0 AND X% < 1000: X% = X% + 1 CALL RecvModem(PortIn$) IF INSTR(PortIn$, "ERROR") THEN GOTO TRAPMODEM WEND IF X% > 999 THEN EFlag% = X% ELSE PortIn$ = Word$: 'Local operating mode END IF IF EFlag% THEN CALL ModemError(EFlag%, LogPath$, VErr$) IF Echo% THEN CALL StripModem: 'Ensure everythings collected and scrap it ON ERROR GOTO 0 EXIT SUB TRAPMODEM: VErr$ = "< Modem error occured! >" IF DeBug% = 1 THEN STOP CALL Flash(SW%, VErr$, 24, Km%, Snd%, 14, 5) ON ERROR GOTO 0 END SUB SUB SendMsg (VP$, MLne%, MCur%, MClr%) STATIC 'Send line to remote and screen and update cursor posit IF Baud% THEN IF Echo% THEN CALL StripModem: PortIn$ = "" CALL ModemPosit(0, MLne%, MCur%, Posit$) IF ClrAct% THEN MColor$ = "" ELSE CALL ModemColor(0, MClr%, MColor$) X# = FRE(VP$): 'Compress strings CALL SendModem(Posit$ + MColor$ + VP$, 0, PortIn$) IF EFlag% THEN VP$ = " ": CALL ModemError(EFlag%, LogPath$, VErr$) CALL PrintANSI(BiosAct%, PortIn$, MClr%): 'Print the line ELSE 'Print screen direct IF ClrAct% THEN CALL ModemPosit(1, MLne%, MCur%, Posit$) 'CALL ModemColor(1, MClr%, MColor$) CALL PrintANSI(BiosAct%, VP$, MClr%): 'Print the line ELSE COLOR C(MClr%), B(MClr%) LOCATE MLne%, MCur%: PRINT VP$; END IF END IF MCur% = MCur% + LEN(VP$) END SUB SUB SetColors (Text$) IF Text$ = "" THEN Text$ = "MONO" SELECT CASE Text$ CASE "EGA": 'Set EGA color defaults C(0) = 7: B(0) = 0: 'System Base Display C(1) = 11: B(1) = 1: 'Menu Displays C(2) = 0: B(2) = 3: 'Prompts and Messages C(3) = 0: B(3) = 2: 'Blocks & Text Entry Zones C(4) = 0: B(4) = 7: 'Text Displays C(5) = 14: B(5) = 4: 'Error messages C(6) = 10: B(6) = 0: 'Screen foot key C(7) = 14: B(7) = 1: 'Highlight text C(8) = 13: B(8) = 1: 'Window Frame C(9) = 0: B(9) = 3: 'Window Text C(10) = 15: B(10) = 1: 'White Highlight C(11) = 2: B(11) = 1: 'Green on Blue C(12) = 12: B(12) = 1: 'Red on Blue CASE "MONO": 'Set monochrome defaults C(0) = 7: B(0) = 0: 'System Base Display C(1) = 7: B(1) = 0: 'Menu Displays C(2) = 0: B(2) = 7: 'Prompts and Messages C(3) = 0: B(3) = 7: 'Blocks & Text Entry Zones C(4) = 15: B(4) = 7: 'Text Displays C(5) = 15: B(5) = 7: 'Error messages C(6) = 15: B(6) = 7: 'Screen foot key C(7) = 15: B(7) = 0: 'Highlights C(8) = 15: B(8) = 7: 'Window Frame C(9) = 0: B(9) = 7: 'Window Text C(10) = 15: B(10) = 0: 'Default base (Fixed) C(11) = 15: B(11) = 0: 'Green on Blue C(12) = 15: B(12) = 0: 'Red on Blue END SELECT END SUB SUB StripModem STATIC 'Ensure Modem buffer is empty DO: PortIn$ = "": CALL RecvModem(PortIn$): 'Strip modem buffer IF PortIn$ > "" THEN CALL Holding(.01) LOOP WHILE PortIn$ > "" END SUB SUB SystemLog (Path$, File$, VLog$) 'Append entries to BBS System Log EFlag% = 0: ON ERROR GOTO TrapNext L% = FREEFILE: IF File$ = "" THEN File$ = "ERROR.LOG" OPEN Path$ + File$ FOR APPEND AS #L% IF EFlag% THEN VErr$ = "< " + Path$ + File$ + " for logging not found! >" ELSE PRINT #L%, DATE$; " "; LEFT$(TIME$, 5); " "; VLog$ END IF CLOSE #L% END SUB --- FMail 0.96 * Origin: BIZynet - Worldwide Business via the E-Ways (1:15/55.1) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3E00051 Date: 03/07/98 From: CHRIS GUNN Time: 04:41pm \/To: JOHN ZORTMAN (Read 3 times) Subj: Re: Fossil Modem Driver Library (3/3) Howdy John, Just in case you haven't already, at the foot are the patches so QuickBasic won't drop the carrier when exiting a Door program. You'll need the DTR Patch but the Fatal Error patch is optional and I don't use it. The error traps built into the subroutines should be sufficient to avoid your code bombing out of them and will provide guidance for your main module code. I've used the QB 4.5 patch successfully for QB 7.0 PDS. Do the patch on both QB*.EXE and the *.LIB you are using. Please do appropriate backups before patching. Chris P.S. As in all my posts here on QUIK_BAS, I retain copyrights but you are free to incorporate and distribute my suggestions and no credits are needed. ======================================================================= Patches to QuickBasic Library for BBS's, Doors, and other COMM programs. DTR Patch Quick Basic 2.01 or 3.0 BCOMx0.LIB Old String: 83 C2 04 32 C0 EE New String: 83 C2 04 B0 01 EE QuickBASIC 4.5 QBX 7.0 BC70xxxx.LIB Old String: B0 00 E3 01 40 83 C2 04 EE New String: B0 01 E3 01 90 83 C2 04 EE Fatal Error Handler Quick Basic 2.01 or 3.0 BCOMx0.LIB Old String: E2 F8 E8 00 00 E8 00 00 E8 00 00 C3 New String: E2 F8 E8 00 00 C3 90 90 E8 00 00 C3 Quick Basic 4.5 QBX 7.0 BC70xxxx.LIB Old String: B8 07 0C CD 21 New String: B8 07 0C 90 90 --- FMail 0.96 * Origin: BIZynet - Worldwide Business via the E-Ways (1:15/55.1) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3E00052 Date: 03/07/98 From: DAVID WILLIAMS Time: 09:53am \/To: FANE (Read 3 times) Subj: Freeware BASIC? -> Also, does anyone remember how to exit GW-BASIC? Use the SYSTEM command. It can either be typed directly from the keyboard, or put into a program to cause an immediate exit to DOS when the program finishes. dow --- PCBoard (R) v15.3 (OS/2) 5 * Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3E00053 Date: 03/08/98 From: DAVID WILLIAMS Time: 10:16am \/To: TED CRAMER (Read 3 times) Subj: Old Folks -> Basic indeed is a powerful and easy to learn language. One can -> accomplish a lot with it. Personally I used it to create various -> programs for my business including: A billing program -> An inventory control program -> A statement creation program -> A mailing list program to print labels Sure. I've used it for those kinds of things, and also for scientific applications, robotic control, text processing, and a bunch of others. Really, there is no limit to the kinds of programs that can be written. Anything that can be written in *any* language can be written in BASIC (and vice versa). -> And then I purchased QB4.5 and I was thrilled that I could now -> compile these programs and run them without first loading GWBASIC. Don't you long for the really old days, when computers came with BASIC built into the hardware?! No need either to compile or to load the interpreter. dow --- PCBoard (R) v15.3 (OS/2) 5 * Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3E00054 Date: 03/08/98 From: DAVID WILLIAMS Time: 10:20am \/To: PAT PRIDGEN (Read 3 times) Subj: Old Folks -> But...I don't anything can properly prepare you for Assembler. It's certainly a different way of thinking. But then so are things like Prolog. People who have never tackled these "extreme" languages often tend to think that programming is all pretty much the same in all languages. It just ain't so! dow --- PCBoard (R) v15.3 (OS/2) 5 * Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3E00055 Date: 03/07/98 From: KEN KOCH Time: 01:35am \/To: MAILER-DAEMON@TOLTBBS.COM (Read 3 times) Subj: FAILED MAIL MM> Subject: Failed mail MM> ===== Unsent message follows ==== MM> Goodmorning; MM> How are things going there? MM> Suppose you heard about the party. Do you suppose He might MM> get the message? Sure hope so. I!m glad I didn!t stay. MM> Bye. Is it a programming until 3am type party? Count me in! ... Power beyond the WILDest of CATS!...Platinum Xpress! --- Platinum Xpress/386/Wildcat! v1.3d * Origin: The PUB : 360-456-1195 (1:352/88) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3E00056 Date: 03/03/98 From: OLE HEJLSKOV Time: 10:14pm \/To: THOMAS MATYSIK (Read 3 times) Subj: 800x600x256.. Hmmm, er det nu dig Thomas, der er p spil igen? Juuuubbbiii, det var om '800x600x256..'! :) TM> I have some routines written entirely in QB by Dave Shea... TM> They are amazingly fast considering they use PEEK and POKE, although you TM> could probably get them about 400 times faster in Assembler. TM> They support 640x480, 800x600, and 1024x768 at 256 colours. TM> If you are interested I can post or email them. You can post it to me at fido: Ole Hejlskov 2:237/45.18 You can also email them to me but then i first get them at next week. :-( >Vi tastes ved< o' \,=./ `o (o o) Med venlig hilsen: ooO--(_)--Ooo Ole Hejlskov .!. All right, who's been cooking hot dogs in the Warp Drive? --- Terminate 4.00/Pro * Origin: The Hejlskov saga continues... (2:237/45.18) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3E00057 Date: 03/08/98 From: BRUCE CORBETT Time: 11:50am \/To: JOHN ZORTMAN (Read 3 times) Subj: BMP files Hi JOHN ZORTMAN, hope you are having a nice day .+'~'+. | Qouted from a message from JOHN ZORTMAN 03-Mar-98| To ALL `+._.+' | About BMP files JZ> Second off, I saw this posted before but I have to ask again: JZ> *Ralf Brown's Interrupt List* JZ> the impression I can FTP or FREQ or whatever this from somewhere? I'm Sorry, I WONT post it as im not going to get caught up in Copyright issues again.... HOWEVER I have a few CD-Roms here with a list of the interupts in it, if its the one you want then you should be able to pick it up from FTP sites like the walnut creek FTP site.... Your sysop should be able to find that... But I would recommend going through any CD-Roms he has allowed you to download off beforehand. .+'~'+. | Bruce Corbett (Hook@Cheerful.com) H O O K | Hk Software (www.members.tripod/~nzhook) `+._.+' | ruce's anter S (3:775/70) ((646) 756-6331 Np, Nz) --- * Origin: Not following the meaning, ruce's anter S (3:775/70) Hi Ted Cramer, hope you are having a nice day .+'~'+. | Qouted from a message from Ted Cramer 04-Mar-98| To Nigel Traves `+._.+' | About BBS Doors TC> have Internet access, let me know your IN address and I'll have a riend TC> send it to you. (I personally have never signed up for the Internet.) Send it to the bgc@Clear.net.nz (my cheerful.com one dosnt support file attachs) .+'~'+. | Bruce Corbett (Hook@Cheerful.com) H O O K | Hk Software (www.members.tripod/~nzhook) `+._.+' | ruce's anter S (3:775/70) ((646) 756-6331 Np, Nz) --- * Origin: Not following the meaning, ruce's anter S (3:775/70) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3E00058 Date: 03/08/98 From: BRUCE CORBETT Time: 12:02pm \/To: TED CRAMER (Read 3 times) Subj: BBS Doors Hi Ted Cramer, hope you are having a nice day .+'~'+. | Qouted from a message from Ted Cramer 04-Mar-98| To Nigel Traves `+._.+' | About BBS Doors TC> have Internet access, let me know your IN address and I'll have a riend TC> send it to you. (I personally have never signed up for the Internet.) Send it to the bgc@Clear.net.nz (my cheerful.com one dosnt support file attachs) .+'~'+. | Bruce Corbett (Hook@Cheerful.com) H O O K | Hk Software (www.members.tripod/~nzhook) `+._.+' | ruce's anter S (3:775/70) ((646) 756-6331 Np, Nz) --- * Origin: Not following the meaning, ruce's anter S (3:775/70)