LEX 'INTLEX' 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 INT$ CHAR #F KEY 'INT$' TOKEN #BE NIBHEX 1FF ***************************************************** * * The INT$ keyword suggested itself after I disassembled STD$ in the * DATA ACQUISITION ROM. What it does is return the same string you * would get by doing STD @ A$=STR$(INT(X)) -- which I do all too * often. This allows you to keep your favorite display format... * all you have to do is A$=INT$(X). * Coded by M. Markov in early March '87 ******************************************************************** NIBHEX 811 one mandatory numeric character INT$ 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 R3=C save PC and current display FMT in R3 P= 0 LCHEX 01 set DSPFMT to FIX 0. (STD=00, SCI=02 & ENG=03) DAT0=C B 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 ************************************************************* * at this point, if I only wanted the string in FIX 0 format, all I * would have to do is exit with GOVLNG EXPR. However, I also want to * get rid of the trailing ".", which can be easily accomplished by * moving the string header up one byte, writing over the "." * And, of course, that does mean you must decrement the string length * field in the header by two nibbles. * * Before we stomp over ".", we must make sure we do have a "." * If the # to be converted requires more than 13 bytes for FIX 0 representation, * STR$SB uses instead SCI notation. So, to make * sure the output remains valid: ************************************************************* C=DAT1 W Get the string header into C[W] R1=C temp. storage D1=D1+ 16 pointer to last string byte A=DAT1 B get it LCASC '.' set up comparison (P= 0) D1=D1- 14 pointer to new header store, we hope ?A#C B not a trailing "."? GOYES numlrg yes, not a "." C=R1 no, so we can stomp over "." CSLC shift string length field into C[M] C=C-1 M decrement length by two nibbles C=C-1 M CSRC shift back to original position... GOVLNG FNRTN4 store new header & function exit numlrg D1=D1- 2 The number $ does not end in ".", so leave it alone! GOVLNG #0F23C EXPR reset stack pointer and exit.