BBS: Inland Empire Archive Date: 06-15-92 (07:18) Number: 560 From: QUINN TYLER JACKSON Refer#: NONE To: ALL Recvd: NO Subj: Dynamic Library Conf: (2) Quik_Bas
Hello. Enough people have responded to my library request, so I have started writing it with full documentation in the source. Here is a sample to get you started.... Quinn ## ___CUT HERE--- DECLARE SUB DosPrint (Text AS STRING) DECLARE FUNCTION DosVersion! () DECLARE FUNCTION DesqView% () '$INCLUDE: 'QB.BI' DEFINT A-Z ' Set up the IN and OUT registers DIM SHARED InRegs AS RegTypeX DIM SHARED OutRegs AS RegTypeX ' Declare constants CONST TRUE = -1 CONST FALSE = NOT TRUE CLS DosPrint "Quinn\nTyler\nJackson\n" '*****************************BiosScroll********************************* '* This BIOS call scrolls a portion of the screen. * '* If mode is equal to -1, it scrolls up, otherwise, it scrolls down. * '* The color attribute of the area left by the scroll is put into BX. * '************************************************************************ SUB BiosScroll (mode, UpLeftRow, UpLeftCol, LowRightRow, LowRightCol) IF mode THEN service = &H7 ELSE service = &H6 InRegs.ax = 256 * service + 1 InRegs.cx = 256 * UpLeftRow + UpLeftCol InRegs.dx = 256 * LowRightRow + LowRightCol InRegs.bx = 7 CALL INTERRUPTX(&H10, InRegs, OutRegs) END SUB '******************************DesqView********************************* '* This function returns TRUE if the program is running under the * '* DESQview environment, otherwise it returns FALSE. * '*********************************************************************** FUNCTION DesqView InRegs.ax = &H2B01 InRegs.cx = &H4445 InRegs.dx = &H5351 CALL INTERRUPTX(&H21, InRegs, OutRegs) IF OutRegs.ax MOD 256 <> &HFF THEN inDV = TRUE ELSE inDV = FALSE END IF DesqView = inDV END FUNCTION '********************************DosPrint******************************* '* This SUB prints a string to the screen using a DOS service call, * '* which might be desirable under certain environments such as * '* DESQview. Note that the string printed must NOT contain a dollar * '* sign, or the whole string will not be processed by the call. * '* Strings containing the sequence "\n" will be processed with a * '* carrage return/line feed sequence. * '*********************************************************************** SUB DosPrint (Text AS STRING) ' Preprocess string for any imbedded "\n" macros IF INSTR(Text, "\n") = 0 THEN GOTO BiosPrint2: ' jump if no "\n" BiosPrint1: Ptr = INSTR(Text, "\n") ' locate "\n" MID$(Text$, Ptr, 2) = CHR$(13) + CHR$(10) ' replace with CRLF IF INSTR(Text, "\n") THEN GOTO BiosPrint1: ' process next "\n" BiosPrint2: Text = Text + "$" ' Terminate with the end of string flag InRegs.ds = VARSEG(Text) ' Load DS:DX with InRegs.dx = SADD(Text) ' address of Text InRegs.ax = &H900 CALL INTERRUPTX(&H21, InRegs, InRegs) END SUB FUNCTION DosVersion! InRegs.ax = &H3000 CALL INTERRUPTX(&H21, InRegs, OutRegs) MajorVersion = OutRegs.ax MOD 256 MinorVersion = OutRegs.ax \ 256 DosVersion! = MajorVersion + MinorVersion / 10 END FUNCTION * SLMR 2.1a * In a world of idiots, may you be cursed with wisdom. --- Maximus/2 2.01wb * Origin: The Nibble's Roost, Richmond BC Canada 604-244-8009 (1:153/918)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET