home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-09-08 | 54.9 KB | 1,501 lines |
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 1
-
-
- BASDLX.LIB
-
- Deluxe Library of functions written in ASSEMBLY language for
- the Microsoft QuickBASIC and IBM BASIC compilers
-
- Basic Deluxe
-
- To use BASDLX you will need, either the IBM Basic compiler or
- the Microsoft QuickBASIC compiler, PC-DOS/MS-DOS version 2.0 or
- later is required for drive functions to work. These functions
- have been tested with the IBM Basic compiler version 2.0 and
- QuickBASIC version 2.01 and have caused no problems. However, I
- am not responsible for any damages caused by but, not limited to,
- the use, misuse, non-use or inability to use BASDLX. These
- function are intended to be used in compiled basic only. Do not
- confuse compiled BASIC with the BASIC interpreter, BASIC.COM or
- BASICA.COM that comes with DOS or GWBASIC. The functions provided
- in this library have been designed to run faster than any cor-
- respondent BASIC code, and often take up less space, leaving you
- with more room to write longer programs!
-
- Distribution
-
- You are free to use the functions provided in the BASDLX library
- in your programs. The copyright is only here to preserve my work
- and to protect you from any unauthorized modifications of BASDLX;
- it is NOT here to protect against the free distribution of
- BASDLX. You may copy and distribute BASDLX to others as long as
- no fee or special consideration is charged and all of the re-
- lated files to BASDLX are included together in the unmodified
- form. If you find use of BASDLX in your programs and find it a
- valuable programming tool then I would appreciate it if you would
- send a contribution ($25 suggested). It would be nice if you
- could acknowledge use of BASDLX functions in your programs or
- documentation that use them. With a minimum contribution of $25 I
- will send you a disk with the source code to BASDLX. Previous
- contributors will need only send $10 to receive an update of
- BASDLX. A contribution of $55 will grant you a one year subscrip-
- tion to BASDLX. With a subscription you will automatically
- receive new updates as soon as they come out (about 10 updates
- per year.) Updates come complete with source & object code,
- BASDLX library, and disk-based documentation.
-
- Using BASDLX with the IBM BASIC Compiler
-
- These functions have been incorporated into a library to make
- them easily accessible by the DOS LINK.EXE program. All you have
- to do is copy BASDLX.LIB to the directory or disk where you keep
- your library files. When you link your programs that use func-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 2
-
- tions from BASDLX, be sure to specify: BASDLX when the linker
- prompts you for a Library [.LIB] file(s). Please refer to your
- DOS manual for more information on the LINK.EXE program.
-
- Using BASDLX with the Microsoft QuickBASIC Compiler
-
- I am now including a user library for use with QuickBASIC
- (BASDLX.EXE.) Please read your QuickBASIC user manual for more
- information on User Libraries.
-
- Note: If you need to get a copy of the object code then, send me
- $5 or, $3 and a Disk and I'll mail you the latest version of
- BASDLX with Object code.
-
- Attention QuickBASIC 3.0 Users
-
- If you need to create a stand alone program using QB with the
- compile to BCOM30 option, do not use the programming environment;
- It has a bug in it! Use the compile from command line option in-
- stead. See page 71 of any QB manual for more information about QB
- compile options.
-
- The Future
-
- I have over 20 new function ideas that I hope to add to BASDLX as
- soon as they are ready. Some are in the alpha testing stage while
- others are still on paper. The primary goal for BASDLX is the
- creation of a library of functions that are not only helpful but
- are one-of-a-kind, Original & Unique. I am always more than will-
- ing to hear from you any suggestions you may have for BASDLX.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 3
-
- Special Notes
-
- The functions provided in this library are available to you by
- using the CALL command from compiled BASIC. All numeric variables
- passed as arguments to the functions must defined as integers.
- This means that you can either globally set all numeric variables
- to integers by issuing the DEFINT A-Z command at the beginning of
- your program or, you can declare a single variable as integer by
- adding a "%" symbol at the end of its name. (i.e. I%, this will
- declare the variable as being integer). I will always add the "%"
- symbol at the end of all my numeric variables in all of my ex-
- amples, to remind you that they MUST be integers.
-
- The variable names used in my examples don't have to be exactly
- the same. you may choose other names that would be more ap-
- propriate. keep in mind that the variable types do have to be the
- same in the argument list (i.e. strings must be strings, integers
- must be integers).
-
- NOTE: You may find in the argument list some arguments that are
- enclosed in []'s. This is used to signify which arguments can be
- safely entered directly instead of needing to set the value in a
- variable. i.e. CALL GUN(10) or CALL GUN(5+5): are perfectly legal
- ways to `call' the GUN function; Either form will "fire" the gun
- 10 times and return. Only some of the variables in BASDLX may be
- entered this way in argument list, This is because BASIC stores
- the values in a temporary variable and upon return from the func-
- tion BASIC destroys them, and BASDLX sometimes returns vital in-
- formation in that variable.
-
- As I mentioned before I have tested these functions and they, to
- the best of my knowledge, work bug free. But, if you happen to
- find any bugs I'll be happy to fix them. Be sure to check that
- you are CALLing the functions properly. That is that you are
- sending the correct arguments to the function. One of the most
- common error that occurs is when the calling program sends to
- the function an incorrect variable type. Remember that numeric
- variables must be declared integer.
-
- Please refer any questions, comments, requests for new functions
- or contributions to the following address:
-
- Gustavo H. Verdun
- 6424 Hollins Drive
- Bethesda, MD 20817
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 4
-
- Function Name: ALLDIRS
- Arguments : (Dir.Array$(),Maxdirs%,Drive$,Ercd%)
- Type : DOS/System
- Purpose : Searches and returns all of the available direc-
- tory paths of the specified drive in an array.
-
- Description :
-
- Dir.Array$(0), This is where the directory names found will be
- saved. Each element in this ONE dimensional array must be set to
- some length. ALLDIRS is not very picky about the minimum length
- but if it ever finds a directory path that will not fit in the
- space provided it will stop and return with an `out of string
- space condition'. DOS limits the maximum length of any directory
- path to 64 characters including the drive specifier (i.e. C:),
- slashes and string terminator (ASCII 0) So, you will never need
- more than a string length of 64 characters per element.
-
- Maxdirs%, tells ALLDIRS the number of elements in Dir.Array$().
- If ALLDIRS finds more directories than space is provided then
- ALLDIRS stops and returns with a `Out of string space condition'.
- Upon return from ALLDIRS, Maxdirs%= the number of directories
- found.
-
- Drive$, Specify drive to search. The first character in this
- string must specify the drive letter all other characters, if
- any, are ignored. (ALLDIRS will NOT convert the drive letter to
- upper case, you may have to do it separately if it is important.)
-
- Ercd%, like all disk functions, errors may occur. If, Ercd%=0
- then everything is o.k. An error code of -1 = Drive selected is
- not valid. -2 = Out of String space.
-
- Example:
- Dim dir.array$(50):for i=0 to 50:dir$(i)=space$(64):next:d$="C:"
- ercd%=0:max%=51:call alldirs(dir.array$(0),max%,d$,ercd%)
- if ercd% then print "Error :";ercd%
- print "Directories found:"
- for i= 0 to max%:print dir$(i):next
-
-
-
-
-
-
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 5
-
- Function Name: ALLDRIVES
- Arguments : (Num_of_drives)
- Type : DOS/System
- Purpose : Returns the total number of logical drives
- (Diskette, Fixed, Ram, Etc.) Available.
-
- Description :
- This function will return a minimum of 2 Drives, since any com-
- puter is assumed to have the logical drives A: & B: Even if there
- is only one physical drive.
-
- Example:
-
- drvs%=0:call alldrives(drvs%)
- print "You have ";drvs%;" drives available."
-
- Function Name: ALLFILES
- Arguments : (search$,[file_attribute%],dir$(),max_elem%,ercd%)
- Type : DOS/System
- Purpose : Scans drive and returns the specified files in a
- string array.
-
- Description :
- search$: This specifies the search pattern. if Search$ = "" then
- the default "*." pattern is used (without the quotes). The search
- pattern may contain a drive letter, path, filename and extension.
- The * and ? wildcards are accepted. The search$ must end with an
- ASCII 0 character.
-
- file_attribute%: This specifies the attribute of the files to be
- searched for. See: "File Attributes" at the end of this documen-
- tation for a detailed explanation.
-
- dir$(): This is the first array element where matched files will
- be stored. Make sure that every element in this one-dimensional
- array is of a minimum length of 12.
-
- max_elem%: When calling the function this number must be set to
- the maximum number of array elements available to ALLFILES. Upon
- return from ALLFILES this variable will contain the number of
- files found.
-
- ercd%: If ercd%=0 then no errors have occurred. (Note: A files
- not found error is only recorded by max_elem%=0)
- -1 Bad DOS Version
- -2 Out of string space (Either the elements in dir$() are
- not set to the minimum string length of 13 or not
- enough elements.)
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 6
-
- Function Name: ALLFILES (Continued)
-
- Example:
-
- Option Base 0
- dim dir$(100)
- .
- for i%=0 to 100:dir$(i%)=space$(13):next
- search$="":attr%=0:files%=101
- call allfiles(search$,attr%,dir$(0),files%,ercd%)
- if ercd% then print "Directory size exceeded program limits":end
- for i%=0 to files%-1:print dir$(i%):next
-
-
- Function Name: BOX
- Arguments : ([width%],[height%],[FRAME$],[color%],[mode%])
- Type : integer array service
- Purpose : Draws a box using the supplied arguments.
-
- Description :
- [width%] & [height%] : All dimensions are internal. This func-
- tion uses the current cursor location as the top right corner
- (frame) of the box.
-
- [FRAME%] See Documentation supplement for a complete description
- of the [FRAME%]
-
- [color%], here, you may specify the color attribute that BOX will
- use. The formula for the color value is as follows:
- color%=(BACKGROUND and 7)*16+FOREGROUND
-
- [mode%] :
-
- 0 No Grow, `Boxes' Flash on screen.
- 1 Grow From Center out.
- 2 Grow From Top Right to Bottom Left
- 3 Grow From Top Left to Bottom Right.
- 4 Grow From Bottom Left to Top Right.
- 5 Grow From Bottom Right to Top Left.
-
- Example:
-
- locate 1,1
- call box (78,23,FRAME$,7,1)
- 'rem this will draw a box around the entire screen.
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 7
-
- Function Name: BSORTN
- Arguments : (Num_of_elements,Integer_array%(start))
- Type : integer array service
- Purpose : Sorts an integer array in ascending order with
- negative numbers appearing at the end in
- ascending order.
-
- Description:
- Integer variables in BASIC can contain numbers between -32,768
- and 32,767. This function does not distinguish between nega-
- tive or positive numbers. It will sort the elements in as-
- cending order with all the negative numbers (if existing)
- appearing after the positive numbers in ascending order.
- Make sure that the array is of type integer. Unpredictable
- results may occur if not!
-
- Example:
- dim a%(300):print "Array Before sort:"
- for i%=0 to 300:a%(i%)=int(rnd(1)*30000):print a%(i%),:next
- enum%=301:call bsortn(enum%,a%(0))
- rem enum%=301 because there are 301 elements in the array (0-300)
- print "Array After sort:":for i%=0 to 300:print a%(i%),:next
- rem the list should be sorted in ascending numerical order!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 8
-
- Function Name: BSORTS
- Arguments : (Num_of_elements%,Array$(start_position))
- Type : String array service
- Purpose : Sorts a string array in ascending alphabetical
- order.
-
- Description:
- The first argument should contain the number of elements to sort
- in the array. The second argument is the array itself. be
- sure to specify the starting position in the array [i.e.
- BSORTS(elements%,a$(0))]
- IMPORTANT: All of the elements in the array MUST have equal
- lengths, if not, unpredictable results will occur to BASIC
-
- Example:
- dim a$(10):a$(0)"First":a$(1)="Second":a$(2)="Third"
- a$(3)="Fourth":a$(4)="Fifth":a$(5)="Sixth":a$(6)="Seventh"
- a$(7)="Eighth":a$(8)="Ninth":a$(9)="Tenth"
- for i%=0 to 9:b$=space$(10):call setl(a$(i%),b$):a$(i%)=b$:next
- rem the above line will make all of the elements in the array
- rem have equal lengths.
- print "Array before sort:":for i%=0 to 9:print a$(i%):next
- enum%=10:call bsorts(enum%,a$(0))
- rem enum%=10 because there are 10 elements in the array (0-9)
- print "Array After sort:":for i%=0 to 9:print a$(i%):next
- rem the list should be sorted in ascending alphabetical order!
-
- Function Name: CASESTR (Name changed to conform with QB 3.00)
- Arguments : (string_var$,[case_val%])
- Type : String service
- Purpose : Converts string to defined case.
-
- Description :
- case_val%, 0 = Convert string to lower case. 1 = Convert string
- to upper case, 2 = Swap case (All upper case characters
- will be converted to lower case and vice-versa.)
-
- Example:
-
- a$="this will be in caps":case%=1:call case(a$,case%)
- print a$
-
-
-
-
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 9
-
- Function Name: CASERANGE
- Arguments : (string_var$,[start%],[length%],[case_val%])
- Type : String service
- Purpose : Converts a portion of a string to defined case.
-
- Description :
- case_val%, 0 = Convert string to lower case. 1 = Convert string
- to upper case, 2 = Swap case (All upper case characters
- will be converted to lower case and vice-versa.)
-
- Example:
- a$="the word `caps' will be in upper case :caps"
- case%=1:call case(a$,40,4,1):print a$
-
- Function Name: CNFGSD
- Arguments : ([overwrite%],[insert%],[frame%],[tab%])
- Type : Configuration for GETSTRD
- Purpose : Change default settings for GETSTRD.
-
- Description :
- [Overwrite%] & [Insert%], (Default is Full & Half size cursor
- respectively) These two arguments contain the cursor shapes that
- indicate if overwrite or insert is active. The formula for the
- values that must be stored in these two arguments is as follows:
- =(START and 31)*256+STOP Where START & STOP are the values for
- cursor start & stop scan lines which must be in the range of 0-
- 31. (See the BASIC LOCATE command for more information on cursor
- shapes.) NOTE: a value of zero for these options leaves their
- current defaults in effect.
-
- [Frame%], (Default ASCII 95) This argument contains the ASCII
- code for the frame character. GETSTRD draws a one line frame of
- the length of String$ to let you see the field size. A value of
- zero for this option leaves its current default in effect.
-
- [Tab%], (Default 1) Number of spaces to insert for a [TAB] key.
- Valid number is in the range of 0-10. A value above 10 leaves the
- current default unchanged.
-
- Example:
- oc%=(0 and 31)*256+7:ic%=(5 and 31)*256+7 'rem this is here to
- 'rem show the values of the default cursors.
- ic%=0:oc%=:frame%=177:tab%=0:call cnfgsd(ic%,oc%,frame%,tab%)
-
- -In this example: Insert & overwrite cursor values are unchanged.
- Frame character is set to ASCII 177. [TAB] key will insert 0
- spaces in string (disables [TAB] key). NOTE: If ASCII 32 (space)
- is not a valid key in GETSTRD then [TAB] does nothing.
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 10
-
- Function Name: DATESTR
- Arguments : (String_space$,Length%,[mode%])
- Type : Date support
- Purpose : Reads the date and writes string_space$ with the
- date in the following format: week-day month day,
- year. (i.e. Thursday, March 12, 1987)
-
- Description :
- The first argument, String_space$, must be of at least 30
- characters of length. If Length% returns with a zero then there
- wasn't enough space in the string variable String_space$. The
- Mode% argument tells the function to either write the full name
- of the week-day and month or just the first three letters of
- each. If Mode%=0, or any number other than one, then the full
- names of the week-day and month will be written. If Mode%=1 then
- only the first three characters of the week-day and month will be
- written. The Length% argument is used to tell BASIC the true and
- final length of String_space$ (This way you easily get rid of the
- trailing characters after the year since, the actual length of
- String_space$ will vary greatly depending on the date.)
- NOTE: String_space$ will never be any longer than 30 characters
- of length.
-
- Example:
- D$=space$(30):l%=0:mode%=0:call datestr(d$,l%,mode%)
- if l%=0 then print "Not enough space in D$!":stop
- d$=left(d$,l%):print "Today is ";d$
- D$=space$(30):l%=0:mode%=1:call datestr(d$,l%,mode%)
- if l%=0 then print "Not enough space in D$!":stop
- d$=left(d$,l%):print "Today is ";d$
-
- Function Name: DLXMOUSE
- Arguments : (buttons%)
- Type : Mouse support
- Purpose : Resets mouse and returns the number of buttons.
-
- Description :
- This function performs three tasks. First, it checks to see if
- the mouse is installed by attempting to reset it. If mouse is not
- available then buttons% = 0 otherwise it will return the number
- of available buttons. Second, depending if mouse is available, it
- sets an internal `switch' used, internally, by BASDLX functions
- to tell if mouse should be supported. Third, if you set buttons%
- = -1 before calling the function it will automatically `lock-out'
- the use of the mouse by any function in BASDLX. (one may override
- a forced lock-out or force a mouse reset from the keyboard by
- pressing the [Ctrl]-[Backspace] keys together while inside of a
- BASDLX function that supports a mouse.
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 11
-
- Function Name: DLXMOUSE (Continued)
-
- Currently, only GETSTRD supports the use of a mouse, but there
- will be several other functions, soon to be released, that will
- also support a mouse.
-
- Example:
- call dlxmouse(b%)
- print "You have ";b%;"mouse buttons available."
-
-
- Function Name: GETSTRD
- Arguments : (string$,length%,validkeys$,[color%],mode%)
- Type : String/Data entry enhancement
- Purpose : This function accepts input from the keyboard and
- stores it in the String$ argument allowing the
- use of standard editing commands.
-
- Description :
- String$, This is the space where the input data will be stored.
- The field size of the input data will be set to the length of
- this string. If there is already some data in the string it will
- not be erased. Just be sure to set the length to the proper value
- to let GETSTRD know that there is already data in the String$
- variable that is ready to be edited. Due to the limitations that
- BASIC imposes on assembly language with variables, the String$
- variable must be filled in to the maximum size of the field.
-
- Length%, If you have a string length that is shorter than the
- field size that you have allocated for the data, GETSTRD will be
- able to know and upon return tell you the actual length of the
- string. This makes it easy to remove the trailing spaces in the
- String$ if they are not important. A Length% of zero tells
- GETSTRD that it is a `fresh' data field containing no previous
- input.
-
- Validkeys$, This is the new option added to GETSTRD. If this
- string is set to null (i.e. length of 0) then GETSTRD will accept
- all keys from ASCII 32-126, otherwise GETSTRD will accept only
- the keys defined in this string. (Control keys, except ^M
- [Return], ^[ [Escape], ^H [Backspace], & ^I [Tab], are always
- discarded.)
-
- [Color%], here, you may specify the color attribute that GETSTRD
- will use. The formula for the color value is as follows:
- Color%=(BACKGROUND and 7)*16+FOREGROUND
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 12
-
- Function Name: GETSTRD (Continued)
-
-
- Mode%, GETSTRD currently supports two modes of operation. If
- Mode%=0 GETSTRD will operate normally without exiting unless
- [ESC] or [RETURN] is pressed. If Mode%=1 GETSTRD will operate
- normally except that if it reads from the keyboard an extended
- scan code that is not one of it's editing commands it will exit
- the function and return with the extended scan code to that key
- in Mode%. This feature makes it easy to write programs that allow
- the user to scroll through other data fields without changing or
- having to re-enter data. If upon exit from the GETSTRD function
- Mode%=-1 then the [ESC] key was pressed and your program should
- do whatever the [ESC] key means. If [ESC] means nothing to your
-
- program then just go back to the line that CALLs GETSTRD and con-
- tinue.
-
- The following Editing keys are supported:
- [LEFT-ARROW] Move cursor one space left.
- [RIGHT-ARROW] Move cursor one space right.
- [HOME] Move cursor to beginning of line.
- [END] Move cursor to the end of line.
- (NOTE: The end of the line is determined by the current length
- of the input data and not the maximum length of the data field.)
- [CTRL]-[RIGHT-ARROW] Move cursor one word right.
- [CTRL]-[LEFT-ARROW] Move cursor one word left.
- [CTRL]-[HOME] Erase entire input field.
- [CTRL]-[END] Erase from cursor position to the end of
- the line.
- [CTRL]-[BACKSPACE] Forces a mouse reset.
- (SEE FUNCTION: DLXMOUSE
- SEE ALSO MOUSE NOTES at the end off
- this documentation.)
- [INS] Set/Clear Insert mode.
- [DEL] Deletes character at cursor position.
- [BACKSPACE] Deletes character to the left of cursor.
- [TAB] Inserts x spaces. (See function CNFGSD)
-
- GETSTRD now supports the mouse as a pointing device. Press the
- left most mouse button and you will see a `second' cursor appear.
- You can, while pressing the left-most button, move the mouse left
- or right. Once you are over the character where you wish to move
- to, release the button and you will see the cursor in that new
- location. If you wish to cancel the mouse movement then move the
- mouse to the end of the line and release the button (This will
- cancel the mouse movement only if the input field is not full,
- otherwise it will move the cursor to the end of the field.)
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 13
-
- Function Name: GETSTRD (Continue)
-
- Example :
- 10 rem This example is for mode 0.
- 12 mode%=0
- 14 c%=31:A$="":valkey$="0123456789()-" ' Valid keys for phone #.
- 18 l%=len(A$):b$=space$(15):call setl(a$,b$):a$=b$ 'rem add field
- 20 print "Enter Phone #";
- 22 call getstrd(a$,l%,valkey$,c%,mode%)
- 24 a$=left$(a$,l%):if mode%=-1 then 18
- .
-
- 10 rem this example is for mode 1.
- 12 mode%=1:c%=31:A$=""
- 18 l%=len(A$):b$=space$(25):call setl(a$,b$):a$=b$:rem add field
- 20 locate 10,5:print "Enter Name : ";:valkey$=""
- 22 call getstrd(a$,l%,valkey$,c%,mode%)
- 24 a$=left$(a$,l%):if mode%=-1 then 36
- 26 l%=len(C$):b$=space$(15):call setl(C$,b$):C$=b$:rem add field
- 28 locate 11,5:print "Enter Phone # ";:valkey$="01234567890()-"
- 30 call getstrd(c$,l%,valkey$,c%,mode%)
- 32 a$=left$(c$,l%):if mode%=-1 then 36
- 34 if mode%=72 or mode%=80 then 18
- 36 print "Data A: ";a$:print "Data B: ";c$:end
-
-
-
- Function Name: GRID
- Arguments : (X%(strt%),Y%(strt2%),[FRAME$],[Color%],[Mode%])
- Type : Video
- Purpose : Draws the specified grid on the screen.
-
- Description :
- x%(start), This array specifies the "widths" of the X
- (Horizontal) range of the grid. The first element (strt) in this
- array contains the cell width of the left most column. All
- `cells' in a column will have the same "width". The last element
- in the array must be a -1.
-
- y%(start), This array specifies the "heights" of the Y (Vertical)
- range of the grid. The first element in this array contains the
- "cell height" of the first row, the second contains the next
- height of the second row. All the `cells' in a row will have the
- same cell height. The last element (strt2) in this array must be
- a -1.
-
- Note: A Cell height or width of 0 (zero) is valid. Cell heights
- and widths are internal dimensions.
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 14
-
- Function Name: GRID (Continued)
-
-
- [FRAME$] This is the string that specifies the frame characters
- for the grid. Please SEE the documentation supplement file for a
- complete description of the [FRAME$] argument.
- [mode%], This argument specifies the grow mode to use. Grow modes
- are as follows:
-
- 0 No grow
- 1 Grow from the center of the grid.
- 2 Grow from the top right corner.
- 3 Grow from the top left corner.
- 4 Grow from the bottom left corner.
- 5 Grow from the bottom right corner.
-
- [color%], here, you may specify the color attribute that GRID
- will use. The formula for the color value is as follows:
- color%=(BACKGROUND and 7)*16+FOREGROUND
-
- The grid's top left corner will be at the current location of the
- cursor. Use the LOCATE command to set the location of the grid.
-
- Example:
-
- option base 1 'rem the option base of 1 is not necessary you
- 'rem may use option base 0 if you like but, remember to adjust
- 'the starting of the array. (strt)
- dim x%(4),y%(5)
- .
- .
- x%(1)=20:x%(2)=20:x%(3)=20:x%(4)=-1 ' Last element MUST be a -1
- y%(0)=1:y%(2)=1:y%(3)=1:y%(4)=0:y%(5)=-1
- attr%=7:mode%=1:f$=FRAME$
- 'Please SEE the documentation supplement a complete description
- 'of the FRAME$ argument.
- call grid(x%(1),y%(1),f$,attr$,mode%)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 15
-
- Function Name: GUN
- Arguments : ([Num_of_shots%])
- Type : Speaker support
- Purpose : Simulates the sound of a gun or machine gun
-
- Description :
- This function generates the sound by sending spurts of white
- noise to the speaker. This will create the sound of a quick ex-
- plosion. the only parameter needed is the number of shots to
- fire.
-
- Example:
- input "Number of shots to fire :",shots%:if shots%=0 then end
-
- call gun(shots%)
-
- Function Name: JRCLICK
- Arguments : ([value%])
- Type : PCjr.
- Purpose : Activates/deactivates the keyboard click on the
- PCjr.
-
- Description :
- value%, if 0 it turns the keyboard click off. Any other value
- will activate the keyboard click. This works only on the PCjr.
-
- Example :
- call jrclick(0) 'rem deactivate the keyboard click
- val%=1:call jrclick(val%) 'rem activate the keyboard click
-
- Function Name: MACHINE
- Arguments : (value%)
- Type : IBM machine type
- Purpose : Reads memory and returns machine code.
-
- Description :
- value%, upon return the value% will contain a code number. Use
- the following table to determine the machine type:
-
- Code Machine
- ---- -------
- 255 PC
- 254 PC-XT or Portable PC
- 253 PCjr
- 252 PC AT
-
- Note: The identification number of PC compatibles will most
- likely differ from these numbers. Some early XTs have a machine
- code of 255.
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 16
-
- Function Name: MACHINE (Continued)
-
- Example:
- call machine(code%):print "Identification code :";code%
-
- Function Name: READP
- Arguments : (Port_num%)
- Type : Printer support
- Purpose : Reads the printer status of the specified port
- number (1-3) and returns with the status byte
- for that port in the Port_num% variable.
-
- Description:
- The status byte of contains the following information:
-
- bit: 7 6 5 4 3 2-1 0
- | | | | | | |_Time out
- | | | | | |_Unused
- | | | | |_1 = I/O Error
- | | | |_1 = Selected
- | | |_1 = Out of Paper
- | |_1 = Acknowledge
- |_1 = Not Busy
-
- IMPORTANT: This function does not check for a valid port number.
- Be sure that the port number is in the range of 1-3
-
- Example:
- port%=1:call readp(port%):print port%
- if port% and 32=32 then print "Printer is out of paper"
- if port% and 128=0 then print "Printer is Off-line"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 17
-
- Function Name: RESETP
- Arguments : (Port_num%)
- Type : Printer support
- Purpose : Resets the specified printer port number (1-3)
- and returns with its status byte (see the READP
- function description for information on the
- printer status byte)
-
- Description:
- This function sends a reset status through the parallel inter-
- face of the specified port number. This function does check the
- parameters to be sure that they are in the range of 1 to 3. If
- the Port_num% argument is equal to -1 upon return then the port
- number is not valid.
-
- Example:
- port%=1:call resetp(port%):print port%
- if port%=-1 then print"Port number must be in the range of 1-3"
- if port% and 32=32 then print "Printer is out of paper"
- if port% and 128=0 then print "Printer is Off-line"
-
-
-
- Function Name: SETL
- Arguments : (Source_string$,Destination_string$)
- Type : String manipulation
- Purpose : This function will place the source string inside
- of the destination left-justified. If the source
- string is longer than the destination string then
- the right portion of the string will be truncated.
-
- Description :
- This function automatically clears the destination string to
- spaces (ASCII 32) even if the source string is of length zero. Be
- sure to save the destination string into the source string after
- the call.
-
- Example:
- a$="Enter Name":b$=space(20):call setl(a$,b$):a$=b$
- rem the last command "a$=b$" saves the destination string in the
- rem source string since the function cant' change the length of
- rem any string.
- print ">";a$";"<":REM this will show you the new length of a$
-
-
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 18
-
- Function Name: SETR
- Arguments : (Source_string$,Destination_string$)
- Type : String manipulation
- Purpose : This function will place the source string inside
- the destination string right justified. If the
- destination string is shorter than the source
- string then the right portion of the string will
- be truncated.
-
- Description :
- This function automatically sets the destination string to all
- spaces (ASCII 32) even if the source string is of length zero. Be
- sure to save the destination string into the source string after
- the call.
-
- Example:
- a$="Enter Name":b$=space(20):call setr(a$,b$):a$=b$
- rem the last command "a$=b$" saves the destination string in the
- rem source string since the function cant' change the length of
- rem any string.
- print ">";a$;"<":REM this will show you the new length of a$
-
- Function Name: SNDOFF
- Arguments : NONE
- Type : Speaker support
- Purpose : Turns speaker off. If this function is used then
- the BASIC SOUND or BEEP commands will not work.
-
- Description :
- This function can be useful for those programs that use sound
- prompts to get attention when input is required. With this func-
- tion you can easily add the feature to your programs that will
- let the user decide if he wants to have the sound prompts on or
- off. If he wants the off then at the beginning of your program
- just call this function. Any sound statements following this com-
- mand will execute without producing a single sound. Be sure not
- to forget to turn them on before the program finishes (SNDON).
-
-
- Example :
- sound 200,1:sound 300,1:sound 400,1:call sndoff
- sound 200,1:sound 300,1:sound 400,1
-
-
-
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 19
-
- Function Name: SNDON
- Arguments : NONE
- Type : Speaker support
- Purpose : Turns sound on so that the BASIC SOUND and BEEP
- commands work.
-
- Description:
- This function can help solve the problem that occurs when you use
- some memory resident programs that use the speaker and when they
- are done the turn it off so that any SOUND or BEEP commands won't
- produce an audible signal. It can also turn on the sound when it
- was turned off by the function SNDOFF!
-
- Example:
- sound 200,1:sound 300,1:sound 400,1:call sndoff
- sound 200,1:sound 300,1:sound 400,1:call sndon
- sound 200,1:sound 300,1:sound 400,1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 20
-
- Function Name: SPELLNUMBER
- Arguments : ([num%],string_space$,length%,[type%])
- Type : String Service
- Purpose : Will convert the number in num% to written
- english using, ordinal or cardinal form.
-
- Description :
- num%, any number you wish to convert to written form.
-
- string_space$, Here is where the spelled-out form of the number
- will be stored. Since the length of this string depends on how
- large the number, use your own discretion as too how long to set
- it. I suggest a length of 40 characters.
-
- length%, Upon return from the function the length of the string
- will be returned in this variable.
-
- type%, if type = 0 then the cardinal spelling will be used for
- the number. Cardinal numbers are : one,two,three. . . Any other
- value will return the ordinal spelling. Ordinal numbers are :
- first,second,third. . .
-
- Example:
- n%=12:n$=space$(4):t%=0:call spellnumber(n%,n$,l%,t%) ' cardinal
- n$=left$(n$,l%):print "You have ";n$;" files available."
- .
- n%=val(mid$(date$,4,2)):n$=space$(40):t%=1
- call spellnumber(n%,n$,l%,t%):n$=left$(n$,l%) ' ordinal
- print "This is the ";n$;" day of the month."
-
- Function Name: TIMESTR
- Arguments : (String_space$)
- Type : Time support
- Purpose : Reads clock and loads String_space$ with the time
- in decimal ASCII. The format is as follows:
- HH:MM:SS.HD
- Where, HH are hours,MM are minutes, SS are seconds
- and, HD are Hundredths of a second.
-
- Description :
- String_space$ must be of at least 11 characters of length for
- this function to work successfully. If it is not of the proper
- minimum length then the function will do nothing and return with
- the String_space$ unmodified.
-
- Example:
- t$=space$(11):call timestr(t$):print t$
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 21
-
- Summary of functions
-
- Please use this as a quick summary to BASDLX functions. This sum-
- mary should only be used once you understand the functions, but
- just need a quick refreshment.
-
- Function Name: ALLDIRS
- Arguments : (Dir.Array$(),Maxdirs%,Drive$,Ercd%)
- Type : DOS/System
- Purpose : Searches and returns all of the directories in
- Drive$.
-
- Function Name: ALLDRIVES
- Arguments : (Num_of_drives)
- Type : DOS/System
- Purpose : Returns the total number of logical drives
- (Diskette, Fixed, Ram, Etc.) Available.
-
- Function Name: ALLFILES
- Arguments : (search$,[file_attribute%],dir$(),max_elem%,ercd%)
- Type : DOS/System
- Purpose : Scans drive and returns the specified files in a
- string array.
-
- Function Name: BOX
- Arguments : (width%,height%,[FRAME$],[color%],[mode%])
- Type : Video
- Purpose : Draws a box using the supplied arguments.
-
- Function Name: BSORTN
- Arguments : (Num_of_elements,Integer_array%(start))
- type : integer variable service
- Purpose : Sorts an integer array in ascending order with
- negative numbers appearing at the end in ascend-
- ing order.
-
- Function Name: BSORTS
- Arguments : (Num_of_elements%,Array$(start_position))
- Type : String service
- Purpose : Sorts a string array in ascending alphabetical
- order.
-
- Function Name: CASE
- Arguments : (string_var$,[case_val%])
- Type : String service
- Purpose : Converts string to specified case.
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 22
-
- Summary of functions (Cont.)
-
- Function Name: CASERANGE
- Arguments : (string_var%,[start%],[length%],[case_val%])
- Type : String service
- Purpose : Converts a portion of a string to specified case.
-
- Function Name: CNFGSD
- Arguments : ([overwrite%],[insert%],[frame%],[tab%])
- Type : Configuration for GETSTRD
- Purpose : Change default settings for GETSTRD.
-
- Function Name: DATESTR
- Arguments : (String_space$,Length%,mode%)
- Type : Date support
- Purpose : Reads the date and writes string_space$ with the
- date in the following format: week-day month day,
- year. (i.e. Thursday, March 12, 1987)
-
- Function Name: DLXMOUSE
- Arguments : (buttons%)
- Type : Mouse Support
- Purpose : Resets the mouse and returns the number of but-
- tons.
-
- Function Name: GETSTRD (Improved in this Version)
- Arguments : (String$,length%,Validkeys$,[color%],mode%)
- Type : String/Data entry enhancement
- Purpose : This function accepts input from the keyboard and
- stores it in the String$ argument allowing the
- use of standard editing commands.
-
- Function Name: GRID
- Arguments : (x%(strt%),y%(strt2%),[FRAME$],[color%],[mode%])
- Type : Video
- Purpose : Draws the specified grid on the screen.
-
- Function Name: GUN
- Arguments : (Num_of_shots%)
- Type : Speaker support
- Purpose : Simulates the sound of a gun or machine gun
-
- Function Name: JRCLICK
- Arguments : ([value%])
- Type : PCjr.
- Purpose : Activates or deactivates the keyboard click on the
- PCjr.
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 23
-
- Summary of functions (Cont.)
-
- Function Name: MACHINE
- Arguments : (value%)
- Type : IBM machine type
- Purpose : Reads memory and returns machine code.
-
- Function Name: READP
- Arguments : (Port_num%)
- Type : Printer support
- Purpose : Reads the printer status of the specified port
- number (1-3) and returns with the status byte for
- that port in the port_num% variable.
-
- Function Name: RESETP
- Arguments : (Port_num%)
- Type : Printer support
- Purpose : Resets the specified printer port number (1-3)
- and returns with its status byte (see the READP
- function description for information on the
- printer status byte)
-
- Function Name: SETL
- Arguments : (Source_string$,Destination_string$)
- Type : String manipulation
- Purpose : This function will place the source string inside
- of the destination left-justified. If the source
- string is longer than the destination string then
- the right portion of the string will be truncated.
-
- Function Name: SETR
- Arguments : (Source_string$,Destination_string$)
- Type : String manipulation
- Purpose : This function will place the source string inside
- the destination string right justified. If the
- destination string is shorter than the source
- string then the right portion of the string will
- be truncated.
-
- Function Name: SNDOFF
- Arguments : NONE
- Type : Speaker support
- Purpose : Turns speaker off. If this function is used then
- the BASIC SOUND or BEEP commands will not work.
-
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 24
-
- Summary of functions (Cont.)
-
- Function Name: SNDON
- Arguments : NONE
- Type : Speaker support
- Purpose : Turns sound on so that the BASIC SOUND and BEEP
- commands work.
-
- Function Name: SPELLNUMBER
- Arguments : ([num%],string_space$,length%,[type%])
- Type : String Service
- Purpose : Will convert the number in num% to written english
- using, ordinal or cardinal form.
-
- Function Name: TIMESTR
- Arguments : (String_space$)
- Type : Time support
- Purpose : Reads clock and loads String_space$ with the time
- in decimal ASCII. The format is as follows:
- HH:MM:SS.HD
- Where, HH are hours,MM are minutes, SS are seconds
- and, HD are Hundredths of a second.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-
-
-
-
-
-
- BASDLX (C) Copyright 1986,1987 By Gustavo H. Verdun Page 25
-
- File Attributes
-
- The following is a table containing the attribute for each type
- of file:
-
- Attribute Type Description
- --------- ---- ----------------------------------------
- 0 Normal Most files have this code.
- 1 Read Only This file may be read from but,
- NOT written to. (Write protects just
- the file.)
- 2 Hidden This type of file is hidden from
- the normal DIR (DOS) or FILES (BASIC)
- command.
- 4 System Indicates it is a SYSTEM File.
-
- Note: It is valid for a file to contain more than one of the
- above attributes. i.e. a file may be Hidden and Read Only thus
- having an attribute of (2 (hidden) + 1 (Read Only)) = 3.
-
-
- MOUSE NOTES
-
- GETSTRD is the only function that supports the use of the mouse
- as a pointing device. Yet, I am working on several functions,
- that are soon to be released, that will also support the mouse.
-
- Every time the mouse is reset, through a software command, there
- is about a second and a half or more, depending on the speed of
- your machine, of a delay. This unfavorable delay will cause
- several functions of BASDLX to slow down a program especially if
- several calls to a function are made. This delay only happens
- every time a mouse reset is performed. It is only necessary to
- reset the mouse once in a program. So, I added the Function :
- DLXMOUSE to let BASDLX functions know that a mouse is installed
- or not with-out having to the time consuming `software reset' on
- the mouse every time the function is called. This method should
- work well with the following exception: The mouse register that
- keeps tab on the cursor (on/off) is a decrement/increment
- register. This means that if you execute the command to turn the
- cursor off two times in a row, you will need to execute the com-
- mand to turn the cursor on, two times again before you see the
- `mouse cursor' on the screen. the functions in BASDLX (that ac-
- cept the mouse) require that the mouse cursor be off upon entry
- and that just one command to turn the cursor on be necessary to
- show the `mouse cursor'. BASDLX will have a full set of mouse
- functions in a future release.
-
-
-
-
- --- BASDLX Version 1.6 September 1987 ---
-