LEX 'ENGLEX' ID #5E MSG 0 POLL 0 FNRTN4 EQU #0F238 exit for functions STR$SB EQU #18149 internal number to string conversion, uses current fmt DSPFMT EQU #2F6DC storage for N the display mode flags. Also, at * #2F6DD we have the # of display digits data. ENTRY ENG$ CHAR #F ENTRY FIX$ CHAR #F ENTRY SCI$ CHAR #F KEY 'ENG$' TOKEN #B0 THIS TOKEN ALLOCATION IS SUBJECT TO CHANGE! KEY 'FIX$' TOKEN #B1 KEY 'SCI$' TOKEN #B2 NIBHEX 1FF ***************************************************** * * Syntax: A$=ENG$(X [,Y]) where X is the number to be converted to * a string in ENG Y format, without disturbing the current format * setting. * A$=ENG$(X) uses the value last set with FIX Y, SCI Y or ENG Y * to specify the # of digits to be shown. * * This keyword can help speed-up numeric tabulations by avoiding the * use of DISP USING or PRINT USING. Instead, use TAB, or O$[N]=ENG$(X,Y).. * * The ENG$ keyword suggested itself after I wrote the INT$ keyword. * I usually prefer using the STD display format, but I also often * want to print or display data in ENG 5 format. So, rather than * toggle back and forth between modes, a new keyword! * * Why not DISP USING? ... Because USING is slow! * * It should be noted that if you do ENG 5 @ STD, the * default number of integers / flags remain unchanged at 5. * This means that you can either preset this value as shown above, * or override this information with the optional parameter.. * * Coded by M. Markov in April '87 * * While we are here, we might as well provide the equivalent functions * for PRINTing or DISPlaying numbers in the FIX ? or SCI ? mode formats. * This can be done with almost no additional code, since the only change * required is one nib in the LCHEX instruction. We could also provide STD * formating, but that keyword is already provided by the DATALEX... * ******************************************************************** NIBHEX 8812 one mandatory numeric character, one opt. numeric ENG$ GOSUB ENGSUB LCHEX 3 GONC ENGDO NIBHEX 8812 FIX$ GOSUB ENGSUB LCHEX 1 GONC ENGDO NIBHEX 8812 SCI$ GOSUB ENGSUB LCHEX 2 GONC ENGDO ENGSUB P=C 15 number of parameters used CD0EX get PC into C[A] CSLC shift PC left one nib CSLC again. C[B] is now available D0=(5) DSPFMT pointer to display format data C=DAT0 B save display format in C[B] R3=C save PC and current display FMT in R3 ?P= 1 only one parameter? GOYES ENGdef yes, use existing # of digits (default) GOSBVL MPOP1N no, get the desired # of digits GOC argerr GOSBVL FLTDH convert value to hex D0=D0+ 1 store in 2F6DD ==> (DSPFMT)+1, one nibble DAT0=A 1 D0=D0- 1 reset pointer for later use D1=D1+ 16 move pointer to mandatory argument ENGdef P= 0 the start of common code... C=0 W clear C[W] RTNCC set DSPFMT to ENG. (STD= 0, SCI= 2 & ENG= 3) ENGDO DAT0=C 1 GOSBVL STR$SB does POP1N, convert to string using FIX 0 mode C=R3 get back PC and original display format DAT0=C B restore display format (D0 is unchanged) CSRC Shift PC back into C[A] field CSRC CD0EX restore PC GOVLNG #0F23C EXPR reset stack pointer and exit. argerr GOVLNG ARGERR ARGERR EQU #0BF19 MPOP1N EQU #0BD8D FLTDH EQU #1B223