February 23, 1988 Lawrence Davis BAS-REL.LBR is a collection of assembly language sub-routines that may be called by a compiled MBASIC program (CP/M only). Although some of these functions can be duplicated by BASIC code it is much slower. It is encouraged that those that use assembly language sub-routines make them available to the CP/M community. Such sub-routine libraries are available to the MS/DOS community and many are either shareware or commercial. Those that work with compiled MBASIC (BASCOM) in the CP/M world are far fewer in number and it would not be a practical venture to market such a collection. Therefore, I again appeal to those few programmers that use assembly language sub-routines in their BASCOM programs to make them available to the CP/M community at large. Submissions should be made to the Glendale Litera QBBS-RCP/M at 818/956-6164 (HST-9600 - 24 hours). Sub-routines should in Microsoft REL format so they can linked into the BASIC program with L80 or LD80. Note the following format for desribing the usage of the each REL file. Where examples are necessary a short program or a few coded lines will suffice to explain. Submissions will be verified and placed in BAS-REL.LBR. A BAS-REL.UPD file will note new additions to the library. ------------------------------ Assembly Language Sub-Routines ------------------------------ Sub-Routine Name: UCASE File : UCASE.REL Purpose : Convert a string to upper case Syntax : CALL UCASE (A$) - Returns A$ in upper case Example : INPUT "Enter your first name: ",A$ : CALL UCASE (A$) Explanation : Convert name (A$) to upper case ------------------------------------------------------------------ Sub-Routine Name: LCASE File : LCASE.REL Purpose : Convert a string to lower case Syntax : CALL LCASE (A$) - Returns A$ in lower case Example : INPUT "Enter your first name: " , A$ : A1$ = LEFT$ (A$ , 1) : CALL UCASE (A1$) : A2$ = MID$ (A$ , 2): CALL LCASE (A2$) : NAME$ = A1$ + A2$ Explanation : Convert name to normal upper/lower case mix ------------------------------------------------------------------ Sub-Routine Name: CTAIL File : CTAIL.REL Purpose : Read the CP/M command line Syntax : CALL CTAIL (A$) - Returns command line in A$ Example : CALL CTAIL (CMD$) : IF CMD$ = "" THEN INPUT "ENTER YOUR COMMAND" , CMD$ Explanation : Check for command line arguments from CP/M command line ------------------------------------------------------------------ Sub-Routine Name: RRUN File : RRUN.REL Purpose : To re-run the BASCOM program Syntax : CALL RRUN Explanation : Executes a JMP 100H (more efficient than BASIC run command) ------------------------------------------------------------------ Sub-Routine Name: BDOS File : BDOS.REL Purpose : To make a CP/M BDOS call Syntax : CALL BDOS (CMD , DAT, RES ) - Integers only : CMD = Function number in C reg : DAT = Data in E or DE reg : RES = Returned value in A reg Example : CMD = 32 : DAT = 15 : RES = 0 : CALL BDOS (CMD, DAT, RES) Explanation : Set user area to 15 ----------------------------------------------------------------- Sub-Routine Name: BDOSHL File : BDOS.REL Purpose : To make a CP/M BDOS call Syntax : CALL BDOSHL (CMD , DAT, RES ) - Integers only : CMD = Function number in C reg : DAT = Not used (set to zero) : RES = Returned value in HL regs Example : CMD = 12 : DAT = 0 : RES = 0 : CALL BDOS (CMD, DAT, RES) : VERS = RES Explanation : Get CP/M version number in variable VERS ------------------------------------------------------------------ Note: Both the BDOS and BDOSHL calls can be used with the BYE5 or NUBYE programs to access their extended BDOS calls. CMD = 32 : DAT = 241 : RES = 0 CALL BDOS (CMD, DAT , RES) IF RES <> 77 THEN PRINT "BYE not active" Above call checks to see if BYE is present CMD = 79 : DAT = 0 : RES = 0 CALL BDOSHL (CMD, DAT, RES) : RTC = RES Address of RTC buffer in RTC variable ----------------------------------------------------------------- Sub-Routine Name: SETDMA File : DIR.REL Purpose : Set DMA buffer for subsequent file operations Syntax : CALL SETDMA (ARRAY(0)) Example : DIM ARRAY(64) : CALL SETDMA (ARRAY(0)) Explanation : Define 128 byte array for DMA buffer : Set DMA to starting address of array : See RDIR.BAS ------------------------------------------------------------------ Sub-Routine Name: GET1ST File : DIR.REL Purpose : Scans directory for a match to file named in the FCB Syntax : CALL GET1ST (FCB(0),FLG) Example : DIM FCB (20) : FLG = 0 : CALL GET1ST (FCB(0),FLG) Explanation : Passes address of FCB array : Directory code returned in FLG variable : See RDIR.BAS ------------------------------------------------------------------ Sub-Routine Name: GETNXT File : DIR.REL Purpose : Continues to scan directory for a match to file named in : the FCB Syntax : CALL GETNXT (FCB(0),FLG) Explanation : See RDIR.BAS ------------------------------------------------------------------