Data Conversion

Reference Section

_asc_to_c
_asc_to_i
_asc_to_l
_asc_to_q
_asc_to_uc
_asc_to_ui
_asc_to_ul
_asc_to_uq
_bcd_to_dec
_bcd_to_dece
_bcd_to_q
_c_to_asc
_c_to_asce
_c_to_dec
_c_to_dece
dc_addr
_dc_init
_dec_to_bcd
_dec_to_c
_dec_to_d
_dec_to_f
_dec_to_fixpi
_dec_to_fixpl
_dec_to_fixpq
_dec_to_form
_dec_to_forme
_dec_to_i
_dec_to_l
_dec_to_ld
_dec_to_q
_dec_to_uc
_dec_to_ufixpi
_dec_to_ufixpl
_dec_to_ufixpq
_dec_to_ui
_dec_to_ul
_dec_to_uq
_d_to_dec
_d_to_dece
_d_to_decn
_d_to_decne
_fdec_to_form
_fdec_to_forme
_fform_to_dec
_fform_to_dece
_fixpi_to_dec
_fixpi_to_dece
_fixpl_to_dec
_fixpl_to_dece
fixpq_to_dec
fixpq_to_dece
_form_to_dec
_form_to_dece
_f_to_dec
_f_to_dece
_f_to_decn
_f_to_decne
_hex_to_uc
_hex_to_ui
_i_to_asc
_i_to_asce
_i_to_dec
_i_to_dece
_ld_to_dec
_ld_to_dece
_ld_to_decn
_ld_to_decne
_l_to_asc
_l_to_asce
_l_to_dec
_l_to_dece
_q_to_asc
_q_to_asce
_q_to_bcd
_q_to_dec
_q_to_dece
_uc_to_asc
_uc_to_asce
_uc_to_dec
_uc_to_dece
_uc_to_hex
_uc_to_hexe
_ufixpi_to_dec
_ufixpi_to_dece
_ufixpl_to_dec
_ufixpl_to_dece
_ufixpq_to_dec
_ufixpq_to_dece
_ui_to_asc
_ui_to_asce
_ui_to_dec
_ui_to_dece
_ui_to_hex
_ui_to_hexe
_ul_to_asc
_ul_to_asce
_ul_to_dec
_ul_to_dece
_uq_to_asc
_uq_to_asce
_uq_to_dec
_uq_to_dece

_asc_to_c


Descrip
Converts an ASCII string to a char in a given radix.

Syntax
#include <dataconv>
char _asc_to_c(char *instr, int radix, char **strindx);

Returns
The char result (undefined if overflow, 0 if underflow or invalid radix).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from an ASCII string to a char using a given radix. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. The global int variable c_code is modified to contain the conversion status.

radix must be from 2 to 36 inclusive. If radix is not in this range, -1 is returned in c_code. A leading plus or minus sign is considered a valid character. ASCII digits and upper and lowercase letters are valid characters. Both cases of ASCII letters are considered equivalent.

The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.
No skipping of white space is performed. To skip leading white space, call str_skipw or str_skips immediately prior to calling this function.

C/C++ Example
	{
	   char num, *strindx;
	   ...
	   num = _asc_to_c("01111111", 2, &strindx);
	   switch (c_code)
	   {
	      case  0:_put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) {
	            _put_str("Except these characters: ");
	            _put_str(strindx); }; break;
	      case  1:_put_str("\n\rConversion resulted in overflow.");
	       break;
	      case -1:_put_str("\n\rConversion result is underflow.");
	       break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "01111111";
	   unsigned char num;
	   ...
	   mov bl,2	/* set radix = 2 (binary) */
	   lea si,instr/* SI = offset of instr */
	   num = asc_to_c();/* "string" -> signed char */
	    ja label_100/* overflow? */
	    jb label_200/* underflow? */
	   cmp byte ptr [si],0/* entire string converted? */
	    je label_300/*   y: conversion complete */
	   ... some characters not converted ...
	   jmp short label_300	  
	label_100:
	   ...
	   ... overflow ...
	label_200:
	   ...
	   ... underflow ...
	label_300:
	   ...
	}

Source file _DCATOSC.ASM ASM equiv ASC_TO_BYTES
See also
_asc_to_i, _asc_to_l, _asc_to_q, _asc_to_uc, _dec_to_c

_asc_to_i


Descrip
Converts an ASCII string to an int in a given radix.

Syntax
#include <dataconv.h>
int _asc_to_i(char *instr, int radix, char **strindx);

Returns
The int result (undefined if overflow, 0 if underflow or invalid radix).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from an ASCII string to an int using a given radix. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. The global int variable c_code is modified to contain the conversion status.

radix must be from 2 to 36 inclusive. If radix is not in this range, -1 is returned in c_code. A leading plus or minus sign is considered a valid character. ASCII digits and upper and lowercase letters are valid characters. Both cases of ASCII letters are considered equivalent.

The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips immediately prior to calling this function.

C/C++ Example
	{
	   int num;
	   char *strindx;
	   ...
	   num = _asc_to_i("7FFF", 16, &strindx);
	   if (c_code == 0)
	   {
	      _put_str("\n\rConversion was successful.");
	      if (strindx[0] != NULL) {
	         _put_str("\n\rExcept these characters: ");
	         _put_str(strindx); } 
	   }
	   else if (c_code==1)
	      _put_str("\n\rConversion resulted in an overflow: ");
	   else
	      _put_str("\n\rConversion resulted in underflow: ");
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "32767";
	   int num;
	   mov bl,10	/* set radix */
	   lea si,instr/* SI -> offset of instr */
	   num = asc_to_i();/* "string" -> signed int */
	    ja label_100/* overflow? */
	    jb label_200/* underflow? */
	   cmp byte ptr [si],0/* was string converted? */
	     je label_300/*   y: conversion complete */
	    ... some characters not converted ...
	    jmp short label_300
	label_100:
	    ... overflow ...
	label_200:
	    ... underflow ...
	label_300:
	    ...
	}

Source file _DCATOSI.ASM ASM equiv ASC_TO_WORDS
See also
_asc_to_c, _asc_to_l, _asc_to_q, _asc_to_ui, _dec_to_i

_asc_to_l


Descrip
Converts an ASCII string to a long in a given radix.

Syntax
#include <dataconv.h>
long _asc_to_l(char *instr, int radix, char **strindx);

Returns
The long result (0 if underflow or invalid radix).
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from an ASCII string to a long using a given radix. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. The global int variable c_code is modified to contain the conversion status.

radix must be from 2 to 36 inclusive. If radix is not in this range, -1 is returned in c_code. A leading plus or minus sign is considered a valid character. ASCII digits and upper and lowercase letters are valid characters. Both cases of ASCII letters are considered equivalent.

The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips immediately prior to calling this function.

C/C++ Example
	{
	   char *strindx;
	   long num;
	   ...
	   num = _asc_to_l ("80000000", 16, &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) { 
	            _put_str(" Except these characters: ");
	            _put_str(strindx); }; break;
	      case -1: _put_str("\n\rConversion result of underflow.");
	            break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "2147483648";
	   long num;
	   ...
	   mov bl,10	/* set radix */
	   lea si,instr/* SI -> offset of instr */
	   num = asc_to_l();/* was conversion successful? */ 
	    jneconv_100/*   y: underflow */
	   cmp byte ptr [si],0/* entire instr processed? */
	    je conv_200/*   y: conversion complete */
	   ... some characters were not processed ...
	   jmp short conv_200
	conv_100:
	   ...
	   ... underflow ...
	conv_200:
	   ...
	}

Source file _DCATOSL.ASM ASM equiv ASC_TO_DWORDS
See also
_asc_to_c, _asc_to_i, _asc_to_q, _asc_to_ul, _dec_to_l

_asc_to_q


Descrip
Converts an ASCII string to a quad in a given radix.

Syntax
#include <dataconv.h>
quadptr _asc_to_q(char *instr, int radix, quad num, char **strindx);

Returns
A pointer to num.
num the quad result (0 if underflow or invalid radix).
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from an ASCII string to a quad using a given radix. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. The global int variable c_code is modified to contain the conversion status.

radix must be from 2 to 36 inclusive. If radix is not in this range, -1 is returned in c_code. Leading plus or minus signs are considered invalid characters. ASCII digits and upper and lowercase letters are valid characters. Both cases of ASCII letters are considered equivalent.

The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this routine.

C/C++ Example
	{
	   char *strindx;
	   quad num;
	   ...
	   _asc_to_q("90000000000000000", 10, num, &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) { 
	            _put_str(" Except these characters: ");
	            _put_str(strindx) ;}; break;
	      case -1: _put_str("\n\rConversion result of underflow."); 
	         break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "90000000000000000000";
	   quad num;
	   ...
	   pushss
	   pop es	 	/* ES=SS (quad on stack) */
	   mov bl,10	/* BL = radix (dec) */
	   lea si,instr/* SI = offset of instr */
	   lea di,num	/* DI = offset of num */
	   asc_to_q();	/* num = conversion */
	    jnelabel_100/* underflow */
	   cmp byte ptr [si],0/* entire instr processed? */
	    je label_200/*   y: conversion complete */
	   ... some characters not converted ...
	   jmp short label_200
	label_100:
	   ... underflow ...
	label_200:
	   ...
	}

Source file _DCATOSQ.ASM ASM equiv ASC_TO_QWORDS
See also
_asc_to_c, _asc_to_i, _asc_to_l, _asc_to_uq, _dec_to_q

_asc_to_uc


Descrip
Converts an ASCII string to an unsigned char in a given radix.

Syntax
#include <dataconv.h>
unsigned char _asc_to_uc(char *instr, int radix, char **strindx);

Returns
The unsigned char result (undefined if overflow, 0 if underflow or invalid radix).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from an ASCII string to an unsigned char using a given radix. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. The global int variable c_code is modified to contain the conversion status.

radix must be from 2 to 36 inclusive. If radix is not in this range, -1 is returned in c_code. Leading plus or minus signs are considered invalid characters. ASCII digits and upper and lowercase letters are valid characters. Both cases of ASCII letters are considered equivalent.

The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips immediately prior to calling this routine.

C/C++ Example
	{
	   char *strindx;
	   unsigned char num;
	   ...
	   num = _asc_to_uc("11111111", 2, &strindx);
	   switch (c_code)
	   {
	      case  0:_put_str("Conversion was successful.");
	         if (strindx[0] != NULL) {
	         _put_str(" Except these characters: ");
	         _put_str(strindx); }; break; /* display remaining chrs */
	      case -1:_put_str("Underflow."); break;
	      case  1:_put_str("Overflow."); break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "255";
	   unsigned char num;
	   ...
	  mov bl,10	 /* BL = radix (decimal) */
	    lea si,instr/* SI = offset of instr */
	    num = asc_to_uc();/* was it successful? */ 
	     ja label_100/*   n: overflow */
	     jb label_200/*   n: underflow */
	    	   ... success ...
	    jmp short label_300/* continue ... */
	label_100:
	    ... overflow ...
	label_200:
	    ... underflow ...
	label_300:
	    ...
	}

Source file _DCATOC.ASM ASM equiv ASC_TO_BYTE
See also
_asc_to_c, _asc_to_ui, _asc_to_ul, _asc_to_uq, _dec_to_uc, _hex_to_uc

_asc_to_ui


Descrip
Converts an ASCII string to an unsigned int in a given radix.

Syntax
#include <dataconv.h>
int _asc_to_ui(char *instr, int radix, char **strindx);

Returns
The unsigned int result (undefined if overflow, 0 if underflow or invalid radix).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from an ASCII string to an unsigned int using a given radix. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. The global int variable c_code is modified to contain the conversion status.

radix must be from 2 to 36 inclusive. If radix is not in this range, -1 is returned in c_code. Leading plus or minus signs are considered invalid characters. ASCII digits and upper and lowercase letters are valid characters. Both cases of ASCII letters are considered equivalent.

The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips immediately prior to calling this routine.

C/C++ Example
	{
	   char *strindx;
	   unsigned int num;
	   ...
	   num = _asc_to_ui("65000", 10, &strindx);
	   switch (c_code)
	   {
	      case  0:_put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) {
	         _put_str(" Except these characters: ");
	         _put_str(strindx); }; break;
	      case  1:_put_str("\n\rConversion result of overflow."); 
	         break;
	      case -1:_put_str("\n\rConversion result of underflow."); 
	         break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "65000";
	   unsigned int num;
	   ...
	   mov bl,10	/* BL = radix (dec) */
	   lea si,instr/* SI -> offset of instr */
	   num = asc_to_ui();/* was it successful? */ 
	    ja label_100/*   n: overflow */
	    jb label_200/*   n: underflow */
	   ... success ...
	   jmp short label_300/* continue ... */
	label_100:
	   ... overflow ...
	label_200:
	   ... underflow ...
	label_300:
	   ...
	}

Source file _DCATOI.ASM ASM equiv ASC_TO_WORD
See also
_asc_to_i, _asc_to_uc, _asc_to_ul, _asc_to_uq, dec_to_ui

_asc_to_ul


Descrip
Converts an ASCII string to an unsigned long in a given radix.

Syntax
#include <dataconv.h>
unsigned long _asc_to_ul(char *instr, int radix, char **strindx);

Returns
The unsigned long result (0 if underflow or invalid radix).
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from an ASCII string to an unsigned long using a given radix. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. The global int variable c_code is modified to contain the conversion status.

radix must be from 2 to 36 inclusive. If radix is not in this range, -1 is returned in c_code. Leading plus or minus signs are considered invalid characters. ASCII digits and upper and lowercase letters are valid characters. Both cases of ASCII letters are considered equivalent.

The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips immediately prior to calling this routine.

C/C++ Example
	{
	   char *strindx;
	   unsigned long num;
	   ...
	   num = _asc_to_ul("FFFFFFFE", 16, &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) { 
	            _put_str(" Except these characters: ");
	            _put_str(strindx); }; break;
	      case -1: _put_str("\n\rConversion result of underflow."); 
	         break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "0xFFFFFFFF";
	   unsigned long num;
	   ...
	   mov bl,16	/* BL = radix */
	   lea si,instr/* SI = offset of instr */
	   num = asc_to_ul();/* is conversion successful? */
	    jnelabel_100/*   n: underflow */ 
	   ... success ...
	   cmp byte ptr [si],0/* entire string converted? */
	    je label_200/*   y: conversion complete */
	   ... some characters not converted ...
	   jmp short label_200
	label_100:
	   ... underflow ...
	label_200:
	   ...
	}

Source file _DCATOL.ASM ASM equiv ASC_TO_DWORD
See also
_asc_to_l, _asc_to_uc, _asc_to_ui, _asc_to_uq, dec_to_ul

_asc_to_uq


Descrip
Converts an ASCII string to a uquad in a given radix.

Syntax
#include <dataconv.h>
quadptr _asc_to_uq(char *instr, int radix, uquad num, char **strindx);

Returns
The uquad result (0 if underflow or invalid radix).
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from an ASCII string to an uquad using a given radix. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. The global int variable c_code is modified to contain the conversion status.

radix must be from 2 to 36 inclusive. If radix is not in this range, -1 is returned in c_code. Leading plus or minus signs are considered invalid characters. ASCII digits and upper and lowercase letters are valid characters. Both cases of ASCII letters are considered equivalent.

The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this routine.

C/C++ Example
	{
	   char *strindx;
	   uquad num;
	   ...
	   _asc_to_uq("18000000000000", 16, num, &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) { 
	            _put_str(" Except these characters: ");
	            _put_str(strindx); }; break;
	      case -1: _put_str("\n\rConversion resulted in underflow."); 
	         break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "18000000000000000000";
	   uquad num;
	   ...
	   mov bl,10	/* set radix */
	   lea si,instr/* SI = offset of instr */
	   pushss
	   pop es	 	/* ES=SS (quad on stack) */
	   lea di,num;	    /* DI = offset of num */
	   asc_to_uq();	/* is conversion successful? */
	    jnelabel_100/*   n: underflow */ 
	   ... success ...
	   cmp byte ptr [si],0/* entire string converted? */
	    je label_200/*   y: conversion complete */
	   ... unconverted characters in instr ...
	   jmp short label_200
	label_100:
	   ... underflow ...
	label_200:
	   ...
	}

Source file _DCATOQ.ASM ASM equiv ASC_TO_QWORD
See also
_asc_to_q, _asc_to_uc, _asc_to_ui, _asc_to_ul, dec_to_uq

_bcd_to_dec


Descrip
Converts a BCD number to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_bcd_to_dec(bcd num, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ string representation of num

Notes
This function converts a packed BCD number to a decimal ASCIIZ string. If num is negative, the first character in outstr is a minus sign. A maximum of 18 digits may be converted. outstr is NULL terminated.

This function does NOT require a math coprocessor or emulator.

C/C++ Example
	{
	   char *strindx, outstr[20];
	   bcd num;
	   ..
	   
	   _dec_to_bcd ("123456789012345678", num, &strindx);
	   _put_str(_bcd_to_dec(num, outstr));
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[20];
	   char instr[] = "100000000000000000";
	   bcd num;
	   ...
	   lea di,num	/* DI -> num */
	   lea si,instr/* SI -> instr */
	   dec_to_bcd();	/* "string" -> bcd */
	   lea si,outstr/* SI -> outstr */
	   bcd_to_dec();	/* bcd -> "string" */
	   put_str();	/* "18446744073709551615" */
	   ...
	}

Source file _DCBCDDC.ASM ASM equiv BCD_TO_DEC
See also
_bcd_to_dec, _dec_to_bcd

_bcd_to_dece


Descrip
Converts a BCD number to a decimal ASCII string.

Syntax
#include <dataconv.h>
char *_bcd_to_dece(bcd num, char *outstr);

Returns
A pointer to the byte after the last character written to outstr.
outstr the decimal ASCII representation of num

Notes
This function converts a packed BCD number to a decimal ASCII string. If num is negative, the first character in outstr is a minus sign. A maximum of 18 digits may be converted. The returned pointer identifies the next availableposition in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _bcd_to_dec. outstr is not NULL terminated.

This function does NOT require a math coprocessor or emulator.

C/C++ Example
	{
	   char *strindx, outstr[] = "                   is the result.";
	   bcd num;
	   
	   _dec_to_bcd("123456789012345678", num, &strindx);
	   _bcd_to_dece(num, outstr);
	   _put_str(outstr);/* "123456789012345678 is the result." */
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "                   is the result.";
	   char instr[] = "184467440737095516";
	   bcd num;
	   ...
	   lea di,num	/* DI -> num */
	   lea si,instr/* SI -> instr */
	   dec_to_bcd();	/* "string" -> bcd */
	   lea si,outstr/* SI -> outstr */
	   bcd_to_dece();	/* bcd -> "string..." */
	   lea si,outstr/* reset SI -> outstr */
	   put_str(); /* "18446744073709551615 is the result." */
	   ...
	}

Source file _DCBCDDE.ASM ASM equiv BCD_TO_DECE
See also
_bcd_to_dec, dec_to_bcd, _q_to_dec

_bcd_to_q


Descrip
Converts a BCD number to a quad.

Syntax
#include <dataconv.h>
quadptr _bcd_to_q(quad num2, bcd num1);

Returns
A pointer to num2.
num2 resulting quad conversion from num1

Notes
This function converts an unsigned packed BCD number to a quad. This cross-conversion allows the integer math package to be used with BCD numbers. All digits are converted as decimal digits.

This function does NOT require a numeric coprocessor or emulator.

C/C++ Example
	{
	   char outstr[20], *strindx;
	   BCD bnum;
	   quad qnum;
	   ...
	   _dec_to_bcd("123456789012345678",bnum, &strindx);
	   _bcd_to_q(qnum, bnum);
	   _put_str(_q_to_dec(qnum, outstr));
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[20];
	   char instr[] = "123456789012345678";
	   BCD bnum;
	   quad qnum;
	   ...
	   lea si,instr/* SI -> instr */
	   lea di,bnum	    /* DI -> bcd number */
	   dec_to_bcd();	/* "string" -> bcd */
	   lea si,qnum
	   xchgdi,si	/* SI -> bcd, DI -> quad */
	   bcd_to_q();	/* convert bcd to quad */
	   lea si,outstr/* SI -> outstr */
	   q_to_dec();	/* quad -> "string" */
	   put_str();	/* "123456789012345678" */
	   ...
	}

Source file _DCBCDQ.ASM ASM equivâ
See also
_bcd_to_dec, _q_to_bcd

_c_to_asc


Descrip
Converts a char to an ASCIIZ string in a given radix.

Syntax
#include <dataconv.h>
char *_c_to_asc(char num, int radix, char *outstr);

Returns
A pointer to outstr.
outstr the ASCIIZ representation of num in the base specified by radix

Notes
This function converts num to an ASCIIZ string at outstr using radix as the base. If num is negative, the first character in outstr is a minus sign. The string is NULL terminated.

The results for a radix less than 2 or greater than 36 are undefined.

C/C++ Example
	   char outstr[10];
	   _put_str(_c_to_asc(0x80,10,outstr));/* "128" */

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[10];
	   ...
	   mov al,0xFF	    /* AL = num */
	   lea si,outstr/* SI = offset of outstr */
	   mov bl,10	/* BL = radix (dec) */
	   c_to_asc();	/* char -> "string" */
	   put_str();	/* "255" */
	   ...
	}

Source file _DCSCTA.ASM ASM equiv BYTES_TO_ASC

_c_to_asce


Descrip
Converts a char to an ASCII string in a given radix, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_c_to_asce(char num, int radix, char *outstr);

Returns
A pointer to the byte after the last digit written to outstr.
outstr the ASCII representation of num in the base specified by radix

Notes
This function converts num to an ASCII string at outstr using radix as the base. If num is negative, the first character in outstr is a minus sign. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _c_to_asc. outstr is not NULL terminated.

The results for a radix less than 2 or greater than 36 are undefined.

C/C++ Example
	{
	   char outstr[25] = "   is the result";
	   _put_str(_c_to_asce(255, 16, outstr));
	   	  	 	/* "-FF is the result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[25] = "   is the result";
	   ...
	   mov al,255
	   mov bl,16	/* BL = hex radix */
	   lea si,outstr/* SI = offset of outstr */ 
	   c_to_asce();	/* char -> "string" */
	   lea si,outstr/* reset SI = offset outstr */
	   put_str();	/* "-FF is the result" */
	   ...
	}

Source file _DCSCTAE.ASM ASM equiv BYTES_TO_ASCE

_c_to_dec


Descrip
Converts a char to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_c_to_dec(char num, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of num

Notes
This function converts num to a decimal ASCIIZ string at outstr. If num is negative, the first character in outstr is a minus sign. The resulting string is NULL terminated.

C/C++ Example
	{
	   char outstr[5];

	   _put_str(_c_to_dec(0xFF,outstr));/* "-255" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	char outstr[5];	    

	   mov al,127
	   lea si,outstr/* SI = offset of outstr */
	   c_to_dec();	/* char -> "string" */
	   put_str();	/* "127" */
	   ...
	}

Source file _DCSCTD.ASM ASM equiv BYTES_TO_DEC

_c_to_dece


Descrip
Converts a char to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_c_to_dece(char num, char *outstr);

Returns
A pointer to the byte after the last digit written to outstr.
outstr the decimal ASCII representation of num

Notes
This function converts num to a decimal ASCII string at outstr. If num is negative, the first character in outstr is a minus sign. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _c_to_dec. outstr is not NULL terminated.

C/C++ Example
	{
	   char outstr[25] = "    is the result";

	   _put_str(_c_to_dece(255,outstr)); /* "-1 is the result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[25] = "    is the result";

	   mov al,255
	   lea si,outstr/* SI = offset of outstr */
	   c_to_dece();	/* char -> "string" */
	   lea si,outstr/* reset SI = offset outstr */
	   put_str();
	   ...
	}

Source file _DCSCTDE.ASM ASM equiv BYTES_TO_DECE
See also
_uc_to_dec, _c_to_dec, _ui_to_dec, _ul_to_dec, _uq_to_dec

dc_addr


Descrip
(Variable) Contains the address of the current data conversion options structure.

Syntax
#include <dataconv.h>
extern dcopts *dc_addr;

Notes
This near/far pointer maintains the address of the current data conversion options (dcopts) structure. In small data models (TINY, SMALL, MEDIUM), this variable is a near pointer which contains the offset of the structure within the global data segment (DGROUP). In large data models (COMPACT, LARGE, HUGE), this variable is a far pointer which contains the segment and offset of the structure.

The current dcopts structure specifies global data conversion formatting options and is used by _form_to_dec, _dec_to_form, and the scripted I/O functions. The behavior of these functions may be changed by modifying this structure or by modifying dc_addr to point to a different dcopts structure.

dc_addr is initialized with the address of the default dcopts structure. The default dcopts structure is defined in DATACONV.H as follows:

typedef struct {
char * dc_leadplus; /* leading plus string pointer ("+") */
char * dc_trailplus; /* trailing plus string pointer (NULL) */
char * dc_leadneg; /* leading neg string pointer ("-") */
char * dc_trailneg; /* trailing neg string pointer (NULL) */
char * dc_expstr; /* exponent string pointer ("e") */
char dc_curstr[6]; /* ASCIIZ currency string ("$") */
char dc_thdelim; /* thousands delimiter (",") */
char dc_decdelim; /* decimal delimiter (".") */
char dc_curdigits; /* currency digits after decimal point (2) */
unsigned char dc_flags;/* currency location, use "+" in exp, suppress
leading zero, min number of exponent digits */
} dcopts;

The DC_DEFAULT symbolic constant (defined in DATACONV.H) may be specified for any field which accepts a pointer. This causes the data conversion functions to use the default string, shown in the comments above, for each field in which it is specified.

The following symbolic constants (defined in DATACONV.H) may be used to check or modify the information in the dc_flags field:

DC_CPRECEDE(0x00) Currency symbol precedes the number
DC_CFOLLOW(0x01) Currency symbol follows the number
DC_NOEXPPLUS(0x00) No "+" on positive exponent strings (default)
DC_EXPPLUS(0x04) Use "+" on positive exponent strings
DC_LEADZERO(0x00) Use leading zero if number would start with "." (default)
DC_NOLEADZERO(0x08) No leading zero if number would start with "."
DC_MINEXP1(0x00) Use minimum of 1 digit in exponent (default)
DC_MINEXP2(0x40) Use minimum of 2 digits in exponent
DC_MINEXP3(0x80) Use minimum of 3 digits in exponent
DC_MINEXP4(0xC0) Use minimum of 4 digits in exponent
Source file DCVARS.ASM ASM equivâ
See also
_dc_init

_dc_init


Descrip
Initializes the current data conversion options structure with DOS country information.

Syntax
#include <dataconv.h>
int _dc_init(unsigned int cntrycode);

Returns
The country code of the specified (or current) DOS country.

-1 if an error occurred (e.g., cntrycode is invalid).
e_code error code

Notes
This function updates the current data conversion options structure with the DOS country information for the country specified by cntrycode. The current DOS country is used if cntrycode is 0. If the operation was successful, the country code of the specified (or current) DOS country is returned and the current data conversion options structure is updated. If an error occurred (e.g., cntrycode is invalid), -1 is returned, an error code is returned in e_code, and the structure is left unmodified.

Valid cntrycode values are found in DOS user manuals for DOS 4.x and above and in many programming reference manuals.

The current data conversion options structure contains global data conversion formatting parameters used by _dec_to_form, _form_to_dec, and the scripted I/O functions. The dc_addr variable maintains the address of the current structure. (See dc_addr for further information.)

The following dcopts information is updated by this function: currency string, thousands delimiter, decimal delimiter, currency digits, and currency symbol position. (The currency position is stored by setting DC_CURR_PN or DC_CURR_FN in dc_flags and prefixing or appending the appropriate number of space characters to the currency symbol string specified in dc_curstr.)

e_code may be obtained using the _get_ecode function. Symbolic constants for e_code values are defined in Appendix A.

C/C++ Example
	{
	   dcopts dc;
	   ...
	   dc_addr = &dc;
	   if(_dc_init(0) == -1);/* use current DOS country */
	   	  	 	/* info for conversion */
	      _put_str("Unable to access DOS country info.");
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   dcopts dc;
	   char *str;
	   ...
	   dc_addr = &dc;
	   ...
	   xor ax,ax/* AX = current DOS country code */
	   lea si,dc/* SI = offset of dc struct */
	   dc_init();/* initialize formatting w/DOS info */
	 jnclabel_010
	str = "Unable to access DOS country info.";
	mov si,str
	put_str();/* display error */
	label_010:
	...
	}

Source file _DCINIT.ASM ASM equiv DC_INIT
See also
dc_addr

_dec_to_bcd


Descrip
Converts an ASCII string to a bcd.

Syntax
#include <dataconv.h>
bcdptr _dec_to_bcd(const char *instr, bcd num, char **strindx);

Returns
A pointer to num.
num the bcd result (0 if underflow)
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a signed packed BCD number. Characters are processed from instr, one at a time, until an invalid character is encountered. A pointer to num is returned, and strindx points to the first character in instr not converted. If the conversion was successful, c_code = 0 and the bcd result is returned in num. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned in num.

instr is expected to be in the following format:

[+|-][d...]d (where d denotes any decimal digit)

If instr contains other sign indicators, currency symbols, or thousands delimiters, _form_to_dec must be called before calling this function.

The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this routine.

C/C++ Example
	{
	   char *strindx, outstr[20];
	   bcd num;
	   ...
	   _dec_to_bcd("123456789012345678", num, &strindx);
	   _put_str(_bcd_to_dec(num, outstr));
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[20];
	   char instr[] = "100000000000000000";
	   bcd num;
	   ...
	   lea di,num	/* DI -> num */
	   lea si,instr/* SI -> instr */
	   dec_to_bcd();	/* "string" -> bcd */
	   lea si,outstr/* SI -> outstr */
	   bcd_to_dec();	/* bcd -> "string" */
	   put_str();	/* "18446744073709551615" */
	   ...
	}

Source file _DCDCBCD.ASM ASM equiv DEC_TO_BCD
See also
_bcd_to_dec, _dec_to_q

_dec_to_c


Descrip
Converts a decimal ASCII string to a char.

Syntax
#include <dataconv.h>
char _dec_to_c(const char *instr, char **strindx);

Returns
The char result (undefined if overflow, 0 if underflow).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a char. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. If the conversion was successful, c_code = 0 and the char result is returned. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned. If overflow occurred (value < -128, or value > 127), c_code = 1, and the return value is undefined.

instr is expected to be in the following format:

[+|-][d...]d (where d denotes any decimal digit)

If instr contains other sign indicators, currency symbols, or thousands delimiters, _form_to_dec must be called before calling this function.

Note that unless overflow occurs (c_code = 1), strindx is always advanced past all consecutive digits in instr. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this function.

C/C++ Example
	{
	   char *strindx, num;
	   num = _dec_to_c("-127", &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) {
	            _put_str("Except these characters: ");
	            _put_str(stri}; break;
	      case  1: _put_str("\n\rConversion result in overflow.");
	         break;
	      case -1: _put_str("\n\rConversion result in underflow.");
	         break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "-128";
	   char num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   num = dec_to_c();/* num = conversion result */
	    ja label_100/* overflow? */
	    jb label_200/* underflow? */
	   cmp byte ptr [si],0/* entire string processed? */
	    je label_300/*   y: finished */
	   ... some characters were not converted ...
	   jmp short label_300
	label_100:
	   ... overflow ...
	label_200:
	   ... underflow ...
	label_300:
	   ...
	}

Source file _DCDTOSC.ASM ASM equiv DEC_TO_BYTES
See also
_asc_to_c, _dec_to_i, _dec_to_l, _dec_to_q, _dec_to_uc

_dec_to_d


Descrip
Converts an ASCII string to a double.

Syntax
#include <dataconv.inc>
double _dec_to_d(const char *instr, unsigned char precision, char **strindx);

Returns
The double result (undefined if overflow, 0 if underflow).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a double using the specified precision. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first unconvertible character in instr. If the conversion was successful, c_code = 0 and the double result is returned. If overflow occurred (value < -1.79e308, or value > 1.79e308), c_code = 1 and the return value is undefined. If underflow occurred (-2.22e-308 < value < 2.22e-308) or no convertible digits were encountered, c_code = -1, and 0 is returned.

instr is expected to be in the following format:

[+|-][d...][.][d...][e[-]d[d...]] (where d denotes any decimal digit)

If instr contains other formatting characters (for example, currency symbols or thousands delimiters), _form_to_dec must be called before calling this function.

precision indicates the maximum number of digits (0 to 30) to the right of the decimal point in instr which will be included in the result. Rounding options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.

Note that strindx is always advanced past all digits to the right of the decimal point in instr, regardless of the value of precision. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL. Numeric underflow (-2.22e-308 < value < 2.22e-308) may be distinguished from field underflow (no convertible characters present) by comparing strindx == instr.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips prior to calling this function.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char *strindx;
	   double num;
	   num = _dec_to_d("1.23e255", 2+DC_ROUND, &strindx);
	   if (c_code != 0)
	      _put_str("Overflow or underflow result.");
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "1.23e255";
	   double num;
	   ...
	   lea si,instr/* SI -> instr */
	   lea di,num	/* DI -> buffer for num */
	   mov ch,DC_TRUNC/* CH = precision flag */
	   dec_to_d();	/* conversion successful? */
	    je label_010/*   y: continue */
	   ... 	 	/*   n: overflow/underflow */	  
	label_010:
	   ...
	}

Source file _DFDECTD.ASM ASM equiv DEC_TO_LONG
See also
_dec_to_f, _dec_to_l, _d_to_dec

_dec_to_f


Descrip
Converts an ASCII string to a float.

Syntax
#include <dataconv.inc>
float _dec_to_f(const char *instr, unsigned char precision, char **strindx);

Returns
The float result (undefined if overflow, 0 if underflow).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a float using the specified precision. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first unconvertible character in instr. If the conversion was successful, c_code = 0 and the float result is returned. If overflow occurred (value < -3.403e38, or value > 3.403e38), c_code = 1 and the return value is undefined. If underflow occurred (-1.175e-38 < value < 1.175e-38) or no convertible digits were encountered, c_code = -1, and 0 is returned.

instr is expected to be in the following format:

[+|-][d...][.][d...][e[-]d[d...]] (where d denotes any decimal digit)

If instr contains other sign indicators, currency symbols, thousands delimiters, or exponential strings other than "e", _form_to_dec must be called before calling this function.

precision indicates the maximum number of digits (0 to 30) to the right of the decimal point in instr which will be included in the result. Rounding options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.

Note that strindx is always advanced past all digits to the right of the decimal point in instr, regardless of the value of precision. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL. Numeric underflow (-1.175e-38 < value < 1.175e-38) may be distinguished from field underflow (no convertible characters present) by comparing strindx == instr.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips prior to calling this function.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char *strindx;
	   float num;
	   num = _dec_to_f("1.23e25", 2+DC_ROUND, &strindx);
	   if (c_code != 0)
	      _put_str("overflow or underflow result")

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[20] = "1.23e25";
	   float num;
	   ...
	   lea si,instr/* SI -> instr */
	   lea di,num	/* DI -> num */
	   mov ch,DC_TRUNC/* CH = precision + flags */
	   dec_to_f();	/* "string" -> float */
	   ...
	}

Source file _DFDECTF.ASM ASM equiv DEC_TO_SHORT
See also
_dec_to_d, _dec_to_l, _f_to_dec

_dec_to_fixpi


Descrip
Converts a decimal ASCII string to a fixed-point int.

Syntax
#include <dataconv.h>
int _dec_to_fixpi(const char *instr, unsigned char precision, char **strindx);

Returns
The fixed-point int result (undefined if overflow, 0 if underflow).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a fixed-point int using the specified precision. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first unconvertible character in instr. If the conversion was successful, c_code = 0 and the fixed-
point int result is returned. If overflow occurred (value < -32768e-precision, or value > 32767e-precision), c_code = 1 and the return value is undefined. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned.

instr is expected to be in the following format:

[+|-][d...][.][d...] (where d denotes any decimal digit)

If instr contains other sign indicators, currency symbols, or thousands delimiters, _form_to_dec must be called before calling this function.

precision indicates the maximum number of digits (0 to 30) to the right of the decimal point in instr which will be included in the result. Rounding options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.

Note that unless overflow occurs (c_code = 1), strindx is always advanced past all digits to the right of the decimal point in instr, regardless of the value of precision. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips prior to calling this function.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char *strindx;
	   int num;
	   num = _dec_to_fixpi("327.67", 2, &strindx);
	   ...
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rSuccess.");
	               if (strindx[0] != NULL) {
	                  _put_str(" Except these characters: ");
	                  _put_str(stri}; break;
	      case  1:_put_str("\n\rOverflow!"); break;
	      case -1:_put_str("\n\rUnderflow!"); break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "327.67";
	   int num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   mov ch,2	/* CH = precision */
	   num = dec_to_fixpi();/* "string" -> fixed-point int */
	   ...
	}

Source file _DCDCXSI.ASM ASM equiv DEC_TO_FIXPWS
See also
_dec_to_f, _dec_to_f, _dec_to_ufixpi, _fixpi_to_dec

_dec_to_fixpl


Descrip
Converts a decimal ASCII string to a fixed-point long.

Syntax
#include <dataconv.h>
long _dec_to_fixpl(const char *instr, unsigned char precision, char **strindx);

Returns
The fixed-point long result (0 if underflow).
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a fixed-point long using the specified precision. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindxpoints to the first unconvertible character in instr. If the conversion was successful, c_code = 0 and the fixed-
point long result is returned. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned.

instr is expected to be in the following format:

[+|-][d...][.][d...] (where d denotes any decimal digit)

If instr contains other sign indicators, currency symbols, or thousands delimiters, _form_to_dec must be called before calling this function.

precision indicates the maximum number of digits (0 to 30) to the right of the decimal point in instr which will be included in the result. Rounding options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.

Note that strindx is always advanced past all digits to the right of the decimal point in instr, regardless of the value of precision. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips prior to calling this function.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char *strindx;
	   long num;
	   num = _dec_to_fixpl("20000000.00", 2, &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	               if (strindx[0] != NULL) {
	                  _put_str(" Except these characters: ");
	                  _put_str(str}; break;
	      case -1: _put_str("\n\rConversion resulted in underflow.");
	               break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "21474836.47";
	   long num;
	   ...
	   lea si,instr/* SI -> instr */
	   mov ch,2	/* CH = precision */
	   num = dec_to_fixpl();/* num = fixed-point long */
	   ...
	}

Source file _DCDCXSL.ASM ASM equiv DEC_TO_FIXPDWS
See also
_dec_to_f, _dec_to_f, _dec_to_ufixpl, _fixpl_to_dec

_dec_to_fixpq


Descrip
Converts a decimal ASCII string to a fixed-point quad.

Syntax
#include <dataconv.h>
quadptr _dec_to_fixpq(const char *instr, unsigned char precision, quad num, char **strindx);

Returns
A pointer to num.
num the fixed-point quad result (0 if underflow)
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a fixed-point quad using the specified precision. Characters are processed from instr, one at a time, until an invalid character is encountered. A pointer to num is returned, and strindx points to the first unconvertible character in instr. If the conversion was successful, c_code = 0 and the fixed-point quad result is returned in num. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned in num.

instr is expected to be in the following format:

[+|-][d...][.][d...] (where d denotes any decimal digit)

If instr contains other sign indicators, currency symbols, or thousands delimiters, _form_to_dec must be called before calling this function.

precision indicates the maximum number of digits (0 to 30) to the right of the decimal point in instr which will be included in the result. Rounding options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.

Note that strindx is always advanced past all digits to the right of the decimal point in instr, regardless of the value of precision. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips prior to calling this function.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[40], *strindx;
	   quad num;
	   ...
	   _dec_to_fixpq("10000000000000.000", 3, num, &strindx);
	   _put_str(_fixpq_to_dec(2, num, outstr));
	   	  	 /* "10000000000000000.00" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[25];
	   char instr[] = "1000000000000000000";
	   quad num;
	   ...
	   lea di,num	/* DI -> quad */
	   lea si,instr/* SI -> instr */
	   xor ch,ch	/* read with precision of 0 */
	   dec_to_fixpq();
	   lea si,outstr/* reset SI -> outstr */
	   mov ch,2	/* CH = precision of 2 */
	   fixpq_to_dec();    /* quad -> "string" */
	   put_str();	/* "1000000000000000000.00" */
	   ...
	}

Source file _DCDCXSQ.ASM ASM equiv DEC_TO_FIXPQWS
See also
_dec_to_f, _dec_to_f, _dec_to_ufixpq, _fixpq_to_dec

_dec_to_form


Descrip
Converts a decimal ASCII numeric string to a formatted decimal ASCIIZ numeric string.

Syntax
#include <dataconv.h>
char *_dec_to_form(const char *instr, unsigned char nflags, unsigned char precision, unsigned char width, char *outstr, char **strindx);

Returns
A pointer to outstr.
outstr the formatted decimal ASCIIZ result
strindx points to first character in instr not converted

NULL if the length of the resulting string would exceed width.

Notes
This function converts a standard decimal ASCII string to a formatted decimal ASCIIZ string. Characters are processed and converted from instr, one at a time, until an invalid character is encountered. The resulting formatted string contains no more than precision digits to the right of the decimal point. The format of the result is specified in nflags as well as the current data conversion options structure. If the conversion was successful, a pointer to outstr is returned and strindx points to the first unconvertible character in instr. If the formatted string would exceed width characters in length (excluding the terminal NULL character), NULL is returned, and outstr remains unchanged. outstr and instr may refer to the same buffer or to buffers which overlap in memory.

instr is expected to be in the following format:

[+|-][d...][.][d...][e[-]d[d...]] (where d denotes any decimal digit)

Numeric formatting options are specified in nflags and consist of plus sign, currency, thousands, and exponential format flags. The following symbolic constants (defined in DATACONV.H) may be bitwise ORed together to specify these options:

DC_NOPLUS (0x00) No plus sign is written if the value is positive.
DC_PLUS (0x10) A plus sign is written if the value is positive. The plus sign is written using the leading/trailing plus sign strings specified in the current data conversion options structure.
DC_NOCURRENCY (0x00) No currency symbol is inserted.
DC_CURRENCY (0x08) A currency symbol is inserted in the position specified in the current data conversion options structure.
DC_NOTHOUS (0x00) Thousands separators are not inserted.
DC_THOUS (0x04) Thousands separators are inserted. Separators appear only to the left of the decimal point.
DC_NOEXP (0x00) The result is written in non-exponential form. NULL is returned if the result exceeds width.
DC_EXP (0x01) The result is written in exponential form. NULL is returned if the result exceeds width.
DC_FLEX (0x02) The result is written in non-exponential form if possible and in exponential form if the non-exponential result would exceed width. If exponential form is used, the maximum possible number of digits are written to the right of the decimal point; NULL is returned if the exponential result would exceed width.

precision indicates the maximum or required number of digits (0 to 30) to the right of the decimal point in the resulting string. In addition, precision option flags may be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FILL (0x40) Forces precision characters to the right of the decimal point by replacing trailing zeros with the space character. If the decimal point is suppressed, it is also replaced with the space character. (Note that this inserts space characters between the mantissa and exponent in exponential format.)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

In addition, the following constant allows the precision of currency strings to be specified in a country-independent manner whether or not a currency symbol is written. This constant is used in place of the precision value specified in the precision parameter:

DC_CDIGITS (0x1F) Use the country-specific precision specified for currency in the current data conversion options structure.

width must be in the range 0 to 126. A width of 0 denotes "no limit" (which translates into the maximum internally supported width of at least 126 characters).

The current data conversion options structure specifies global formatting options such as sign indicator strings, thousands delimiter, decimal delimiter, currency symbol location, currency precision, exponent string, exponent sign suppression, minimum number of exponent digits, and zero suppression before the decimal point. These options may be accessed or modified through the dc_addr variable. (See dc_addr for further information.)

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this function.

WARNING! outstr must be large enough to hold the converted string and a terminating NULL or data following the buffer will be overwritten.

C/C++ Example
	{
	   char outstr[80];
	   char *strindx;
	   ...
	   _put_str(_dec_to_form("10000000000000000.009",
	            DC_THOUS+DC_CURRENCY, 2, 80, outstr, &strindx));
	   	  	 /* "$10,000,000,000,000,000.01" */
	   dc.dc_expstr = "x10^";/* set exponent string */
	   dc.dc_leadplus = "+";/* set leading plus string */
	   _put_str(_dec_to_form("10000000000000000.009",
	          DC_EXP+DC_PLUS+DC_CURRENCY, 2, 80, outstr, &strindx));
	   	  	 /* "+$1.00x10^16" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[80];
	   char instr[] = "10000000000000000.009";
	   ...
	   /* non-exponential output */
	   mov al,DC_THOUS+DC_CURRENCY
	   mov ch,2	/* CH = precision */
	   mov cl,80	/* CL = width */
	   lea di,instr/* DI -> instr */
	   lea si,outstr/* SI -> outstr */
	   dec_to_form();	/* standard to format string */
	   put_str();	/* "$10,000,000,000,000,000.01"*/
	   ...
	   /* exponential output */
	   dc.dc_expstr = "x10^";
	   dc.dc_leadplus = "+";
	   mov al,DC_EXP+DC_PLUS+DC_CURRENCY
	   mov ch,2	/* CH = precision */
	   mov cl,80	/* CL = width */
	   lea di,instr/* DI -> instr */
	   lea si,outstr/* SI -> outstr */
	   dec_to_form();	/* standard to format string */
	   put_str();	/* "+$1.00x10^16" */
	   ...
	}

Source file _DCDCFRM.ASM ASM equiv DEC_TO_FORM
See also
_dec_to_f, _fdec_to_form, _form_to_dec

_dec_to_forme


Descrip
Converts a decimal ASCII numeric string to a formatted decimal ASCII numeric string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_dec_to_forme(const char *instr, unsigned char nflags, unsigned char precision, unsigned char width, char *outstr, char **strindx);

Returns
A pointer to the character after the last converted character in outstr.
outstr the formatted decimal ASCII result
strindx points to first character in instr not converted

NULL if the length of the resulting string would exceed width.

Notes
This function converts a standard decimal ASCII string to a formatted decimal ASCII string. Characters are processed and converted from instr, one at a time, until an invalid character is encountered. The resulting formatted string contains no more than precision digits to the right of the decimal point and is not NULL terminated. The format of the result is specified in nflags as well as the current data conversion options structure. If the conversion was successful, a pointer is returned which identifies the next available character in outstr (past the result), and strindx points to the first unconvertible character in instr. A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _dec_to_form. If the formatted string would exceed width characters in length, NULL is returned, and outstr remains unchanged. outstr and instr may refer to the same buffer or to buffers which overlap in memory.

instr is expected to be in the following format:

[+|-][d...][.][d...][e[-]d[d...]] (where d denotes any decimal digit)

Numeric formatting options are specified in nflags and consist of plus sign, currency, thousands, and exponential format flags. The following symbolic constants (defined in DATACONV.H) may be bitwise ORed together to specify these options:

DC_NOPLUS (0x00) No plus sign is written if the value is positive.
DC_PLUS (0x10) A plus sign is written if the value is positive. The plus sign is written using the leading/trailing plus sign strings specified in the current data conversion options structure.
DC_NOCURRENCY (0x00) No currency symbol is inserted.
DC_CURRENCY (0x08) A currency symbol is inserted in the position specified in the current data conversion options structure.
DC_NOTHOUS (0x00) Thousands separators are not inserted.
DC_THOUS (0x04) Thousands separators are inserted. Separators appear only to the left of the decimal point.
DC_NOEXP (0x00) The result is written in non-exponential form. NULL is returned if the result exceeds width.
DC_EXP (0x01) The result is written in exponential form. NULL is returned if the result exceeds width.
DC_FLEX (0x02) The result is written in non-exponential form if possible and in exponential form if the non-exponential result would exceed width. If exponential form is used, the maximum possible number of digits are written to the right of the decimal point; NULL is returned if the exponential result would exceed width.

precision indicates the maximum or required number of digits (0 to 30) to the right of the decimal point in the resulting string. In addition, precision option flags may be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary.
DC_FILL (0x40) Forces precision characters to the right of the decimal point by replacing trailing zeros with the space character. If the decimal point is suppressed, it is also replaced with the space character. (Note that this inserts space characters between the mantissa and exponent in exponential format.)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

In addition, the following constant allows the precision of currency strings to be specified in a country-independent manner whether or not a currency symbol is written. This constant is used in place of the precision value specified in the precision parameter:

DC_CDIGITS (0x1F) Use the country-specific precision specified for currency in the current data conversion options structure.

width must be in the range 0 to 126. A width of 0 denotes "no limit" (which translates into the maximum internally supported width of at least 126 characters).

The current data conversion options structure specifies global formatting options such as sign indicator strings, thousands delimiter, decimal delimiter, currency symbol location, currency precision, exponent string, exponent sign suppression, minimum number of exponent digits, and zero suppression before the decimal point. These options may be accessed or modified through the dc_addr variable. (See dc_addr for further information.)

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this function.

WARNING! outstr must be large enough to hold the converted string or data following the buffer will be overwritten.

C/C++ Example
	{
	   char outstr[] = "                           is the\
	   	      formatted result.";
	   char *str;
	   char *strindx;
	   _dec_to_forme("10000000000000000.009", DC_THOUS+DC_CURRENCY,
	                  2, 80, outstr, &strindx);
	   _put_str(outstr);
	     /* "$10,000,000,000,000,000.01 is the formatted result." */
	   str = "             is the formatted result.";
	   dc.dc_expstr = "x10^";/* set exponent string */
	   dc.dc_leadplus = "+";/* set leading plus string */
	   _dec_to_forme("10000000000000000.009", 
	              DC_CURRENCY+DC_EXP+DC_PLUS, 2, 80, str, &strindx);
	   _put_str(outstr);
	      /* "+$1.00x10^16 is the formatted result." */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "                           is the\
	   	      formatted result.";
	   char instr[] = "10000000000000000.009";
	   char *str;
	   ...
	   mov al,DC_THOUS+DC_CURRENCY
	   mov ch,2	/* CH = precision */
	   mov cl,80	/* CL = maximum width */
	   lea di,instr/* DI = offset of outstr */
	   lea si,outstr/* SI = offset of instr */
	   dec_to_forme();    /* standard to format string */
	   lea si,outstr/* SI -> outstr */
	   put_str();
	   /*"$10,000,000,000,000,000.01 is the formatted result."*/
	   ...
	   str = "             is the formatted result.";
	   dc.dc_expstr = "x10^";
	   dc.dc_leadplus = "+";
	   mov al,DC_CURRENCY+DC_EXP+DC_PLUS
	   mov ch,2	/* CH = precision */
	   mov cl,80	/* CL = width */
	   lea di,instr/* DI = offset of instr */
	   mov si,str	/* SI = offset of str */
	   dec_to_forme();    /* standard to format string */
	   mov si,str	/* reset SI = offset of str */
	   put_str(); /* "+$1.00x10^16 is the formatted result" */
	   ...
	}

Source file _DCDFRME.ASM ASM equiv DEC_TO_FORME
See also
_dec_to_f, _fdec_to_form, _form_to_dec

_dec_to_i


Descrip
Converts a decimal ASCII string to an int.

Syntax
#include <dataconv.h>
int _dec_to_i(char *instr, char **strindx);

Returns
The int result (undefined if overflow, 0 if underflow).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to an int. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. If the conversion was successful, c_code = 0 and the int result is returned. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned. If overflow occurred (value < -32,768, orvalue > 32,767), c_code = 1, and the return value is undefined.

instr is expected to be in the following format:

[+|-][d...]d (where d denotes any decimal digit)

If instr contains other sign indicators, currency symbols, or thousands delimiters, _form_to_dec must be called before calling this function.

Note that unless overflow occurs (c_code = 1), strindx is always advanced past all consecutive digits in instr. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this function.

C/C++ Example
	{
	   int num;
	   char *strindx;
	   num = _dec_to_i("-32767", &strindx);
	   if (c_code == 0)
	   {
	      _put_str("\n\rConversion was successful.");
	      if (strindx[0] != NULL) {
	         _put_str("\n\rExcept these characters: ");
	         _put_str(strindx} 
	   }
	   else if (c_code == 1)
	      _put_str("\n\rConversion resulted in an overflow: ");
	   else
	      _put_str("\n\rConversion resulted in underflow: ");
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "32767";
	   int num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   num = dec_to_i();/* num = conversion result */
	    ja label_100/* overflow? */
	    jb label_200/* underflow? */
	   cmp byte ptr [si],0/* entire string converted? */
	    je label_300/*   y: finished 
	   ... some characters were not converted ...
	   jmp short label_300
	label_100:
	   ... overflow ...
	label_200:
	   ... underflow ...
	label_300:
	   ...
	}

Source file _DCDTOSI.ASM ASM equiv DEC_TO_WORDS
See also
_asc_to_i, _dec_to_c, _dec_to_l, _dec_to_q, _dec_to_ui

_dec_to_l


Descrip
Converts a decimal ASCII string to a long.

Syntax
#include <dataconv.h>
long _dec_to_l(char *instr, char **strindx);

Returns
The long result (0 if underflow).
strindx points to the first character in instr not converted
c_code 0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a long. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. If the conversion was successful, c_code = 0 and the long result is returned. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned.

instr is expected to be in the following format:

[+|-][d...]d (where d denotes any decimal digit)

If instr contains other sign indicators, currency symbols, or thousands delimiters, _form_to_dec must be called before calling this function.

Note that strindx is always advanced past all consecutive digits in instr. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this function.

C/C++ Example
	{
	   char *strindx;
	   long num;
	   num = _dec_to_l("2147483648", &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) { 
	            _put_str(" Except these characters: ");
	            _put_str(str}; break;
	      case -1: _put_str("\n\rConversion result in underflow."); 
	         break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "2147483648";
	   long num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   num = dec_to_l();/* num = conversion result */
	    jnelabel_100/* was conversion successful? */
	   cmp byte ptr [si],0/* entire string converted? */
	    je label_200/*   y: finished */
	   ... some characters were not converted ...
	   jmp short label_200
	label_100:
	   ... underflow ...
	label_200:
	   ...
	}

Source file _DCDTOSL.ASM ASM equiv DEC_TO_DWORDS
See also
_asc_to_l, _dec_to_c, _dec_to_i, _dec_to_q, _dec_to_ul

_dec_to_ld


Descrip
Converts an ASCII string to a long double.

Syntax
#include <dataconv.h>
long double _dec_to_ld(const char *instr, unsigned char precision, char **strindx);

Returns
The long double result (undefined if overflow, 0 if underflow).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a long double using the specified precision. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first unconvertible character in instr. If the conversion was successful, c_code = 0 and the long double result is returned. If overflow occurred (value < -1.19e4932, or value > 1.19e4932), c_code = 1 and the return value is undefined. If underflow occurred (-3.36-4932 < value < 3.36-4932) or no convertible digits were encountered, c_code = -1, and 0 is returned.

instr is expected to be in the following format:

[+|-][d...][.][d...][e[-]d[d...]] (where d denotes any decimal digit)

If instr contains other sign indicators, currency symbols, thousands delimiters, or exponential strings other than "e", _form_to_dec must be called before calling this function.

precision indicates the maximum number of digits (0 to 30) to the right of the decimal point in instr which will be included in the result. Rounding options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.

Note that strindx is always advanced past all digits to the right of the decimal point in instr, regardless of the value of precision. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL. Numeric underflow (-3.36-4932 < value < 3.36-4932) may be distinguished from field underflow (no convertible characters present) by comparing strindx == instr.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips prior to calling this function.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char *strindx;
	   long double num;
	   ...
	   num = _dec_to_ld("1.23e2555", 2+DC_ROUND, &strindx);
	   if (c_code != 0)
	      _put_str("overflow or underflow result");
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	char instr[] = "1.23e2555";
	long double num;
	...
	lea si,instr/* SI -> instr */
	lea di,num	 /* DI -> buffer for num */
	mov ch,2+DC_ROUND/* CH = precision + flags */
	dec_to_ld();	 /* "string" -> long double */
	 je label_010/* conversion successful? */
	...    	 /*   n: manage overflow cond. */
	label_010:
	...
	}

Source file _DCDECTL.ASM ASM equiv DEC_TO_TENB
See also
_dec_to_d, _dec_to_f, _ld_to_dec

_dec_to_q


Descrip
Converts a decimal ASCII string to a quad.

Syntax
#include <dataconv.h>
quadptr _dec_to_q(char *instr, quad num, char **strindx);

Returns
A pointer to num.
num the quad result (0 if underflow)
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a quad. Characters are processed from instr, one at a time, until an invalid character is encountered. A pointer to num is returned, and strindx points to the first character in instr not converted. If the conversion was successful, c_code = 0 and the quad result is returned in num. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned in num.

instr is expected to be in the following format:

[+|-][d...]d (where d denotes any decimal digit)

If instr contains other sign indicators, currency symbols, or thousands delimiters, _form_to_dec must be called before calling this function.

Note that strindx is always advanced past all consecutive digits in instr. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this routine.

C/C++ Example
	{
	   char *strindx;
	   uquad num;
	   ...
	   _dec_to_q("9000000000000000000", num, &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) { 
	            _put_str(" Except these characters: ");
	            _put_str(str}; break;
	      case -1: _put_str("\n\rConversion result in underflow.");
	         break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "9000000000000000000";
	   uquad num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   lea di,num	/* DI = offset of num */
	   dec_to_q();	/* was conversion successful? */
	    jnelabel_100/*   n: handle underflow */
	   cmp byte ptr [si],0/* entire string converted? */
	    je label_200/*   y: conversion complete */
	   ... some characters were not converted ...
	   jmp short label_200
	label_100:
	   ... underflow or error ...
	label_200:
	   ...
	}

Source file _DCDTOSQ.ASM ASM equiv DEC_TO_QWORDS
See also
_asc_to_q, _dec_to_c, _dec_to_i, _dec_to_l, _dec_to_uq

_dec_to_uc


Descrip
Converts a decimal ASCII string to an unsigned char.

Syntax
#include <dataconv.h>
unsigned char _dec_to_uc(char *instr, char **strindx);

Returns
The unsigned char result (undefined if overflow, 0 if underflow).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to an unsigned char. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. If the conversion was successful, c_code = 0 and the char result is returned. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned. If overflow occurred (value > 255), c_code = 1, and the return value is undefined.

Only decimal digits are considered valid characters. If instr contains currency symbols or thousands delimiters, _form_to_dec must be called before calling this function.

Note that unless overflow occurs (c_code = 1), strindx is always advanced past all consecutive digits in instr. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this function.

C/C++ Example
	{
	   unsigned char num;
	   ...
	   num = _dec_to_uc("255", &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) {
	            _put_str(" Except these characters: ");
	            _put_str(str}; break;
	      case  1: _put_str("\n\rConversion result in overflow.");
	         break;
	      case -1: _put_str("\n\rConversion result in underflow.");
	         break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "255";
	   unsigned char num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   num = dec_to_uc();/* num = conversion */
	    ja label_200/* overflow? */
	    jb label_100/* underflow? */ 
	   cmp byte ptr [si],0/* entire string processed? */
	    je label_300/*   y: conversion complete */
	   ... some characters were not processed ...
	   jmp short label_300	  
	label_100:
	   ... overflow ...
	label_200:
	   ... underflow ...
	label_300:
	   ...
	}

Source file _DCDTOC.ASM ASM equiv DEC_TO_BYTE
See also
_asc_to_uc, _dec_to_ui, _dec_to_ul, _dec_to_uq, _dec_to_c

_dec_to_ufixpi


Descrip
Converts a decimal ASCII string to a fixed-point unsigned int.

Syntax
#include <dataconv.h>
unsigned int _dec_to_ufixpi(const char *instr, unsigned char precision, char **strindx);

Returns
The fixed-point unsigned int result (undefined if overflow, 0 if underflow).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a fixed-point unsigned int using the specified precision. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first unconvertible character in instr. If the conversion was successful, c_code = 0 and the fixed-point unsigned int result is returned. If overflow occurred (value > 65535e-precision), c_code = 1 and the return value is undefined. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned.

instr is expected to be in the following format:

[d...][.][d...] (where d denotes any decimal digit)

If instr contains currency symbols or thousands delimiters, _form_to_dec must be called before calling this function.

precision indicates the maximum number of digits (0 to 30) to the right of the decimal point in instr which will be included in the result. Rounding options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.

Note that unless overflow occurs (c_code = 1), strindx is always advanced past all digits to the right of the decimal point in instr, regardless of the value of precision. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips prior to calling this function.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char *strindx;
	   unsigned num;
	   ...
	   num = _dec_to_ufixpi("655.35", 2, &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	               if (strindx[0] != NULL) {
	                  _put_str(" Except these characters: ");
	                  _put_str(str}; break;
	      case -1: _put_str("\n\rConversion resulted in underflow.");
	                  break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "655.35";
	   unsigned num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   mov ch,2	/* CH = precision */
	   num = dec_to_ufixpi();/* "string" -> fixed-point int */
	   ...
	}

Source file _DCDCFXI.ASM ASM equiv DEC_TO_FIXPW
See also
_dec_to_f, _dec_to_ufixpl, _dec_to_ufixpq, _ufixpi_to_dec

_dec_to_ufixpl


Descrip
Converts a decimal ASCII string to a fixed-point unsigned long.

Syntax
#include <dataconv.h>
unsigned long _dec_to_ufixpl(const char *instr, unsigned char precision, char **strindx);
Returns
The fixed-point unsigned long result (0 if underflow).
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a fixed-point unsigned long using the specified precision. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first unconvertible character in instr. If the conversion was successful, c_code = 0 and the fixed-point unsigned long result is returned. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned.

instr is expected to be in the following format:

[d...][.][d...] (where d denotes any decimal digit)

If instr contains currency symbols or thousands delimiters, _form_to_dec must be called before calling this function.

precision indicates the maximum number of digits (0 to 30) to the right of the decimal point in instr which will be included in the result. Rounding options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.

Note that strindx is always advanced past all digits to the right of the decimal point in instr, regardless of the value of precision. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips prior to calling this function.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char *strindx;
	   unsigned long num;
	   num = _dec_to_ufixpl("21474836.48", 2, &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	               if (strindx[0] != NULL) {
	                  _put_str(" Except these characters: ");
	                  _put_str(str}; break;
	      case -1: _put_str("\n\rConversion resulted in underflow.");
	               break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	}
	   char instr[] = "21474836.48";
	   unsigned long num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   mov ch,2	/* CH = precision */
	   num = dec_to_ufixpl();/* "string" -> fixp long */
	   ...
	}

Source file _DCDCFXL.ASM ASM equiv DEC_TO_FIXPDW
See also
_dec_to_f, _dec_to_ufixpi, _dec_to_ufixpq, _ufixpl_to_dec

_dec_to_ufixpq


Descrip
Converts a decimal ASCII string to a fixed-point uquad.

Syntax
#include <dataconv.h>
quadptr _dec_to_ufixpq(char *instr, unsigned char precision, uquad num, char **strindx);

Returns
A pointer to num.
num the uquad result (0 if underflow)
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a fixed-point uquad (unsigned quad) using the specified precision. Characters are processed from instr, one at a time, until an invalid character is encountered. A pointer to num is returned, and strindx points to the first unconvertible character in instr. If the conversion was successful, c_code = 0 and the fixed-point uquad result is returned in num. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned in num.

instr is expected to be in the following format:

[d...][.][d...] (where d denotes any decimal digit)

If instr contains currency symbols or thousands delimiters, _form_to_dec must be called before calling this function.

precision indicates the maximum number of digits (0 to 30) to the right of the decimal point in instr which will be included in the result. Rounding options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.

Note that strindx is always advanced past all digits to the right of the decimal point in instr, regardless of the value of precision. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips prior to calling this function.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[40], *strindx;
	   uquad num;
	   ...
	   _dec_to_ufixpq("18446744073709551615", 0, num, &strindx);
	   _put_str(_ufixpq_to_dec(2, num, outstr));
	   	  	 	/* "184467440737095516.15" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[40], instr[] = "18446744073709551615";
	   uquad num;
	...
	lea di,num	 /* DI -> num */
	lea si,instr/* SI -> outstr */
	xor ch,ch	 /* read with precision of 0 */
	dec_to_ufixpq();/*"string" -> fixed-point quad */
	lea si,outstr/* reset SI -> outstr */
	mov ch,2	 /* CH = precision */
	ufixpq_to_dec();/* fixed-point -> "string" */
	put_str();	 /* "184467440737095516.15" */
	...
	}

Source file _DCDCFXQ.ASM ASM equiv DEC_TO_FIXPQW
See also
_fixpq_to_dec, _dec_to_ufixpi, _dec_to_ufixpl, _ufixpq_to_dec

_dec_to_ui


Descrip
Converts a decimal ASCII string to an unsigned int.

Syntax
#include <dataconv.h>
unsigned int _dec_to_ui(char *instr, char **strindx);

Returns
The unsigned int result (undefined if overflow, 0 if underflow).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to an unsigned int. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. If the conversion was successful, c_code = 0 and the unsigned int result is returned. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned. If overflow occurred (value > 65,535), c_code = 1, and the return value is undefined.

Only decimal digits are considered valid characters. If instr contains currency symbols or thousands delimiters, _form_to_dec must be called before calling this function.

Note that unless overflow occurs (c_code = 1), strindx is always advanced past all consecutive digits in instr. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this function.

C/C++ Example
	{
	   char *strindx;
	   unsigned int num;
	   ...
	   num = _dec_to_ui("65000", &strindx);
	   switch (c_code)
	   {
	      case 0:_put_str("\n\rSuccess.");
	         if (strindx[0] != NULL) {
	            _put_str(" Except these characters: ");
	            _put_str(stri}; break;
	      case  1:_put_str("\n\rOverflow!"); break;
	      case -1:_put_str("\n\rUnderflow!"); break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "65000";
	   unsigned int num;
	...
	lea si,instr/* SI = offset of instr */
	num = dec_to_ui();/* "string" -> num */
	 ja label_100/* overflow? */
	 jb label_200/* underflow? */
	cmp byte ptr [si],0/* entire string converted? */
	 je label_300/*   y: conversion complete */
	... some characters were not converted ...
	jmp short conv_300
	label_100:
	... overflow ...
	conv_200:
	... underflow ...
	conv_300:
	...
	}

Source file _DCDTOI.ASM ASM equiv DEC_TO_WORD
See also
_asc_to_ui, _dec_to_uc, _dec_to_ul, _dec_to_uq, _dec_to_l

_dec_to_ul


Descrip
Converts a decimal ASCII string to an unsigned long.

Syntax
#include <dataconv.h>
unsigned long _dec_to_ul(char *instr, char **strindx);

Returns
The unsigned long result (0 if underflow).
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to an unsigned long. Characters are processed from instr, one at a time, until an invalid character is encountered. On return, strindx points to the first character in instr not converted. If the conversion was successful, c_code = 0 and the unsigned long result is returned. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned.

instr is expected to be in the following format:

[d...]d (where d denotes any decimal digit)

If instr contains currency symbols or thousands delimiters, _form_to_dec must be called before calling this function.

Note that strindx is always advanced past all consecutive digits in instr. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this function.

C/C++ Example
	{
	   char *strindx;
	   unsigned long num;
	   ...
	   num = _dec_to_ul("1000000000", &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) { 
	            _put_str(" Except these characters: ");
	            _put_str(str}; break;
	      case -1: _put_str("\n\rConversion result in underflow.");
	         break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "4294967296";
	   unsigned long num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   num = dec_to_ul();/* num = conversion result  */
	    jnelabel_100/* is conversion successful? */ 
	   cmp byte ptr [si],0/* entire string converted? */
	    je label_200/*   y: conversion complete */
	   ... some characters were not converted ...
	   jmp short label_200
	label_100:
	   ... underflow or error ...
	label_200:
	   ...
	}

Source file _DCDTOL.ASM ASM equiv DEC_TO_DWORD
See also
_asc_to_ul, _dec_to_uc, _dec_to_ui, _dec_to_uq, _dec_to_l

_dec_to_uq


Descrip
Converts a decimal ASCII string to a uquad.

Syntax
#include <dataconv.h>
quadptr _dec_to_uq(char *instr, uquad num, char **strindx);

Returns
A pointer to num.
num the uquad result (0 if underflow)
strindx points to the first character in instr not converted
c_code0 = successful, -1 = underflow

Notes
This function converts characters from a decimal ASCIIZ string to a uquad (unsigned quad). Characters are processed from instr, one at a time, until an invalid character is encountered. A pointer to num is returned, and strindx points to the first character in instr not converted. If the conversion was successful, c_code = 0 and the uquad result is returned in num. If underflow occurred (no convertible digits were encountered), c_code = -1, and 0 is returned in num.

Only decimal digits are considered valid characters. If instr contains currency symbols or thousands delimiters, _form_to_dec must be called before calling this function.

Note that strindx is always advanced past all consecutive digits in instr. The number of string characters processed by this function may be determined by subtracting instr from strindx. To determine if all characters were processed, compare strindx[0] == NULL.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips just prior to calling this routine.

C/C++ Example
	{
	   char *strindx;
	   uquad num;
	   ...
	   _dec_to_uq("18000000000000000000", num, &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) { 
	            _put_str(" Except these characters: ");
	            _put_str(str}; break;
	      case -1: _put_str("\n\rConversion result in underflow.");
	         break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "18000000000000000000";
	   uquad num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   lea di,num	/* DI = offset of num */
	   dec_to_uq();	/* was conversion successful? */
	    jnelabel_100/*   n: handle underflow */
	   cmp byte ptr [si],0/* entire string converted? */
	    je label_300/*   y: conversion complete */
	   ... some characters were not converted ...
	   jmp short label_300
	label_100:
	   ... underflow or error ...
	label_300:
	   ...
	}

Source file _DCDTOQ.ASM ASM equiv DEC_TO_QWORD
See also
_asc_to_uq, _dec_to_uc, _dec_to_ui, _dec_to_ui, _dec_to_q

_d_to_dec


Descrip
Converts a double to a decimal ASCIIZ string in standard exponential format.

Syntax
#include <dataconv.h>
char *_d_to_dec(double *num, unsigned char precision, char *outstr);

Returns
A pointer to outstr.
outstr decimal ASCIIZ representation of num in standard exponential format

Notes
This function converts num to an ASCIIZ string in standard exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point. A pointer is returned to the result in outstr.

Standard exponential format is defined as follows:

[-]d[.][d...]e[-]d[d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char outstr[80];
	   double num = 1.23e255;
	   ...
	   _put_str(_d_to_dec(&num, 5+DC_TRUNC, outstr));
		   	 /* "1.23000e255" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[80];
	   double num = 1.23e25;
	   lea si,outstr/* SI = offset of outstr */
	   lea di,num	/* DI = offset of num */
	   mov ch,5+DC_FLOAT/* CH = precision + float */
	   d_to_dec();	/* double -> "string" */
	   put_str();	/* "1.23e25" */
	}

Source file _DFDTDEC.ASM ASM equiv LONG_TO_DEC
See also
_dec_to_d, _d_to_dec, _d_to_dec, _f_to_dec, _ld_to_dec

_d_to_dece


Descrip
Converts a double to a decimal ASCII string in standard exponential format, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_d_to_dece(double *num, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character in outstr.
outstr decimal ASCII representation of num in standard exponential format

Notes
This function converts num to an ASCII string in standard exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point and is not NULL terminated. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _d_to_dec.

Standard exponential format is defined as follows:

[-]d[.][d...]e[-]d[d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char outstr[] = "            is the result.";
	   double num = 1.23e255;
	   ...
	   _d_to_dece(&num, 5+DC_ROUND, outstr);
	   _put_str(outstr);/* "1.23000e255 is the result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "         is the result.";
	   double num = 1.23e255;
	   lea si,outstr/* SI = offset of outstr */
	   lea di,num	/* DI -> num */
	   mov ch,5+DC_FLOAT/* CH = precision + float */
	   d_to_dece();	/* double -> "string" */
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str();	/* "1.23e255 is the result" */
	}

Source file _DFDTDCE.ASM ASM equiv LONG_TO_DECE
See also
_dec_to_d, _d_to_dec, _d_to_dec, _f_to_dec, _ld_to_dec

_d_to_decn


Descrip
Converts a double to a decimal ASCIIZ string in standard non-exponential format.

Syntax
#include <dataconv.h>
char *_d_to_decn(double *num, unsigned char precision, char *outstr);

Returns
A pointer to outstr.
outstr decimal ASCIIZ representation of num in standard non-exponential format

Notes
This function converts num to an ASCIIZ string in standard non-exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point. A pointer is returned to the result in outstr.

Standard non-exponential format is defined as follows:

[-][d...]d[.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

Source file _DFDTDCN.ASM ASM equiv LONG_TO_DECN
See also
_dec_to_d, _d_to_dec, _d_to_dec, _f_to_dec, _ld_to_dec

_d_to_decne


Descrip
Converts a double to a decimal ASCII string in standard non-exponential format, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_d_to_decne(double *num, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character in outstr.
outstr decimal ASCII representation of num in standard non-exponential format
Notes
This function converts num to an ASCII string in standard non-exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point and is not NULL terminated. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _d_to_decn.

Standard non-exponential format is defined as follows:

[-][d...]d[.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC(0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char outstr[] = "             is the result.";
	   double num = 1.23e5;
	   ...
	   _d_to_decne(&num, 5, outstr);
	   _put_str(outstr);/*"123000.00000 is the result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[50] = "       is the result.";
	   double num = 1.23e5;
	   lea si,outstr/* SI -> outstr */
	   lea di,num	/* DI -> num */
	   xor ch,ch	/* CH = precision + float */
	   d_to_decne();	/* double -> "string" */
	   lea si,outstr/* reset SI -> outstr */
	   put_str();/* outstr = "123000 is the result." */
	}

Source file _DFDDCNE.ASM ASM equiv LONG_TO_DECNE
See also
_dec_to_d, _d_to_dec, _d_to_dec, _f_to_dec, _ld_to_dec

_fdec_to_form


Descrip
Converts a standard decimal ASCII string to a formatted decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char far *_fdec_to_form(const char far *instr, unsigned char nflags, unsigned char precision, unsigned char width, char far *outstr, char far * far *strindx);

Returns
A pointer to outstr.
outstr the formatted decimal ASCIIZ representation of instr
strindx points to first character in instr not converted

NULL if the length of the converted string would exceed width.

Notes
See _dec_to_form.

Source file _DCFDFRM.ASM ASM equiv DEC_TO_FORM

_fdec_to_forme


Descrip
Converts a standard decimal ASCII string to a formatted decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char far *_fdec_to_forme(const char far *instr, unsigned char nflags, unsigned char precision, unsigned char width, char far *outstr, char far * far *strindx);

Returns
A pointer to the character after the last converted character written to outstr.
outstr the formatted decimal ASCII representation of instr
strindx points to the first character in instr not converted

NULL if the length of the converted string would exceed width.

Notes
See _dec_to_forme.

Source file _DCFDFME.ASM ASM equiv DEC_TO_FORME

_fform_to_dec


Descrip
Converts a formatted decimal ASCII string to a decimal ASCIIZ string in standard format.
Syntax
#include <dataconv.h>
char far *_fform_to_dec(const char far *instr, unsigned char nflags, unsigned char precision, unsigned char width, char far *outstr, char far * far *strindx);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of instr in standard format
strindx points to first character in instr not converted

NULL if the length of the resulting string would exceed width.

Notes
See _form_to_dec.

Source file _DCFFRMD.ASM ASM equiv FORM_TO_DEC

_fform_to_dece


Descrip
Converts a formatted decimal ASCII string to a decimal ASCII string in standard format, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char far *_fform_to_dece(const char far *instr, unsigned char nflags, unsigned char precision, unsigned char width, char far *outstr, char far * far *strindx);

Returns
A pointer to the character after the last converted character in outstr.
outstr the decimal ASCII representation of instr in standard format
strindx points to first character in instr not converted

NULL if the length of the resulting string would exceed width.

Notes
See _form_to_dece.

Source file _DCFFRME.ASM ASM equiv FORM_TO_DECE

_fixpi_to_dec


Descrip
Converts a fixed-point int to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_fixpi_to_dec(int fixint, unsigned char precision, char *outstr);

Returns
A pointer to outstr.
outstr the fixed-point decimal ASCIIZ representation of fixint

Notes
This function converts a fixed-point int to a decimal ASCIIZ string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., the integer value of fixint has an implied exponent of þprecision or a value of fixintþ10þprecision). A pointer is returned to the result in outstr. The result is written in the following format:

[-][d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[10];
	   ...
	   _put_str(_fixpi_to_dec(10000, 2, outstr)); /* "100.00" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[20];
	   ...
	   mov ax,10000/* AX = 100000 */
	   mov ch,2	/* CH = precision of 2 */
	   lea si,outstr/* SI = offset of outstr */
	   fixpi_to_dec();    /* int -> string */
	   put_str();	/* "100.00" */
	   ...
	}

Source file _DCSXIDC.ASM ASM equiv FIXPWS_TO_DEC
See also
_dec_to_f, _fixpi_to_dec, _fixpl_to_dec, _fixpq_to_dec, _ufixpi_to_dec

_fixpi_to_dece


Descrip
Converts a fixed-point int to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_fixpi_to_dece(unsigned int fixint, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character written to outstr.
outstr the fixed-point decimal ASCII representation of fixint

Notes
This function converts a fixed-point int to a decimal ASCII string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., the integer value of fixint has an implied exponent of þprecision or a value of fixintþ10þprecision). The returned pointer identifies the next available position in outstr (past the result). The result is not NULL terminated and is written in the following format:

[-][d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[] = "       is the result.";
	   ...
	   _fixpi_to_dece(10000, 2, outstr);
	   _put_str(outstr);/* "100.00 is the result." */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "       is the result.";
	   ...
	   mov ax,10000/* AX = 10000 */
	   mov ch,2	/* CH = precision */
	   lea si,outstr/* SI = offset of outstr */
	   fixpi_to_dece();/* int -> "string" */
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str();	/* "100.00 is the result." */
	   ...
	}

Source file _DCSXIDE.ASM ASM equiv FIXPWS_TO_DECE
See also
_dec_to_f, _fixpi_to_dec, _fixpl_to_dec, _fixpq_to_dece, _ufixpi_to_dec

_fixpl_to_dec


Descrip
Converts a fixed-point long to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_fixpl_to_dec(long fixlong, unsigned char precision, char *outstr);

Returns
A pointer to outstr.
outstr the fixed-point decimal ASCIIZ representation of fixlong

Notes
This function converts a fixed-point long to a decimal ASCIIZ string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., the integer value of fixlong has an implied exponent of þprecision or a value of fixlongþ10þprecision). A pointer is returned to the result in outstr. The result is written in the following format:

[-][d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[20];
	   ...
	   _put_str(_fixpl_to_dec(2147483647, 2, outstr));

	   	  	 /* "21474836.47" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	  char outstr[20];
	   ...
	   mov ax,0xFFFF
	   mov dx,0x7FFF/* DX;AX = 2147483647 */
	   mov ch,2	/* CH = precision */
	   lea si,outstr/* SI = offset of outstr */
	   fixpl_to_dec();    /* fixed-pt long -> "string" */
	   put_str();	/* "21474836.47" */
	   ...
	}

Source file _DCSXLDC.ASM ASM equiv FIXPDWS_TO_DEC
See also
_dec_to_f, _fixpi_to_dec, _fixpl_to_dec, _fixpq_to_dec, _ufixpl_to_dec

_fixpl_to_dece


Descrip
Converts a fixed-point long to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_fixpl_to_dece(long fixlong, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character written to outstr.
outstr the fixed-point decimal ASCII representation of fixlong

Notes
This function converts a fixed-point long to a decimal ASCII string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., the integer value of fixlong has an implied exponent of þprecision or a value of fixlongþ10þprecision). The returned pointer identifies the next available position in outstr (past the result). The result is not NULL terminated and is written in the following format:

[-][d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[] = "            is the result.";
	   ...
	   _fixpl_to_dece(2147483647, 2, outstr);
	   _put_str(outstr);/* "21474836.47 is the result." */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[50] = "            is the result.";
	...
	mov ax,0xFFFF
	mov dx,0x7FFF/* DX;AX = 2147483647 */
	mov ch,2	 /* CH = precision */
	lea si,outstr/* SI = offset of outstr */
	fixpl_to_dece();/* fixed-pt long -> "string" */
	lea si,outstr/* reset SI = offset of outstr */
	put_str();	 /* "21474836.47 is the result."*/
	...
	}

Source file _DCSXLDE.ASM ASM equiv FIXPDWS_TO_DECE
See also
_dec_to_f, _fixpi_to_dec, _fixpl_to_dec, _fixpq_to_dec, _ufixpl_to_dec

fixpq_to_dec


Descrip
Converts a fixed-point quad to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *fixpq_to_dec(quad fixquad, unsigned char precision, char *outstr);

Returns
A pointer to outstr.
outstr the fixed-point decimal ASCIIZ representation of fixquad

Notes
This function converts a fixed-point quad to a decimal ASCIIZ string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., the integer value of fixquad has an implied exponent of þprecision or a value of fixquadþ10þprecision). A pointer is returned to the result in outstr. The result is written in the following format:

[-][d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[40];
	   char *strindx;
	   quad num;
	   ...
	   _dec_to_fixpq(3,"10000000000000.000",num,&strindx);
	   _put_str(_fixpq_to_dec(2, num, outstr));
	   	  	 	/* "10000000000000000.00" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[25];
	   char instr[] = "1000000000000000000";
	   quad num;
	...
	lea di,num	 /* DI = offset of quad */
	lea si,instr/* SI = offset of instr */
	xor ch,ch	 /* read with precision of 0 */
	dec_to_fixpq();	/* "string" -> fixed-pt quad */
	lea si,outstr/* reset SI = offset of outstr */
	mov ch,2	 /* CH = precision */
	fixpq_to_dec();	/* quad -> "string" */
	put_str();	 /* "1000000000000000000.00" */
	...
	}

Source file _DCSXQDC.ASM ASM equiv FIXPQWS_TO_DEC
See also
_dec_to_f, _fixpi_to_dec, _fixpl_to_dec, _fixpq_to_dece, _ufixpq_to_dec

fixpq_to_dece


Descrip
Converts a fixed-point quad to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *fixpq_to_dece(quad fixquad, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character written to outstr.
outstr the fixed-point decimal ASCII representation of fixquad

Notes
This function converts a fixed-point quad to a decimal ASCII string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., the integer value of fixquad has an implied exponent of þprecision or a value of fixquadþ10þprecision). The returned pointer identifies the next available position in outstr (past the result). The result is not NULL terminated and is written in the following format:

[-][d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[]= "                     is the result.";
	   char *strindx;
	   quad num;
	   _dec_to_fixpq(0,"1000000000000000000",num, &strindx);
	   _fixpq_to_dece(2, num, outstr);
	   _put_str(outstr);    /*"10000000000000000.00 is the result."*/
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "                     is the result.";
	   char instr[] = "1000000000000000000";
	   quad num;
	   ...
	   lea di,num	/* DI = offset of quad */
	   lea si,instr/* SI = offset of instr */
	   xor ch,ch	/* read with precision of 0 */
	   dec_to_fixpq();    /* "string" -> fixed-pt quad */
	   lea si,outstr/* reset SI = offset of outstr */
	   mov ch,2	/* CH = precision */
	   fixpq_to_dece();/* quad -> "string..." */
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str();    /* "10000000000000000.00 is the result." */
	   ...
	}

Source file _DCSXQDE.ASM ASM equiv FIXPQWS_TO_DECE
See also
_dec_to_f, _fixpi_to_dec, _fixpl_to_dec, _fixpq_to_dec, _ufixpq_to_dec

_form_to_dec


Descrip
Converts a formatted decimal ASCII string to a decimal ASCIIZ string in standard format.

Syntax
#include <dataconv.h>
char *_form_to_dec(const char *instr, unsigned char nflags, unsigned char precision, unsigned char width, char *outstr, char **strindx);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of instr in standard format
strindx points to first character in instr not converted
NULL if the length of the converted string would exceed width.

Notes
This function converts a formatted decimal ASCII string to a decimal ASCIIZ string in standard exponential or non-
exponential format. Characters are processed and converted from instr, one at a time, until an invalid character is encountered. The resulting string contains no more than precision digits to the right of the decimal point. The expected format of instr is specified in nflags as well as the current data conversion options structure. If the conversion was successful, a pointer to outstr is returned and strindx points to the first unconvertible character in instr. If the formatted string would exceed width characters in length (excluding the terminal NULL character), NULL is returned, and outstr remains unchanged. outstr and instr may refer to the same buffer or to buffers which overlap in memory.

outstr is written in the following format:

[-][d...][.][d...][e[-]d[d...]] (where d denotes any decimal digit)

outstr includes an exponent only if instr contains an exponent and exponential format is specified in nflags.

Numeric formatting options are specified in nflags and consist of plus sign, currency, thousands, and exponential format flags. These flags determine the allowed format of instr. The following symbolic constants (defined in DATACONV.H) may be bitwise ORed together to specify these options:

DC_NOPLUS (0x00) No plus sign indicator strings are allowed in instr.
DC_PLUS (0x10) Leading/trailing plus sign strings are checked for and removed if present. These strings are defined in the current dcopts structure.
DC_NOCURRENCY(0x00) No currency symbol is allowed.
DC_CURRENCY (0x08) A currency symbol is checked for and removed if present. The currency symbol and location are specified in the current dcopts structure.
DC_NOTHOUS (0x00) Thousands separators are not allowed.
DC_THOUS (0x04) Thousands separators are checked for and removed if present. Separators may appear only to the left of the decimal point. The separator character is defined in the current dcopts structure.
DC_NOEXP (0x00) Exponential format is specifically disallowed. If an exponential number is read, only the mantissa is converted (the exponent is ignored). The result is written in standard non-exponential format.
DC_EXP (0x01) Exponential format is allowed. The exponent string for instr is specified in the current dcopts structure. outstr is written in standard exponential format if instr includes an exponent; otherwise, it is written in standard non-exponential format.
DC_FLEX (0x02) Exponential format is allowed. This flag is treated exactly like DC_EXP.

precision indicates the maximum number of digits (0 to 30) to the right of the decimal point in the resulting string. (The actual number of digits written is the lesser of precision or the actual number of digits present in instr.) In addition, precision option flags may be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated, if required.
DC_FILL (0x40) Indicates that instr may be padded with space characters between the mantissa and exponent, so trailing space characters after the mantissa are skipped.

Other precision flags (i.e., DC_FIX and DC_FLOAT) are ignored.

In addition, the following constant allows the precision of currency strings to be specified in a country-independent manner whether or not a currency symbol is written. This constant is used in place of the precision value specified in the precision parameter:

DC_CDIGITS (0x1F) Use the country-specific precision specified for currency in the current data conversion options structure.

width must be in the range 0 to 126. A width of 0 denotes "no limit" (which translates into the maximum internally supported width of at least 126 characters).

The current data conversion options structure specifies global formatting options such as plus/ minus sign indicator strings, thousands delimiter, decimal delimiter, currency symbol location, currency precision, exponent string, exponent sign suppression, minimum number of exponent digits, and zero suppression before the decimal point. These options may be accessed or modified through the dc_addr variable. (See dc_addr for further information.)

No skipping of white space is performed (except in connection with the DC_FILL precision flag). To skip leading white space, call _str_skipw or _str_skips just prior to calling this function.

C/C++ Example
	{
	   char outstr[80];
	   char **strindx;
	   ...
	   _put_str(_form_to_dec("$10,000,000,000,000,000.019",
	            DC_THOUS+DC_CURRENCY, 2, 80, outstr, &strindx));
	                 /* "10000000000000000.01" */
	   ...
	   _form_to_dec("+$1.00x10^16", DC_CURRENCY+DC_EXP+DC_PLUS, 2,
	                80, outstr,&strindx);
	   _put_str(outstr);        /* "1.00e16" */
	   ...
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[80];
	   char *instr;
	   ...
	   instr = "$10,000,000,000,000,000.01";
	   mov al,DC_CURRENCY+DC_THOUS/* AL = nflags */
	   mov ch,2	    /* CH = precision */
	   mov cl,80	    /* CL = width */
	   lea si,outstr    /* SI -> output string */
	   mov di,instr    /* DI -> input string */
	   form_to_dec();	/* convert to standard string */
	   put_str();	/* "10000000000000000.01" */
	   ...
	   instr = "$1.00x10^16";
	   mov al,DC_CURRENCY+DC_EXP
	   mov ch,2	/* CH = precision of 2 */
	   mov cl,80	/* CL = width of 80 */
	   lea si,outstr/* SI -> output string */
	   mov di,instr/* DI -> input string */
	   form_to_dec();	/* convert to standard string */
	   put_str();	/* "1.00e16" */
	   ...
	}

Source file _DCFRMDC.ASM ASM equiv FORM_TO_DEC
See also
_dec_to_f, _fform_to_dec, _form_to_dec

_form_to_dece


Descrip
Converts a formatted decimal ASCII string to a decimal ASCII string in standard format, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_form_to_dece(const char *instr, unsigned char nflags, unsigned char precision, unsigned char width, char *outstr, char **strindx);

Returns
A pointer to the character after the last converted character in outstr.
outstr the decimal ASCII representation of instr in standard format
strindx points to first character in instr not converted

NULL if the length of the resulting string would exceed width.

Notes
This function converts a formatted decimal ASCII string to a decimal ASCII string in standard exponential or non-
exponential format. Characters are processed and converted from instr, one at a time, until an invalid character is encountered. The resulting string contains no more than precision digits to the right of the decimal point. The expected format of instr is specified in nflags as well as the current data conversion options structure. If the conversion was successful, a pointer is returned which indicates the next available character in outstr (past the result), and strindx points to the first unconvertible character in instr. A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _form_to_dec. If the formatted string would exceed width characters in length, NULL is returned, and outstr remains unchanged. outstr and instr may refer to the same buffer or to buffers which overlap in memory.

outstr is written in the following format:

[-][d...][.][d...][e[-]d[d...]] (where d denotes any decimal digit)

outstr includes an exponent only if instr contains an exponent and exponential format is specified in nflags.

Numeric formatting options are specified in nflags and consist of plus sign, currency, thousands, and exponential format flags. These flags determine the allowed format of instr. The following symbolic constants (defined in DATACONV.H) may be bitwise ORed together to specify these options:

DC_NOPLUS (0x00) No plus sign indicator strings are allowed in instr.
DC_PLUS (0x10) Leading/trailing plus sign strings are checked for and removed if present. These strings are defined in the current dcopts structure.
DC_NOCURRENCY(0x00) No currency symbol is allowed.
DC_CURRENCY (0x08) A currency symbol is checked for and removed if present. The currency symbol and location are specified in the current dcopts structure.
DC_NOTHOUS (0x00) Thousands separators are not allowed.
DC_THOUS (0x04) Thousands separators are checked for and removed if present. Separators may appear only to the left of the decimal point. The separator character is defined in the current dcopts structure.
DC_NOEXP (0x00) Exponential format is specifically disallowed. If an exponential number is read, only the mantissa is converted (the exponent is ignored). The result is written in standard non-exponential format.
DC_EXP (0x01) Exponential format is allowed. The exponent string for instr is specified in the current dcopts structure. outstr is written in standard exponential format if instr includes an exponent; otherwise, it is written in standard non-exponential format.
DC_FLEX (0x02) Exponential format is allowed. This flag is treated exactly like DC_EXP.

precision indicates the maximum number of digits (0 to 30) to the right of the decimal point in the resulting string. (The actual number of digits written is the lesser of precision or the actual number of digits present in instr.) In addition, precision option flags may be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated, if required.
DC_FILL (0x40) Indicates that instr may be padded with space characters between the mantissa and exponent, so trailing space characters after the mantissa are skipped.

Other precision flags (i.e., DC_FIX and DC_FLOAT) are ignored.

In addition, the following constant allows the precision of currency strings to be specified in a country-independent manner whether or not a currency symbol is written. This constant is used in place of the precision value specified in the precision parameter:

DC_CDIGITS (0x1F) Use the country-specific precision specified for currency in the current data conversion options structure.

width must be in the range 0 to 126. A width of 0 denotes "no limit" (which translates into the maximum internally supported width of at least 126 characters).

The current data conversion options structure specifies global formatting options such as plus/ minus sign indicator strings, thousands delimiter, decimal delimiter, currency symbol location, currency precision, exponent string, exponent sign suppression, minimum number of exponent digits, and zero suppression before the decimal point. These options may be accessed or modified through the dc_addr variable. (See dc_addr for further information.)

No skipping of white space is performed (except in connection with the DC_FILL precision flag). To skip leading white space, call _str_skipw or _str_skips just prior to calling this function.

C/C++ Example
	{
	   char *outstr;
	   char *strindx;
	   outstr = "                     is the standard result.";
	   ...
	   _form_to_dece("$10,000,000,000,000,000.01",
	                  DC_CURRENCY+DC_THOUS, 2, 80, outstr,&strindx);
	   _put_str(outstr);
	              /*"10000000000000000.01 is the standard result."*/
	   ...
	   outstr = "        is the standard result.";
	   dc.dc_expstr = "x10^";/* set exponent string */
	   dc.dc_leadplus = "+";/* set leading plus string */
	   _form_to_dece("+$1.00x10^16",DC_CURRENCY+DC_EXP+DC_PLUS, 2,
	                  80, outstr, &strindx);
	   _put_str(outstr);/* "1.00e16 is the standard result." */	  
	   ...
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char *instr, *outstr;
	   ...
	   outstr = "                     is the standard result."; 
	   instr = "$10,000,000,000,000,000.01";
	   mov al,DC_THOUS+DC_CURRENCY
	   mov ch,2	/* CH = precision */
	   mov cl,80	/* CL = max chars to process */
	   mov di,instr/* DI -> instr */
	   mov si,outstr/* SI -> outstr */
	   form_to_dece();    /* standard to format string */
	   mov si,outstr/* reset SI -> outstr */
	   put_str();
	      /*"$10,000,000,000,000,000.01 is the formatted result."*/
	   ...
	   outstr = "        is the standard result.";
	   dc.dc_expstr = "x10^";
	   dc.dc_leadplus = "+";
	   instr = "+$1.00x10^16";
	   mov al,DC_CURRENCY+DC_EXP+DC_PLUS
	   mov ch,2	/* CH = precision */
	   mov cl,80	/* CL = width */
	   mov di,instr/* DI -> instr */
	   mov si,outstr/* SI -> outstr */
	   form_to_dece();    /* standard to format string */
	   mov si,outstr/* reset SI -> outstr */
	   put_str();/* "1.00e16 is the standard result." */
	   ...
	}

Source file _DCFRMDE.ASM ASM equiv FORM_TO_DECE
See also
_dec_to_f, _fform_to_dec, _form_to_dec

_f_to_dec


Descrip
Converts a float to a decimal ASCIIZ string in standard exponential format.

Syntax
#include <dataconv.h>
char *_f_to_dec(float *num, unsigned char precision, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of num in standard exponential format

Notes
This function converts num to an ASCIIZ string in standard exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point. A pointer is returned to the result in outstr.

Standard exponential format is defined as follows:

[-]d[.][d...]e[-]d[d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char outstr[80];
	   float num = 1.23e25;
	   ...
	   _put_str(_f_to_dec(&num, 5+DC_TRUNC, outstr));
	   	  	 	/* "1.23000e25" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{  	  
	   char outstr[80];
	   float num = 1.23e25;
	   lea si,outstr/* SI = offset of outstr */
	   lea di,num	/* DI = offset of num */
	   mov ch,5+DC_FLOAT/* CH = precision + float */
	   f_to_dec();	/* float -> "string" */
	   put_str();	/* "1.23e25" */
	}

Source file _DFFTDEC.ASM ASM equiv SHORT_TO_DEC
See also
_dec_to_f, _d_to_dec, _f_to_dec, _f_to_dec, _ld_to_dec

_f_to_dece


Descrip
Converts a float to a decimal ASCII string in standard exponential format, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_f_to_dece(float *num, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character in outstr.
outstr the decimal ASCII representation of num in standard exponential format

Notes
This function converts num to an ASCII string in standard exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point and is not NULL terminated. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _f_to_dec.

Standard exponential format is defined as follows:

[-]d[.][d...]e[-]d[d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char outstr[] = "           is the result.";
	   float num = 1.23e25;
	   ...
	   _f_to_dece(&num, 5, outstr);
	   _put_str(outstr);/* "1.23000e25 is the result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{  
	   char outstr[] = "        is the result.";
	   float num = 1.23e25;
	   lea si,outstr/* SI = offset of outstr */
	   lea di,num	/* DI = offset of num */
	   mov ch,5+DC_FLOAT/* CH = precision + float */
	   f_to_dece();	/* float -> "string..." */
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str();	/* "1.23e25 is the result" */
	}

Source file _DFFTDCE.ASM ASM equiv SHORT_TO_DECE
See also
_dec_to_f, _d_to_dec, _f_to_dec, _f_to_dec, _ld_to_dec

_f_to_decn


Descrip
Converts a float to a decimal ASCIIZ string in standard non-exponential format.

Syntax
#include <dataconv.h>
char *_f_to_decn(float *num, unsigned char precision, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of num in standard non-exponential format

Notes
This function converts num to an ASCIIZ string in standard non-exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point. A pointer is returned to the result in outstr.

Standard non-exponential format is defined as follows:

[-][d...]d[.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char outstr[80];
	   float num = 1.23e5;
	   ...
	   _put_str(_f_to_decn(&num, 5, outstr)); /* "123000.00000" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[80];
	   float num = 1.23e5;
	   lea si,outstr/* SI = offset of outstr */
	   lea di,num	/* DI = offset of num */
	   mov ch,5+DC_FLOAT/* CH = precision + float */
	   f_to_decn();	/* float -> "string" */
	   put_str();	/* "123000" */
	}

Source file _DFFTDCN.ASM ASM equiv SHORT_TO_DECN
See also
_dec_to_f, _d_to_dec, _f_to_dec, _f_to_dec, _ld_to_dec

_f_to_decne


Descrip
Converts a float to a decimal ASCII string in standard non-exponential format, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_f_to_decne(float *num, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character in outstr.
outstr the decimal ASCII representation of num in standard non-exponential format

Notes
This function converts num to an ASCII string in standard non-exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point and is not NULL terminated. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _f_to_decn.

Standard non-exponential format is defined as follows:

[-][d...]d[.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC(0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char outstr[] = "             is the result.";
	   float num = 1.23e5;
	   ...
	   _f_to_decne(&num, 5+DC_ROUND, outstr);
	   _put_str(outstr);/* "123000.00000 is the result"*/
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{  
	   char outstr[50] = "       is the result.";
	   float num = 1.23e5;
	   lea si,outstr/* SI = offset of outstr */
	   lea  di,num	/* DI = offset of num */
	   xor ch,ch	/* CH = precision of 0 */
	   f_to_decne();	/* float -> "string" */
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str();	/* "123000 is the result" */
	}

Source file _DFFDCNE.ASM ASM equiv SHORT_TO_DECNE
See also
_dec_to_f, _d_to_dec, _f_to_dec, _f_to_dec, _ld_to_dec

_hex_to_uc


Descrip
Converts a hexadecimal ASCII string to an unsigned char.

Syntax
#include <dataconv.h>
unsigned char _hex_to_uc(char *instr, char **strindx);

Returns
The unsigned char result (undefined if overflow, 0 if underflow).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from a hexadecimal ASCII string to an unsigned char. Characters are processed from instr, one at a time, until an invalid character is encountered. At most, two hex digits are processed. The unsigned char result is returned, and the global c_code variable is modified to contain the conversion status. If c_code is set to 1, strindx points to the next hex digit of instr to be converted. This allows the remaining digits to be processed on subsequent calls. ASCII digits and upper and lowercase letters A-F are valid characters.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips immediately prior to calling this routine.

C/C++ Example
	{
	   unsigned char num;
	   char *strindx;
	   ...
	   num = _hex_to_uc ("FF", &strindx);
	   switch (c_code)
	   {
	      case  0: _put_str("\n\rConversion was successful.");
	         if (strindx[0] != NULL) {
	            _put_str(" Except these characters: ");
	            _put_str(strindx); } break;
	      case  1: _put_str("\n\rConversion overflow."); break;
	      case -1: _put_str("\n\rConversion underflow."); break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "7F";
	   int num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   num = hex_to_uc();/* num = conversion result */
	    ja label_100/* overflow? */
	    jb label_200/* underflow? */
	   cmp byte ptr [si],0/* entire string converted? */
	    je label_300/*  y: jump to label_300 */
	   ... some characters were not converted ...
	   jmp short label_300	  

	label_100:
	   ...
	   ... overflow ...
	label_200:
	   ...
	   ... underflow ...
	label_300:
	   ...
	}

Source file _DCHTOC.ASM ASM equiv HEX_TO_BYTE
See also
_asc_to_uc, _hex_to_ui

_hex_to_ui


Descrip
Converts a hexadecimal ASCII string to an unsigned int.

Syntax
#include <dataconv.h>
unsigned int _hex_to_ui(char *instr, char **strindx);

Returns
The unsigned int result (undefined if overflow, 0 if underflow).
strindx points to the first character in instr not converted
c_code1 = overflow, 0 = successful, -1 = underflow

Notes
This function converts characters from a hexadecimal ASCII string to an unsigned int. Characters are processed from instr, one at a time, until an invalid character is encountered. At most, four hex digits are processed. The unsigned int result is returned, and the global c_code variable is modified to contain the conversion status. If c_code is set to 1, strindx points to the next hex digit of instr to be converted. This allows the remaining digits to be processed on subsequent calls. ASCII digits and upper and lowercase letters A-F are valid characters.

No skipping of white space is performed. To skip leading white space, call _str_skipw or _str_skips immediately prior to calling this routine.

C/C++ Example
	{
	   char *strindx;
	   unsigned int num;
	   ...
	   num = _hex_to_ui("65000", &strindx);
	   switch (c_code)
	   {
	      case  0:_put_str("\n\rSuccess.");
	         if (strindx[0] != NULL) {
	            _put_str(" Except these characters: ");
	            _put_str(strindx); } break;
	      case  1:_put_str("\n\rOverflow!"); break;
	      case -1:_put_str("\n\rUnderflow!"); break;
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "65000";
	   unsigned int num;
	    ...
	    lea si,instr/* SI = offset of instr */
	    num = hex_to_ui();/* "string" -> int */
	     ja label_100/* overflow? */
	     jb label_200/* underflow? */
	    cmp byte ptr [si],0/* entire string converted? */
	     je label_300/*   y: jump to label_300 */
	    ... some characters were not converted ...
	    jmp short label_300

	label_100:
	    ...
	    ... overflow ...
	label_200:
	    ...
	    ... underflow ...
	label_300:
	    ...
	}

Source file _DCHTOI.ASM ASM equiv HEX_TO_WORD
See also
_asc_to_ui, _hex_to_uc

_i_to_asc


Descrip
Converts an int to an ASCIIZ string in a given radix.

Syntax
#include <dataconv.h>
char *_i_to_asc(int num, int radix, char *outstr);

Returns
A pointer to outstr.
outstr the ASCIIZ representation of num in the base specified by radix

Notes
This function converts num to an ASCIIZ string at outstr using radix as the base. If num is negative, the first character in outstr is a minus sign. The resulting string is NULL terminated.

The results for a radix less than two or greater than 36 are undefined.

C/C++ Example
	   char outstr[10];
	   _put_str(_i_to_asc(65535,10,outstr)); /* "-1" */;
	   ...

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[10];
	   ...
	   mov ax,0xFFFF/* AX = signed int */
	   mov bl,10	/* BL = radix (dec) */
	   lea si,outstr/* SI = offset of outstr */
	   i_to_asc();	/* signed int -> "string" */
	   put_str();	/* "-1" */
	   ...
	}

Source file _DCSITA.ASM ASM equiv WORDS_TO_ASC
See also
_c_to_asc, _i_to_asc, _l_to_asc, _q_to_asc, _ui_to_asc

_i_to_asce


Descrip
Converts an int to an ASCII string in a given radix, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_i_to_asce(int num, int radix, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the ASCII representation of num in the base specified by radix

Notes
This function converts num to an ASCII string at outstr using radix as the base. If num is negative, the first character in outstr is a minus sign. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _i_to_asc. outstr is not NULL terminated.
The results for a radix less than two or greater than 36 are undefined.

C/C++ Example
	{
	   char outstr[] = "  is signed int value.";
	   _i_to_asce(0xFFFF,10,outstr);
	   _put_str(outstr); /* "-1 is signed int value." */;
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "   is signed int value.";
	   ...
	   mov ax,0xFFFF/* AX = signed int */
	   mov bl,10	/* BL = radix (decimal) */
	   lea si,outstr/* SI = offset of outstr */
	   i_to_asce();	/* num -> "string" */
	   lea si,outstr /* reset SI = offset outstr */
	   put_str();	/* "-1 is signed int value." */
	   ...
	}

Source file _DCSITAE.ASM ASM equiv WORDS_TO_ASCE
See also
_c_to_asc, _i_to_asc, _l_to_asc, _q_to_asc, _ui_to_asc

_i_to_dec


Descrip
Converts an int to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_i_to_dec(int num, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of num

Notes
This function converts num to a decimal ASCIIZ string at outstr. If num is negative, the first character in outstr is a minus sign. The string is NULL terminated.

C/C++ Example
	   char outstr[10];
	   _put_str(_i_to_dec(65535,outstr)); /* "-1" */
	   ...

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[10];
	   ...
	mov ax,-127
	lea si,outstr/* SI = offset of outstr */
	i_to_dec();	 /* int -> "string" */
	put_str();	 /* "-127" */
	...
	}

Source file _DCSITD.ASM ASM equiv WORDS_TO_DEC
See also
_c_to_dec, _i_to_dec, _l_to_dec, _q_to_dec, _ui_to_dec

_i_to_dece


Descrip
Converts an int to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_i_to_dece(int num, char *outstr);

Returns
A pointer to the first character past the last digit written to outstr.
outstr the decimal ASCII representation of num

Notes
This function converts num to an ASCII string at outstr using radix as the base. If num is negative, the first character in outstr is a minus sign. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _i_to_dec. outstr is not NULL terminated.

The results for a radix less than two or greater than 36 are undefined.

C/C++ Example

char outstr[25] = " is the result";
_i_to_dece (0x7FFF,outstr);
_put_str(outstr);/* "32767 is the result" */
...

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "    is the result.";
	   ...
	   lea si,outstr/* SI = offset of outstr */
	   mov ax,0xFFFF/* AL = num */
	   i_to_dece();	/* signed int -> "string" */
	   lea si,outstr/* reset SI = offset outstr */
	   put_str();	/* "65535 is the result." */
	   ...
	}

Source file _DCSITDE.ASM ASM equiv WORDS_TO_DECE
See also
_c_to_dec, _i_to_dec, _l_to_dec, _q_to_dec, _ui_to_dec

_ld_to_dec


Descrip
Converts a long double to a decimal ASCIIZ string in standard exponential format.

Syntax
#include <dataconv.h>
char *_ld_to_dec(long double *num, unsigned char precision, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of num in standard exponential format

Notes
This function converts num to an ASCIIZ string in standard exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point. A pointer is returned to the result in outstr.

Standard exponential format is defined as follows:

[-]d[.][d...]e[-]d[d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char outstr[80];
	   long double num = 1.23e2555;
	   ...
	   _put_str(_ld_to_dec(&num, 5, outstr)); /* "1.23000e2555" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[80];
	   long double num = 1.23e2555;
	   lea si,outstr/* SI = offset of outstr */
	   lea di,num	/* DI = offset of num */
	   mov ch,5+DC_FLOAT/* CH = precision + float */
	   ld_to_dec();	/* long double -> "string" */
	   put_str();	/* "1.23e2555" */
	}

Source file _DFLDDEC.ASM ASM equiv TENB_TO_DEC
See also
_dec_to_l, _d_to_dec, _f_to_dec, _ld_to_dec, _ld_to_dec

_ld_to_dece


Descrip
Converts a long double to a decimal ASCII string in standard exponential format, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_ld_to_dece(long double *num, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character written to outstr.
outstr the decimal ASCII representation of num in exponential format

Notes
This function converts num to an ASCII string in standard exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point and is not NULL terminated. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _ld_to_dec.

Standard exponential format is defined as follows:

[-]d[.][d...]e[-]d[d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char outstr[] = "             is the result.";
	   long double num = 1.23e2555;
	   ...
	   _ld_to_dece(&num, 5+DC_ROUND, outstr);
	   _put_str(outstr);/* "1.23000e2555 is the result"*/
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{  
	   char outstr[] = "          is the result.";
	   long double num = 1.23e2555;
	   lea si,outstr/* SI = offset of outstr */
	   lea di,num	/* DI = offset of num */
	   mov ch,5+DC_FLOAT/* CH = precision + float */
	   ld_to_dece();	/* long double -> "string" */
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str();
	}

Source file _DFLDDCE.ASM ASM equiv TENB_TO_DECE
See also
_dec_to_l, _d_to_dec, _f_to_dec, _ld_to_dec, _ld_to_dec

_ld_to_decn


Descrip
Converts a long double to a decimal ASCIIZ string in standard non-exponential format.

Syntax
#include <dataconv.h>
char *_ld_to_decn(long double *num, unsigned char precision, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of num in standard non-exponential format

Notes
This function converts num to an ASCIIZ string in standard non-exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point. A pointer is returned to the result in outstr.

Standard non-exponential format is defined as follows:

[-][d...]d[.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

Source file _DFLDDCN.ASM ASM equiv TENB_TO_DECN
See also
_dec_to_l, _d_to_dec, _f_to_dec, _ld_to_dec, _ld_to_dec

_ld_to_decne


Descrip
Converts a long double to a decimal ASCII string in standard non-exponential format, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_ld_to_decne(long double *num, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character written to outstr.
outstr the decimal ASCII representation of num in standard non-exponential format

Notes
This function converts num to an ASCII string in standard non-exponential format at outstr. The result has a maximum of precision digits (0 to 30) to the right of the decimal point and is not NULL terminated. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _ld_to_decn.

Standard non-exponential format is defined as follows:

[-][d...]d[.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_ROUND (0x00) The result is rounded, if required. (Default)
DC_TRUNC (0x20) The result is not rounded. Less significant digits are truncated.
DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

WARNING! This function requires an 8087 compatible math coprocessor or emulator. When this function is used, the appropriate floating-point conversion library (_FPC??.LIB) must also be linked in.

C/C++ Example
	{
	   char outstr[] = "             is the result";
	   long double lnum = 1.23e5, *ldptr;
	   ...
	   _ld_to_decne(&lnum, 5+DC_ROUND, outstr);
	   _put_str(outstr);/* "123000.00000 is the result"*/
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{  
	   char outstr[] = "       is the result";
	   long double num = 1.23e5;
	   lea si,outstr/* SI = offset of outstr */
	   lea di,num	/* DI = offset of num */
	   xor ch,ch	/* CH = precision */
	   ld_to_decne();	/* long double -> "string" */
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str();	/* "123000 is the result" */
	}

Source file _DFLDCNE.ASM ASM equiv TENB_TO_DECNE
See also
_dec_to_l, _d_to_dec, _f_to_dec, _ld_to_dec, _ld_to_dec

_l_to_asc


Descrip
Converts a long to an ASCIIZ string in a given radix.

Syntax
#include <dataconv.h>
char *_l_to_asc(long num, int radix, char *outstr);

Returns
A pointer to outstr.
outstr the ASCIIZ representation of num in the base specified by radix

Notes
This function converts num to an ASCIIZ string at outstr using radix as the base. If num is negative, the first character in outstr is a minus sign. The string is NULL terminated.

The results for a radix less than two or greater than 36 are undefined.

C/C++ Example
	   char outstr[40];
	   _put_str(_l_to_asc(0xFFFFFFFF, 10, outstr)); /* "-1" */
	   	  ...

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[40];
	   ...
	   mov ax,0xFFFF
	   mov dx,0x7FFF/* DX;AX = num */
	   mov bl,10	/* BL = radix (dec) */
	   lea si,outstr/* SI = offset of outstr */
	   l_to_asc();	/* long -> "string" */
	   put_str();	/* "2174783647" */
	   ...
	}

Source file _DCSLTA.ASM ASM equiv DWORDS_TO_ASC
See also
_c_to_asc, _i_to_asc, _l_to_asc, _q_to_asc, _ul_to_asc

_l_to_asce


Descrip
Converts a long to an ASCII string in a given radix, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_l_to_asce(long num, int radix, char *outstr);

Returns
A pointer to the character after the last character written to outstr.
outstr the ASCII representation of num in the base specified by radix

Notes
This function converts num to an ASCII string at outstr using radix as the base. If num is negative, the first character in outstr is a minus sign. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _l_to_asc. outstr is not NULL terminated.

The results for a radix less than two or greater than 36 are undefined.

C/C++ Example
	{
	   char *outstr = "          is binary result";
	   _l_to_asce (-1,16,outstr);   
	   _put_str(outstr); /* "0xFFFFFFFF is the result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[50] = "            is the hex result.";
	   ...
	   mov ax,-1
	   mov dx,-1	/* DX:AX = signed long = -1 */
	   mov bl,16	/* BL = radix (hex) */
	   lea si,outstr/* SI = offset of outstr */
	   l_to_asce();	/* signed long -> "string" */
	    lea si,outstr/* reset SI */
	   put_str();	/* "0xFFFFFFFF is the result." */
	   ...
	}

Source file _DCSLTAE.ASM ASM equiv DWORDS_TO_ASCE
See also
_c_to_asc, _i_to_asc, _l_to_asc, _q_to_asc, _ul_to_asc

_l_to_dec


Descrip
Converts a long to a decimal ASCIIZ string.

Syntax
char *_l_to_dec(long num, char *outstr);

Returns
A pointer outstr.
outstr the decimal ASCIIZ representation of num

Notes
This function converts num to a decimal ASCIIZ string at outstr. If num is negative, the first character in outstr is a minus sign. The string is NULL terminated.

C/C++ Example
	   char outstr[40];
	   _put_str(_l_to_dec(0xFFFFFFFF, outstr)); /* "-1" */
	   ...

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[20];
	   ...
	   mov ax,0xFFFF
	   mov dx,0xFFFF/* DX;AX = signed long value */
	   lea si,outstr/* SI = offset of outstr */
	   l_to_dec();	/* signed long -> "string" */
	   put_str();	/* "-1" */
	   ...
	}

Source file _DCSLTD.ASM ASM equiv DWORDS_TO_DEC
See also
_c_to_dec, _i_to_dec, _l_to_dec, _q_to_dec, _ui_to_dec

_l_to_dece


Descrip
Converts a long to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_l_to_dece(long num, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the decimal ASCII representation of num

Notes
This function converts num to a decimal ASCII string at outstr. If num is negative, the first character in outstr is a minus sign. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _l_to_dec. outstr is not NULL terminated.

C/C++ Example
	{
	   char outstr[] = "   is signed long value in decimal.";
	   _l_to_dece(0xFFFFFFFF, outstr);
	   _put_str(outstr); /* "-1 is signed long value in decimal." */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "-1 is signed long value in decimal";
	   ...
	   lea si,outstr/* SI = offset of outstr */
	   mov ax,0xFFFE
	   mov dx,0xFFFF/* DX;AX = signed long */
	   l_to_dece();	/* long -> "string..." */
	   lea si,outstr/* reset SI = offset outstr */
	   put_str(); /* "-1 is signed long value in decimal." */
	   ...
	}

Source file _DCSLTDE.ASM ASM equiv DWORDS_TO_DECE
See also
_c_to_dec, _i_to_dec, _l_to_dec, _q_to_dec, _ul_to_dec

_q_to_asc


Descrip
Converts a quad to an ASCIIZ string in a given radix.

Syntax
#include <dataconv.h>
char *_q_to_asc(quad quadnum, int radix, char *outstr);

Returns
A pointer to outstr.
outstr the ASCIIZ representation of quadnum in the base specified by radix

Notes
This function converts the quad value in quadnum to an ASCIIZ string at outstr using radix as the base. A pointer to outstr is returned. If quadnum is negative, the first character in outstr is a minus sign. The string is NULL terminated.

The results for a radix less than two or greater than 36 are undefined.

C/C++ Example
	{
	   char outstr[20], *strindx;
	   quad num1;
	   ...
	   _dec_to_q("9999999999", num1, &strindx);
	   _q_to_asc(num1, 16, outstr);
	   _put_str(outstr);	    /* "2504B33FF" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[20], instr[] = "2504B33FF";
	   quad num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   pushss
	   pop es	 	/* ES = SS (quad on stack) */
	   lea di,num	/* DI = offset of num */
	   mov bl,16	/* BL = radix (hex) */
	   asc_to_q();	/* "string" -> quad */
	   mov bl,10	/* BL = radix (decimal) */
	   lea si,outstr/* SI = offset of outstr */
	   q_to_asc();	/* quad -> "string" */
	   put_str();	/* "9999999999" */
	   ...
	}

Source file _DCSQTA.ASM ASM equiv QWORDS_TO_ASC
See also
_c_to_asc, _i_to_asc, _l_to_asc, _q_to_asc, _uq_to_asc

_q_to_asce


Descrip
Converts a quad to an ASCII string in a given radix, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_q_to_asce(quad quadnum, int radix, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the ASCII representation of quadnum in the base specified by radix

Notes
This function converts the quad value in quadnum to an ASCII string at outstr using radix as the base. If quadnum is negative, the first character in outstr is a minus sign. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _q_to_asc. outstr is not NULL terminated.

The results for a radix less than two or greater than 36 are undefined.

C/C++ Example
	{
	   char *outstr = "           quad value in HEX";
	   char *strindx;
	   quad num;
	   ...
	   _dec_to_q ("5000000000", num, &strindx);
	   _q_to_asce (num, 16, outstr);
	   _put_str(outstr);/* "12A05F200 quad ..." */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{  	    
	   char outstr[50] = "          quad value in HEX";
	   char instr[] = "5000000000";
	   quad num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   pushss
	   pop es	 	/* ES = SS (quad on stack) */
	   lea di,num	/* DI = offset of num */
	   dec_to_q();	/* "string" -> quad */
	    jnelabel_100/* if error jump to label */
	   mov bl,16	/* BL = radix (hex) */
	   lea si,outstr/* SI = offset of outstr */
	   q_to_asce();	/* quad -> "string" */
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str();/* "12A05F200 quad value in HEX"; */
	label_100:
	   ...
	}

Source file _DCSQTAE.ASM ASM equiv QWORDS_TO_ASCE
See also
_c_to_asc, _i_to_asc, _l_to_asc, _q_to_asc, _uq_to_asc

_q_to_bcd


Descrip
Converts a quad to a BCD number.

Syntax
#include <dataconv.h>
bcdptr _q_to_bcd(bcd bcdnum, quad quadnum);

Returns
A pointer to bcdnum.
bcdnum the bcd result

Notes
This function converts the quad value in quadnum to a bcd value in bcdnum. A pointer to bcdnum is returned. All digits are converted as decimal digits.

This function allows integer math facilities to be used for BCD numbers. It does NOT require a numeric coprocessor or emulator.

C/C++ Example
	{
	   char outstr[25], *strindx;
	   BCD bnum;
	   quad qnum;
	   
	   ...
	   _dec_to_uq("123456789012345678", bnum, &strindx);
	   _q_to_bcd(bnum, qnum);
	   _put_str(_bcd_to_dec(bnum, outstr));
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[25];
	   char instr[] = "123456789012345678";
	   BCD bnum;
	   quad qnum;
	   ...
	   lea si,instr/* SI = offset of instr */
	   lea di,qnum	    /* DI = offset of quad */
	   dec_to_q();	/* "string" -> quad */
	   lea si,bnum	    /* SI = offset of bcd */
	   q_to_bcd();	/* convert quad to bcd */
	   mov di,si	/* DI = offset of bcd */
	   lea si,outstr/* SI = offset of outstr */
	   bcd_to_dec();	/* bcd -> "string" */
	   put_str();	/* "123456789012345678" */
	   ...
	}

Source file _DCQBCD.ASM ASM equiv QWORDS_TO_BCD
See also
_bcd_to_q

_q_to_dec


Descrip
Converts a quad to a decimal ASCIIZ string.
Syntax
#include <dataconv.h>
char *_q_to_dec(quad quadnum, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of quadnum

Notes
This function converts the quad value in quadnum to a decimal ASCII string at outstr. A pointer to outstr is returned. If quadnum is negative, the first character in outstr is a minus sign. The returned string is NULL terminated.

C/C++ Example
	{
	   char outstr[22];
	   char *strindx;
	   quad num;
	   ...
	   _asc_to_q ("0xFFFF", 16, num, &strindx);
	   if ( c_code != 0 )
	      _put_str(_q_to_dec(num,outstr)); /* "-1" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[22];
	   char instr[] = "0xFFFFFFFFFFFFFFFF";
	   quad num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   pushss
	   pop es	 	/* ES = SS (quad on stack) */
	   lea di,num	/* DI = offset of num */
	   mov bl,16	/* BL = radix (hex) */
	   asc_to_q();	/* "string" -> quad */
	   lea si,outstr/* SI = offset of outstr */
	   q_to_dec();	/* quad -> "string" */
	   put_str();	/* "-1" */
	   ...
	}

Source file _DCSQTD.ASM ASM equiv QWORDS_TO_DECE
See also
_c_to_dec, _i_to_dec, _l_to_dec, _q_to_dec, _uq_to_dec

_q_to_dece


Descrip
Converts a quad to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_q_to_dec(quad quadnum, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the decimal ASCII representation of quadnum

Notes
This function converts the quad value in quadnum to a decimal ASCII string at outstr. If quadnum is negative, the first character in outstr is a minus sign. The returned pointer identifies the next available position in outstr(past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _q_to_dec. outstr is not NULL terminated.

C/C++ Example
	{
	   char *outstr = "   quad value";
	   char *strindx;
	   quad num;
	   ...
	   _asc_to_q("0xFFFF", 16, num, &strindx);
	   if ( c_code != 0 )
	   {
	      _q_to_dece(num,outstr);
	      _put_str(outstr);/* "-1 quad value" */
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "            quad value";
	   char instr[] = "0xFFFFFFFFFFFFFFFF";
	   quad num;
	   ...
	   lea si,instr/* SI = offset of outstr */
	   pushss
	   pop es	 	/* ES = SS (quad on stack) */
	   lea di,num	/* DI = offset of num */
	   mov bl,16	/* BL = radix (hex) */
	   asc_to_q();	/* "string" -> quad */
	   lea si,outstr/* SI = offset of outstr */
	   q_to_dece();	/* quad -> "string" */
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str();	/* "-1" */
	   ...
	}

Source file _DCSQTDE.ASM ASM equiv QWORDS_TO_DECE
See also
_c_to_dec, _i_to_dec, _l_to_dec, _q_to_dec, _uq_to_dec

_uc_to_asc


Descrip
Converts an unsigned char to an ASCIIZ string in a given radix.

Syntax
#include <dataconv.h>
char *_uc_to_asc(unsigned char num, int radix, char *outstr);

Returns
A pointer to outstr.
outstr the ASCIIZ representation of num in the base specified by radix

Notes
This function converts an unsigned char to an ASCIIZ string at outstr using radix as the base. A pointer to outstr is returned.

The results for a radix less than 2 or greater than 36 are undefined.

C/C++ Example
	{
	   char outstr[10];
	   _put_str(_uc_to_asc (255, 2, outstr));
	   	  /* binary result "11111111" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[10];
	   ...
	   mov al,255	/* AL = num */
	   mov bl,2	/* BL = radix (binary) */
	   lea si,outstr/* SI = offset of outstr */
	   uc_to_asc();	/* num -> "string" */
	   put_str();	/* display conversion result */
	   ...
	}

Source file _DCCTOA.ASM ASM equiv BYTE_TO_ASC
See also
_c_to_asc, _uc_to_asc, _ui_to_asc, _ul_to_asc, _uq_to_asc

_uc_to_asce


Descrip
Converts an unsigned char to an ASCII string in a given radix, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_uc_to_asce(unsigned char num, int radix, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the ASCII representation of num in the base specified by radix

Notes
This function converts an unsigned char to an ASCII string at outstr using radix as the base. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _uc_to_asc. outstr is not NULL terminated.

The results for a radix less than 2 or greater than 36 are undefined.

C/C++ Example
	{
	   char outstr[] = "   is the hex value";   
	   _uc_to_asce("255", 16, outstr);
	   _put_str(outstr); /* "FF is the hex value" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "   is the hex value";
	   ...
	   mov al,255	/* AL = num */
	   mov bl,16	/* BL = radix (hex) */
	   lea si,outstr/* SI = offset of outstr */
	   uc_to_asce();	/* num -> "string" */
	   lea si,outstr/* reset SI = offset outstr */ 
	   put_str();	/* "FF is the hex value" */
	   ...
	}

Source file _DCCTOAE.ASM ASM equiv BYTE_TO_ASCE
See also
_c_to_asc, _uc_to_asc, _ui_to_asc, _ul_to_asc, _uq_to_asc

_uc_to_dec


Descrip
Converts an unsigned char to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_uc_to_dec(unsigned char num, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of num

Notes
This function converts an unsigned char to a decimal ASCIIZ string at outstr. A pointer to outstr is returned.

C/C++ Example
	{
	   char outstr[10];
	   _put_str(_uc_to_dec(0xFF,outstr)); /* "255" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[10];
	   ...
	   mov al,0xFF	    /* AL = num */
	   lea si,outstr/* SI = offset of outstr */
	   uc_to_dec();	/* num  -> "string" */
	   put_str();	/* "255" */
	  ...
	}

Source file _DCCTOD.ASM ASM equiv BYTE_TO_DEC
See also
_c_to_dec, _uc_to_dec, _ui_to_dec, _ul_to_dec, _uq_to_dec

_uc_to_dece


Descrip
Converts an unsigned char to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_uc_to_dece(unsigned char num, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the decimal ASCII representation of num

Notes
This function converts an unsigned char to a decimal ASCII string at outstr. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _uc_to_dec. outstr is not NULL terminated.

C/C++ Example
	{
	   char outstr[25] = "    is the result";
	   _uc_to_dece(0xFE,outstr);
	   _put_str(outstr); /* "254 is the result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "    is the result";
	   ...
	   mov al,0xFE	    /* AL = num */
	   lea si,outstr/* SI = offset of outstr */
	   uc_to_dece();	/* num -> "string" */
	   lea si,outstr/* reset SI = offset outstr */ 
	   put_str();	/* "254 is the result." */
	   ...
	}

Source file _DCCTODE.ASM ASM equiv BYTE_TO_DECE
See also
_c_to_dec, _uc_to_dec, _ui_to_dec, _ul_to_dec, _uq_to_dec

_uc_to_hex


Descrip
Converts an unsigned char to a hexadecimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_uc_to_hex(unsigned char num, char *outstr);

Returns
A pointer to outstr.
outstr the hexadecimal ASCIIZ representation of num

Notes
This function converts an unsigned char to a hexadecimal ASCIIZ string at outstr. The high order digit is written first, followed by the low order digit. If required, the result is padded with leading zeros. A pointer to outstr is returned.

C/C++ Example
	{
	   char outstr[3];   
	   _put_str(_uc_to_hex(253,outstr)); /* "FD" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[3];
	   ...
	   mov al,255	/* AL = num */
	   lea si,outstr/* SI = offset of outstr */
	   uc_to_hex();	/* num -> "string"  (hex) */
	   put_str();	/* "FF" */
	   ...
	}

Source file _DCCTOH.ASM ASM equiv BYTE_TO_HEX
See also
_uc_to_hex, _to_hex, _ui_to_hex

_uc_to_hexe


Descrip
Converts an unsigned char to a hexadecimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char * uc_to_hexe(unsigned char num, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the hexadecimal ASCII representation of num

Notes
This function converts an unsigned char to a hexadecimal ASCII string at outstr. The high order digit is written first, followed by the low order digit. The result is padded with leading zeroes if required. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _uc_to_hex. outstr is not NULL terminated.

C/C++ Example
	{
	   char outstr[81] = "   is conversion result";
	   _uc_to_hexe(255,outstr);
	   _put_str(outstr); /* "FF is conversion result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	char outstr[81] = "   is conversion result";
	   ...
	   mov al,127	/* AL = num */
	   lea si,outstr/* SI = offset of outstr */
	 uc_to_hexe();	 /* num -> "string" (hex) */
	    lea si,outstr/* reset SI = offset outstr */ 
	    put_str();	 /* "7F is conversion result" */
	    ...
	}

Source file _DCCTOHE.ASM ASM equiv BYTE_TO_HEXE
See also
_uc_to_hex, _to_hex, _ui_to_hex

_ufixpi_to_dec


Descrip
Converts a fixed-point unsigned int to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_ufixpi_to_dec(unsigned int fixint, unsigned char precision, char *outstr);

Returns
A pointer to outstr.
outstr the fixed-point decimal ASCIIZ representation of fixint

Notes
This function converts a fixed-point unsigned int to a decimal ASCIIZ string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., fixint has an implied exponent of þprecision or a value of fixintþ10þprecision). A pointer is returned to the result in outstr. The result is written in the following format:

[d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[10];
	   _put_str(_ufixpi_to_dec(-1, 2, outstr)); /* "655.35" */
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[80];
	   ...
	   mov ax,-1	/* AX = 65535 */
	   mov ch,2	/* CH = precision */
	   lea si,outstr/* SI = offset of outstr */
	   ufixpi_to_dec();/* fixed-pt int -> "string" */
	   put_str();	/* "655.35" */
	   ...
	}

Source file _DCXIDC.ASM ASM equiv FIXPW_TO_DEC
See also
_dec_to_ufixpi, _fixpi_to_dec, _ufixpl_to_dec, _ufixpq_to_dec

_ufixpi_to_dece


Descrip
Converts a fixed-point unsigned int to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_ufixpi_to_dece(unsigned int fixint, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character written to outstr.
outstr the fixed-point decimal ASCII representation of fixint

Notes
This function converts a fixed-point unsigned int to a decimal ASCII string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., the integer value of fixint has an implied exponent of þprecision or a value of fixintþ10þprecision). The returned pointer identifies the next available position in outstr (past the result). The result is not NULL terminated and is written in the following format:

[d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[] = "       is the result.";
	   _ufixpi_to_dece(10000, 2, outstr);
	   _put_str(outstr);/* "100.00 is the result." */
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "       is the result.";
	   ...
	   mov ax,10000/* AX = 10000 */
	   mov ch,2	/* CH = precision */
	   lea si,outstr/* SI = offset of outstr */
	   ufixpi_to_dece();/* fixed-pt int -> "string..."*/
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str();	/* "100.00 is the result." */
	   ...
	}

Source file _DCXIDCE.ASM ASM equiv FIXPW_TO_DECE
See also
_dec_to_ufixpi, _fixpi_to_dec, _ufixpl_to_dec, _ufixpq_to_dec

_ufixpl_to_dec


Descrip
Converts a fixed-point unsigned long to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_ufixpl_to_dec(unsigned long fixlong, unsigned char precision, char *outstr);

Returns
A pointer to outstr.
outstr the fixed-point decimal ASCIIZ representation of fixlong

Notes
This function converts a fixed-point unsigned long to a decimal ASCIIZ string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., fixlong has an implied exponent of þprecision or a value of fixlongþ10þprecision). A pointer is returned to the result in outstr. The result is written in the following format:

[d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[10];
	   _put_str(_ufixpl_to_dec(-1, 2, outstr)); /* "42949672.95" */
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[20];
	   ...
	   mov ax,-1
	   mov dx,ax	/* DX;AX = -1 */
	   mov ch,2	/* CH = precision */
	   lea si,outstr/* SI = offset of outstr */
	   ufixpl_to_dec();/* fixed-pt long -> "string" */
	   put_str();	/* "42949672.95" */
	   ...
	}

Source file _DCXLDC.ASM ASM equiv FIXPDW_TO_DEC
See also
_dec_to_ufixpl, _fixpi_to_dec, _ufixpq_to_dec, _ufixpq_to_dec

_ufixpl_to_dece


Descrip
Converts a fixed-point unsigned long to a decimal ASCII string, returning a pointer to the end of the resulting string.
Syntax
#include <dataconv.h>
char *_ufixpl_to_dece(unsigned long fixlong, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character written to outstr.
outstr the fixed-point decimal ASCII representation of fixlong

Notes
This function converts a fixed-point unsigned long to a decimal ASCII string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., the integer value of fixlong has an implied exponent of þprecision or a value of fixlongþ10þprecision). The returned pointer identifies the next available position in outstr (past the result). The result is not NULL terminated and is written in the following format:

[d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[] = "            is the result.";
	   _ufixpl_to_dece(-1, 2, outstr);
	   _put_str(outstr);/* "4294972.95 is the result." */
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[50] = "            is the result.";
	   ...
	   mov ax,-1
	   mov dx,ax	/* DX;AX = -1 */
	   mov ch,2	/* CH = precision */
	   lea si,outstr/* SI = offset of outstr */
	   ufixpl_to_dece();/* fixed-pt long -> "string" */
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str();	/* "4294972.95 is the result." */
	   ...
	}

Source file _DCXLDCE.ASM ASM equiv FIXPDW_TO_DECE
See also
_dec_to_ufixpl, _fixpi_to_dec, _ufixpq_to_dec, _ufixpq_to_dec

_ufixpq_to_dec


Descrip
Converts a fixed-point uquad to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_ufixpq_to_dec(uquad fixquad, unsigned char precision, char *outstr);
Returns
A pointer to outstr.
outstr the fixed-point decimal ASCIIZ representation of fixquad

Notes
This function converts a fixed-point uquad to a decimal ASCIIZ string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., the integer value of fixquad has an implied exponent of þprecision or a value of fixquadþ10þprecision). A pointer is returned to the result in outstr. The result is written in the following format:

[d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char outstr[40], *strindx;
	   uquad num;
	   ...
	   _dec_to_ufixpq("18446744073709551615", 0, num, &strindx);
	   ...
	   _put_str(_ufixpq_to_dec(num, 2, outstr));
	   	  	 /* "184467440737095516.15" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[40], instr[] = "18446744073709551615";
	   uquad num;
	   ...
	   lea di,num	/* DI = offset of num */
	   lea si,instr/* SI = offset of outstr */
	   xor ch,ch	/* read with precision of 0 */
	   dec_to_ufixpq();/* "string" -> fixed-pt quad */
	   lea si,outstr/* reset SI = offset of outstr */
	   mov ch,2	/* CH = precision */
	   ufixpq_to_dec();/* fixed-pt quad -> "string" */
	   put_str();	/* "184467440737095516.15" */
	   ...
	}

Source file _DCXQDC.ASM ASM equiv FIXPQW_TO_DEC
See also
_dec_to_ufixpq, _fixpi_to_dec, _ufixpl_to_dec, _ufixpq_to_dec

_ufixpq_to_dece


Descrip
Converts a fixed-point uquad to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_ufixpq_to_dece(uquad fixquad, unsigned char precision, char *outstr);

Returns
A pointer to the character after the last converted character written to outstr.
outstr the fixed-point decimal ASCII representation of fixquad

Notes
This function converts a fixed-point uquad to a decimal ASCII string at outstr. The location of the fixed decimal point in the result is specified by precision (0 to 30), which indicates the number of decimal digits to the right of the decimal point (i.e., the integer value of fixquad has an implied exponent of þprecision or a value of fixquadþ10þprecision). The returned pointer identifies the next available position in outstr (past the result). The result is not NULL terminated and is written in the following format:

[d...][.][d...] (where d denotes any decimal digit)

Rounding and precision options may also be specified in precision by bitwise ORing the following symbolic constants with the precision value:

DC_FIX (0x00) Forces precision digits to the right of the decimal point by appending trailing zeros if necessary. (Default)
DC_FLOAT (0x80) Allows at most precision digits to right of the decimal point. Trailing zeros are not written. The decimal point is suppressed if there are no digits to the right of the decimal point.

Fixed-point integers provide a fast, tight alternative to floating-point numbers since they are manipulated by integer math functions instead of floating-point facilities. See the Data Conversion technical notes for a detailed explanation of fixed-point integers.

C/C++ Example
	{
	   char *strindx;
	   char outstr[] = "                      is the result.";
	   uquad num;
	   
	   ...
	   _dec_to_ufixpq(0, "18446744073709551615", num, &strindx);
	   ...
	   _ufixpq_to_dece(num, 2, outstr);
	   _put_str(outstr);
	   /* "184467440737095516.15 is the result." */
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char instr[] = "184467440737095516.15";
	   char outstr[] = "                      is the result.";
	   uquad num;
	   ...
	   lea di,num	/* DI = offset of num */
	   lea si,instr/* SI = offset of instr */
	   xor ch,ch	/* CH = precision */
	   dec_to_ufixpq();/* "string" -> fixed-pt quad */
	   lea si,outstr/* SI = offset of outstr */
	   mov ch,2	/* CH = precision */
	   ufixpq_to_dece();/* fixed-pt quad -> "string" */
	   lea si,outstr/* reset SI = offset of outstr */
	   put_str(); /* "184467440737095516.15 is the result." */
	   ...
	}

Source file _DCXQDCE.ASM ASM equiv FIXPQW_TO_DECE
See also
_dec_to_ufixpq, _fixpi_to_dec, _ufixpl_to_dec, _ufixpq_to_dec

_ui_to_asc


Descrip
Converts an unsigned int to an ASCIIZ string in a given radix.

Syntax
#include <dataconv.h>
char *_ui_to_asc(unsigned int num, int radix, char *outstr);

Returns
A pointer to outstr.
outstr the ASCIIZ representation of num in the base specified by radix

Notes
This function converts an unsigned int to an ASCIIZ string at outstr using radix as the base. If num is negative, the first character in outstr is a minus sign. A pointer to outstr is returned.

The results for a radix less than 2 or greater than 36 are undefined.

C/C++ Example
	{
	   char outstr[20];   
	   _put_str(_ui_to_asc(0xFFFF,2,outstr));
	   	  	 /* "1111111111111111" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[20];
	   ...
	   mov ax,0xFFFE/* AX = num */
	   mov bl,2	/* BL = radix */
	   lea si,outstr/* SI = offset of outstr */
	   ui_to_asc();	/* unsigned int -> "string" */
	   put_str();	/* "1111111111111111" */
	   ...
	}

Source file _DCITOA.ASM ASM equiv WORD_TO_ASC
See also
_i_to_asc, _uc_to_asc, _ui_to_asc, _ul_to_asc, _uq_to_asc

_ui_to_asce


Descrip
Converts an unsigned int to an ASCII string in a given radix, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_ui_to_asce(unsigned int num, int radix, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the ASCII representation of num in the base specified by radix

Notes
This function converts an unsigned int to an ASCII string at outstr using radix as the base. If num is negative, the first character in outstr is a minus sign. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _ui_to_asc. outstr is not NULL terminated.

The results for a radix less than 2 or greater than 36 are undefined.

C/C++ Example
	{
	   char outstr[] = "     is the result";   
	   _ui_to_asce("65535", 16, outstr)
	   _put_str(outstr); /* "FFFF is the result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "      is the result";
	   ...
	   mov al,0xF0F0/* AX = num */
	   mov bl,10	/* BL = radix */
	   lea si,outstr/* SI = offset of outstr */
	   ui_to_asce(); 	/* unsigned -> "string..." */
	   lea si,outstr/* reset SI = offset outstr */
	   put_str();	/* "61680 is the result" */
	   ...
	}

Source file _DCITOAE.ASM ASM equiv WORD_TO_ASCE
See also
_i_to_asc, _uc_to_asc, _ui_to_asc, _ul_to_asc, _uq_to_asc

_ui_to_dec


Descrip
Converts an unsigned int to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_ui_to_dec(unsigned int num, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of num

Notes
This function converts an unsigned int to a decimal ASCIIZ string at outstr. If num is negative, the first character in outstr is a minus sign. A pointer to outstr is returned.

C/C++ Example
	{
	   char outstr[10];
	   _put_str(_ui_to_dec(0xF0F0,outstr)); /* "61680" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[10];
	   ...
	   mov ax,0xF0F0
	   lea si,outstr/* SI = offset of outstr */
	   ui_to_dec();	/* unsigned int -> "string" */
	  put_str();	 /* "61680 */
	    ...
	}

Source file _DCITOD.ASM ASM equiv WORD_TO_DEC
See also
_i_to_dec, _uc_to_dec, _ui_to_dec, _ul_to_dec, _uq_to_dec

_ui_to_dece


Descrip
Converts an unsigned int to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_ui_to_dece(unsigned int num, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the decimal ASCII representation of num

Notes
This function converts an unsigned int to a decimal ASCII string at outstr. If num is negative, the first character in outstr is a minus sign. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _ui_to_dec. outstr is not NULL terminated.

C/C++ Example
	{
	   char outstr[] = "      is the result";
	   _ui_to_dece (0x8000,outstr);
	   _put_str(outstr); /* "32768 is the result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[50] = "    is the result";
	   ...
	   mov ax,0xFFFE/* AX = num */
	   lea si,outstr/* SI = offset of outstr */
	   ui_to_dece();
	   lea si,outstr/* reset SI = offset outstr */
	   put_str();	/* "65534 is the result" */
	   ...
	}

Source file _DCITODE.ASM ASM equiv WORD_TO_DECE
See also
_i_to_dec, _uc_to_dec, _ui_to_dec, _ul_to_dec, _uq_to_dec

_ui_to_hex


Descrip
Converts an unsigned int to a hexadecimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_ui_to_hex(unsigned int num, char *outstr);

Returns
A pointer to outstr.
outstr the hexadecimal ASCIIZ representation of num

Notes
This function converts an unsigned int to a hexadecimal ASCIIZ string at outstr. The resulting string consists of four hexadecimal digits; it is padded with leading zeroes if required. A pointer to outstr is returned.
This function is much faster than calling _ui_to_asc with a radix of 16.

C/C++ Example
	{
	   char outstr[10];
	   _put_str(_ui_to_hex(65535)); /* "FFFF" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[10];
	   ...
	   mov ax,65535/* AX = num */
	   lea si,outstr/* SI = offset of outstr */
	   ui_to_hex();	/* unsigned int -> "string" */
	   put_str()	/* "FFFF" */
	   ...
	}

Source file _DCITOH.ASM ASM equiv WORD_TO_HEX
See also
_uc_to_hex, _to_hex, _ui_to_hex

_ui_to_hexe


Descrip
Converts an unsigned int to a hexadecimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char * _ui_to_hexe(unsigned int num, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the hexadecimal ASCII representation of num

Notes
This function converts an unsigned int to a hexadecimal ASCII string at outstr. The resulting string consists of four hexadecimal digits; it is padded with leading zeroes if required. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _ui_to_hex. outstr is not NULL terminated.

This function is much faster than calling _ui_to_asce with a radix of 16.

C/C++ Example
	{
	   char *outstr = "     is conversion result";
	   _ui_to_hexe(65535,outstr);
	   _put_str(outstr); /* "FFFF is conversion result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "0x      is the result";
	    ...
	    mov ax,32768/* AX = num */
	    lea si,outstr/* SI = offset of outstr */
	    add si,2	 /* point past "0x" */
	    ui_to_hexe();	 /* num -> "string" */
	    lea si,outstr/* reset SI = offset outstr */
	    put_str();	 /* "0x8000 is the result" */
	    ...
	}

Source file _DCITOHE.ASM ASM equiv WORD_TO_HEXE
See also
_uc_to_hex, _to_hex, _ui_to_hex

_ul_to_asc


Descrip
Converts an unsigned long to an ASCIIZ string in a given radix.

Syntax
#include <dataconv.h>
char *_ul_to_asc(unsigned long num, int radix, char *outstr);

Returns
A pointer to outstr.
outstr the ASCIIZ representation of num in the base specified by radix

Notes
This function converts an unsigned long to an ASCIIZ string at outstr using radix as the base. A pointer to outstr is returned.

The results for a radix less than 2 or greater than 36 are undefined.

C/C++ Example
	{
	   char *outstr = "          is binary result";
	   ...
	   _put_str(_ul_to_asc(511,2,outstr)); /* "111111111" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[50];
	   ...
	   mov ax,0xFFFF
	   mov dx,0xFFFF/* DX:AX = unsigned long */
	   mov bl,2	/* BL = radix */
	   lea si,outstr/* SI = offset of outstr */
	   ul_to_asc();	/* num -> "string"
	   put_str(); /* "11111111111111111111111111111111 " */
	   ...
	}

Source file _DCLTOA.ASM ASM equiv DWORD_TO_ASC
See also
l_to_asc, _uc_to_asc, _ul_to_asc, _uq_to_asc

_ul_to_asce


Descrip
Converts an unsigned long to an ASCII string in a given radix, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_ul_to_asce(unsigned long num, int radix, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the ASCII representation of num in the base specified by radix

Notes
This function converts an unsigned long to an ASCII string at outstr using radix as the base. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _ul_to_asc. outstr is not NULL terminated.

The results for a radix less than 2 or greater than 36 are undefined.

C/C++ Example
	{
	   char *outstr = "          is binary result";
	   _ul_to_asce(511,2,outstr);
	   _put_str(outstr ); /* "111111111 is binary result" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[50]="                                 as binary";
	   ...
	   mov ax,0xFFFF
	   mov dx,0xFFFF/* DX:AX = unsigned long */
	   mov bl,2	/* BL = radix */
	   lea si,outstr/* SI = offset of outstr */
	   ul_to_asce();	/* num -> "string"
	   lea si,outstr/* reset SI = offset outstr */
	   put_str(); /* "11111111111111111111111111111111 ..." */
	   ...
	}

Source file _DCLTOAE.ASM ASM equiv DWORD_TO_ASCE
See also
_l_to_asc, _uc_to_asc, _ul_to_asc, _uq_to_asc

_ul_to_dec


Descrip
Converts an unsigned long to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_ul_to_dec(unsigned long num, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of num

Notes
This function converts an unsigned long to a decimal ASCIIZ string at outstr. A pointer to outstr is returned.

C/C++ Example
	{
	   char outstr[81];
	   _put_str(_ul_to_dec(0xFFFFFFFF, outstr)); /* "4294967295" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char    outstr[81];
	   ...
	   mov ax,0xFFFF
	   mov dx,0xFFFF/* DX;AX = num */
	   lea si,outstr/* SI = offset of outstr */
	   ul_to_dec();	/* unsigned long -> "string" */
	   put_str();	/* "4294967295" */ 
	   ...
	}

Source file _DCLTOD.ASM ASM equiv DWORD_TO_DEC
See also
_l_to_dec, _uc_to_dec, _ul_to_dec, _uq_to_dec

_ul_to_dece


Descrip
Converts an unsigned long to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_ul_to_dece(unsigned long num, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the decimal ASCII representation of num

Notes
This function converts an unsigned long to a decimal ASCII string at outstr. If num is negative, the first character in outstr is a minus sign. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _ul_to_dec. outstr is not NULL terminated.

C/C++ Example
	{
	   char outstr[] = "           is ...";
	   _ul_to_dece(0xFFFFFFFF, outstr);
	   _put_str(outstr); /* "4294967295 is ..." */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[] = "           is the result.";
	   unsigned long num = 0xFFFFFFFF;
	    ...
	    lea si,outstr/* SI = offset of outstr */
	    mov ax,num
	    mov dx,num+2/* DX;AX = num */
	    ul_to_dece();	 /* num -> "string" */
	    lea si,outstr/* reset SI = offset outstr */
	    put_str();	 /* "4294967294 is the result." */
	    ...
	}

Source file _DCLTODE.ASM ASM equiv DWORD_TO_DECE
See also
_l_to_dec, _uc_to_dec, _ul_to_dec, _uq_to_dec

_uq_to_asc


Descrip
Converts a uquad to an ASCIIZ string in a given radix.

Syntax
#include <dataconv.h>
char *_uq_to_asc(uquad num, int radix, char *outstr);

Returns
A pointer to outstr.
outstr the ASCIIZ representation of num in the base specified by radix

Notes
This function converts a uquad to an ASCIIZ string at outstr using radix as the base. A pointer to outstr is returned.

The results for a radix less than 2 or greater than 36 are undefined.

C/C++ Example
	{
	   char outstr[20];
	   uquad num1, num2;
	   ...
	   _mov_uql (num1, 4294967295);
	   _mov_uql (num2, 4294967295);
	   _put_str(_uq_to_asc(_add_uqq(num1, num2), 16, outstr));  
	   	  	 	/* "FFFFFFFFFFFFFFFF" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[20], instr[50] = "123456789012345678";
	   uquad num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   lea di,num	/* DI = offset of num */
	   mov bl,10	/* BL = radix (dec) */
	  asc_to_uq();	 /* "string" -> num */
	    mov bl,10	 /* BL = radix (dec) */
	    lea si,outstr/* SI = offset of outstr */
	    uq_to_asc();	 /* num -> "string" */
	    put_str();	 /* "123456789012345678" */
	    ...
	}

Source file _DCQTOA.ASM ASM equiv QWORD_TO_ASC
See also
_q_to_asc, _uc_to_asc, _ui_to_asc, _ul_to_asc, _uq_to_asc

_uq_to_asce


Descrip
Converts a uquad to an ASCII string in a given radix, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_uq_to_asce(uquad num, int radix, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the ASCII representation of num in the base specified by radix

Notes
This function converts a uquad to an ASCII string at outstr using radix as the base. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _uq_to_asc. outstr is not NULL terminated.

The results for a radix less than 2 or greater than 36 are undefined.

C/C++ Example
	{
	   char *outstr = "           uquad value in HEX";
	   char *strindx;
	   uquad num;
	   
	   ...
	   _dec_to_uq("5000000000", num, &strindx);
	   if (c-code == 0)
	   {
	      _uq_to_asce(num, 16, outstr);
	      _put_str(outstr);/* "12A05F200" */
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char *outstr = "            milliseconds since last day off";
	   char instr[50] = "31536000000";
	   uquad num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   lea di,num	/* DI = offset of num */
	   mov bl,10	/* BL = radix (dec) */
	   asc_to_uq();	/* "string" -> num */
	   mov bl,10	/* BL = radix (dec) */
	   lea si,outstr/* SI = offset of outstr */
	   uq_to_asce();	/* num -> "string" */
	   lea si,outstr/* reset SI = offset outstr */
	   put_str();	/* "31536000000 millisec..." */
	 ...
	}

Source file _DCQTOAE.ASM ASM equiv QWORD_TO_ASCE
See also
_q_to_asc, _uc_to_asc, _ui_to_asc, _ul_to_asc, _uq_to_asc

_uq_to_dec


Descrip
Converts a uquad to a decimal ASCIIZ string.

Syntax
#include <dataconv.h>
char *_uq_to_dec(uquad num, char *outstr);

Returns
A pointer to outstr.
outstr the decimal ASCIIZ representation of num

Notes
This function converts a uquad to a decimal ASCIIZ string at outstr. A pointer to outstr is returned.

C/C++ Example
	{
	   char *outstr = "           uquad value in HEX";
	   char *strindx;
	   uquad num;
	   
	   ...
	   _dec_to_uq("5000000000", num, &strindx);
	   if (c_code == 0)
	      _put_str(_uq_to_dec(num, outstr));
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[22];
	   char instr[50] = "31536000000";
	   uquad num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   lea di,num	/* DI = offset of num */
	   dec_to_uq();	/* "string" -> num */
	   lea si,outstr/* SI = offset of outstr */
	   uq_to_dec();	/* num -> "string" */
	   put_str();	/* "31536000000" */
	   ...
	}

Source file _DCQTOD.ASM ASM equiv QWORD_TO_DEC
See also
_q_to_dec, _uc_to_dec, _ui_to_dec, _ul_to_dec, _uq_to_dec

_uq_to_dece


Descrip
Converts a uquad to a decimal ASCII string, returning a pointer to the end of the resulting string.

Syntax
#include <dataconv.h>
char *_uq_to_dece(uquad num, char *outstr);

Returns
A pointer to the character after the last digit written to outstr.
outstr the decimal ASCII representation of num

Notes
This function converts a uquad to a decimal ASCII string at outstr. The returned pointer identifies the next available position in outstr (past the result). A subsequent call to _str_cpy or _str_cpye will append data to the result more rapidly than is possible with _uq_to_dec. outstr is not NULL terminated.

C/C++ Example
	{
	   char *outstr = "            quad value";
	   char *strindx;
	   uquad num;
	   
	   ...   
	   _dec_to_uq("100000000", num, &strindx);
	   _uq_to_dece (num, outstr);
	   _put_str(outstr); /* "100000000 quad value" */
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char outstr[50] = "            quad value";
	   char instr[20] = "100000000";
	   uquad num;
	   ...
	   lea si,instr/* SI = offset of instr */
	   lea di,num	/* DI = offset of num */
	   dec_to_uq();	/* "string" -> num */
	   lea si,outstr/* SI = offset of outstr */
	   uq_to_dece();	/* uquad -> "string" */
	   lea si,outstr/* reset SI = offset outstr */
	   put_str();	/* "100000000 quad value" */
	   ...
	}

Source file _DCQTODE.ASM ASM equiv QWORD_TO_DECE
See also
_q_to_dec, _uc_to_dec, _ui_to_dec, _ul_to_dec, _uq_to_dec