EMXSUBS v3.15 These are the subroutines used by the EMX mail system of programs... these routines are copyrighted (c)1984 by Simon J. Ewins and may not be used in any way by any person in any program for commercial gain without prior written approval from the author. (416) 484-9663 (data line) ------------------------------------------------------------------------ Print version/revision number in HL (L=version, H=revision) At the start of key EMX files there are two bytes that hold the version and revision numbers for that file. Loading these two bytes into HL will print the version (L) then the revision (H). PVER:: ------------------------------------------------------------------------ On entry HL=record number and (RRSZ) already set to record length These routines read/write random records to the disk as commented PUT:: ; Write record # in HL to file at FCB of length in (RRSZ) PUT2:: ; As above but FCB2 GET:: ; Read as PUT writes above GET2:: ; Read as PUT2 above writes ------------------------------------------------------------------------ Multiply HL * DE product in DE,HL -- HL=multiplicand, DE=multiplier MLDL:: ------------------------------------------------------------------------ Subtract HL-DE -- HL=subtrahend, DE=subtractor (carry flag ignored) SUBHL:: ------------------------------------------------------------------------ Shift DE,HL right one bit ( DE,HL/2 ) SDLR:: ------------------------------------------------------------------------ move 'C' bytes from HL to DE MOVE:: ------------------------------------------------------------------------ Fill HL register pair with the contents of (DE) FILLHL:: ------------------------------------------------------------------------ String match --> HL=STRING1, DE=STRING2, B=length to search on exit if A=0, strings are equal. MATCH:: ------------------------------------------------------------------------ Get input string from user maximum length in 'B', if C=20h, then force upper case, C=0 no upper case if D=0 then no word wrap, D=1 then wrap on space after 50th character if A=0 then echo input characters, A=1 no echo Exit= A=length entered, HL->buffer INPUT:: ------------------------------------------------------------------------ echo character in a to console ECHO:: ------------------------------------------------------------------------ Gets a character from console, if no character there, then Z set else NZ GETCH:: ------------------------------------------------------------------------ Capitalize character in 'A' if possible CAPS:: ------------------------------------------------------------------------ Convert time at label time:: from ASCII (hh:mm:ss) to binary at BTIME:: (hms) CTIME:: ------------------------------------------------------------------------ Convert date at label date:: from ASCII (mm/dd/yy) to binary at BDATE:: (mdy) CDATE:: ------------------------------------------------------------------------ Convert up to 5 ASCII digits (0-9) to binary number in HL by storing a value of 1-5 at CNVRT0+1 before calling CNVRT0 you can convert that num- ber of characters.... a call to CTIME:: or CDATE:: will set this value to 2. On entry, IX points to digit string to convert. CNVRT0:: ------------------------------------------------------------------------ Routines to print binary date or time with / or : seperators on entry IX points to the 3 binary bytes PTIME:: PDATE:: ------------------------------------------------------------------------ Calculates difference between two dates (ignores leap years) date 1 = three bytes pointed to by IX date 2 = three bytes pointed to by IY (IY should be the later of the two) difference in days returned in HL DATDIF:: ------------------------------------------------------------------------ Prints binary number in HL as decimal number with no leading spaces but does print a '0' if the HL register pair contains 0 PB2ASC:: ------------------------------------------------------------------------ Print inline message (null terminated) PRINT:: ------------------------------------------------------------------------ Print message pointed to by HL (up to first null) PRINTM:: ------------------------------------------------------------------------ Print message pointed to by HL until either a null encountered or char- acters printed equals length passed in 'B'. PRINTL:: ------------------------------------------------------------------------ Print message pointed to by HL until first space found or a null PRINTS:: ------------------------------------------------------------------------ Open file whose name pointed to by HL register - ends up in FCB OPEN:: ------------------------------------------------------------------------ Open second file file in second FCB (erases old file first, if any) uses FCB2:: OPEN2:: ------------------------------------------------------------------------ Special open file whose name pointed to by HL register and create it if it isn't found...... uses FCB:: COPEN:: ------------------------------------------------------------------------ Close file in current FCB CLOSE:: ------------------------------------------------------------------------ Close file in current FCB2 CLOSE2:: ------------------------------------------------------------------------ Exit to BYE (or filename at ERRFILE::) if error in random disk I/O jump to -- ERROR:: ------------------------------------------------------------------------ Enter CP/M via file pointed to by DE. NOTE: make sure you have enough TPA. If EXTCL is 1 then uses external command buffer supplied as MCLBUF or if EXTCL is 0 then uses CCP calculated from BIOS base page address jump to -- CPM:: ------------------------------------------------------------------------ Build FCB from string pointed to by HL, FCB as equated BFCB:: ------------------------------------------------------------------------ Build FCB2 from string pointed to by HL, FCB2 is public and part of routine BFCB2:: FCB2:: ;<-- only storage NOT a routine ------------------------------------------------------------------------ Error routine from random operations routine will display...... error messages ++ read unwritten error ++ 1 ++ can''t close extent error ++ 3 ++ read unwritten extent error ++ 4 ++ can''t create new extent error ++ 5 ++ attempted read beyond end-of-disk error ++ 6 ------------------------------------------------------------------------ Any routines that use a link to EMXSUBS and want to use buffer space at the end of the program MUST call this routine at the start of the pro- gram to determine what the end address of the program is... this routine returns the address of the first free byte above the program. The ad- dress is in the HL register pair... ENDEMX:: -------------------------- end routines -------------------------------- - Simon Ewins