


				   [42mIntConv32[0m
				   ~~~~~~~~~

			       [3mby Peter Thompson[0m


		    This is release 1, dated 21st May 1993.


   Ed: This is a series of 68000 assembly language routines that provide 32
  bit integer to string and string to integer conversion. Just the thing on a
  cold winter's night.


[32m   <> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <>
[0m

[33mCONDITIONS OF USE
~~~~~~~~~~~~~~~~~[0m
  o These routines are (C) 1993 Peter Thompson.
  o The onus is on the user to bear the result of any damage of any kind
  suffered as a result of using these routines. All I certify is that they
  were not designed to cause damage when they left me.
  o They are freely distributable in source form as long as:
    - No files are removed from the initial distribution, comprising:
	atoi32.asm      		    1444
	cfg_asm.i       		     283
	cfg_c.i 			     285
	cfg_dice.i      		     283
	DMakefile       		    3917
	intconv32.clib  		    1248
	IntConv32.doc   		    8334
	intconv32.i     		     220
	intconv32.lib   		    1012
	intconv32_protos.h      	    1115
	intdefs.i       		     879
	itoa32.asm      		    1436
	strto32.asm     		    2914
	to32lib.asm     		    2004
	to32lib.i       		     134
	tostr32.asm     		    1962

      These files are optional:
	IntConv32.doc.info      	     710
	test.asm			    1304
	test.c  			     917

    - The contents of these files remain unaltered.
    - No attempt is made by the distributors to prevent anyone else from
    distributing them.
    - They are not being sold as part of any copyrighted commercial
    compilation or package without prior written permission from the
    author.

  o They may be distributed in binary or object form as part of a program
  if, and only if:
    - The program displays or documentation contains the words "Uses
    IntConv32 (C) 1993 Peter Thompson".
    - The conditions of use of the program allow it to be used for at least
    14 days before any payment must be made or use ceased, OR
    - Prior written permission has been obtained from the author.

  Megadisc and Fred Fish have permission to distribute this package.

[33mWHAT
~~~~[0m
  IntConv32 is a package of 68000 assembly language routines that provide 32
  bit integer to string and string to integer conversion. They include input
  and output for bases 2 to 36 with error checking. There are provisions for
  normal and regargs C language entry points, although there is no provision
  yet for return of an error code.

[33mCAVEAT
~~~~~~[0m
  Not all code paths have been tested; in particular, handling for some of
  the possible errors. I have only written them to be correct, not tested
  them.

[33mWHO
~~~[0m
  Peter Thompson
  33 Pleasant St
  Pascoe Vale 3044
  AUSTRALIA

--------------------------------------------------------------------------

[33matoi32/ATOI32
[0m
SYNOPSIS
  __D0 int32 atoi32( __A0 const char *s );

INPUT
  a0 points to zero or more characters of whitespace followed by an
optional minus sign followed by one or more digits in the range 0..9. These
are interpreted as a signed base 10 integer, which is the return value.

OUTPUT
  If no errors were encountered, d0 contains the number and d1 contains 0.
  If there were no digits, d0 contains MAX_32 or MIN_32 depending on
whether a minus sign was encountered and d1 contains ERR_NONUM.
  If the number overflowed, d0 contains MAX_32 or MIN_32 depending on the
sign of the number and d1 contains ERR_RANGE.

--------------------------------------------------------------------------

[33matou32/ATOU32
[0m
SYNOPSIS
  __D0 uint32 atou32( __A0 const char *s );

INPUT
  a0 points to zero or more characters of whitespace followed by one or
more digits in the range 0..9. These are interpreted as an unsigned base 10
integer, which is the return value.

OUTPUT
  If no errors were encountered, d0 contains the number and d1 contains 0.
  If there were no digits, d0 contains UMAX_32 and d1 contains ERR_NONUM.
  If the number overflowed, d0 contains UMAX_32 and d1 contains ERR_RANGE.

--------------------------------------------------------------------------

[33mitoa32/ITOA32
[0m
SYNOPSIS
  __D0 char *itoa32( __A0 char *s, __D0 int32 num );

INPUT
  a0 points to the destination array of characters.
  d0 is the signed integer to be converted.

OUTPUT
  s contains the signed base 10 representation of num.
  d0 contains a pointer to the chatacter after the terminating \0.

--------------------------------------------------------------------------

[33mutoa32/UTOA32
[0m
SYNOPSIS
  __D0 char *utoa32( __A0 char *s, __D0 uint32 num );

INPUT
  a0 points to the destination array of characters.
  d0 is the unsigned integer to be converted.

OUTPUT
  s contains the unsigned base 10 representation of num.
  d0 contains a pointer to the character after the terminating \0.

--------------------------------------------------------------------------

[33mstrtoi32/STRTOI32
[0m
SYNOPSIS
  __D0 int32 strtoi32( __A0 const char *s, __A1 char **endp, __D1 int base );

INPUT
  A0 points to whitespace followed by an optional minus sign followed by
digits 0..base-1, where both A and a are digits representing 10. This is
interpreted as a signed integer in base base, which is the return value.
  A1 points to a pointer in which to store a pointer to the unconverted
suffix.
  D1 is a 32 bit positive integer containing the base in the range 2..36.
If the base is zero, then if the first digit encountered is non-zero, the
base is 10; otherwise the base is 8 unless the next digit is X or x, in
which case it is base 16. This is the usual strtol() convention, which is
messy. This routine handles the cases of 0<nondigit> and 0x<nondigit> as
the number 0.

OUTPUT
  If A1 was non-zero, (A1) contains a pointer to the unconverted portion of
the string, as does A0.
  If no errors were encountered, D0 contains the number and d1 contains 0.
  If there were no digits, d0 contains MAX_32 or MIN_32 depending on
whether a minus sign was encountered and d1 contains ERR_NONUM.
  If the number overflowed, d0 contains MAX_32 or MIN_32 depending on the
sign of the number and d1 contains ERR_RANGE.

--------------------------------------------------------------------------

[33mstrtou32/STRTOU32
[0m
SYNOPSIS
  __D0 uint32 strtou32( __A0 const char *s, __A1 char **endp, __D1 int base );

INPUT
  A0 points to whitespace followed by digits 0..base-1, where both A and a
are digits representing 10. This is interpreted as an unsigned integer in
base base, which is the return value.
  A1 points to a pointer in which to store a pointer to the unconverted
suffix.
  D1 is a 32 bit positive integer containing the base in the range 2..36.
If the base is zero, then if the first digit encountered is non-zero, the
base is 10; otherwise the base is 8 unless the next digit is X or x, in
which case it is base 16. This is the usual strtoul() convention, which is
messy. This routine handles the cases of 0<nondigit> and 0x<nondigit> as
the number 0.

OUTPUT
  If A1 was non-zero, (A1) contains a pointer to the unconverted portion of
the string, as does A0.
  If no errors were encountered, D0 contains the number and d1 contains 0.
  If there were no digits, d0 contains UMAX_32 and d1 contains ERR_NONUM.
  If the number overflowed, d0 contains UMAX_32 and d1 contains ERR_RANGE.

--------------------------------------------------------------------------

[33mitostr32/ITOSTR32
[0m
SYNOPSIS
  __D0 char *itostr32( __A0 char *s, __D0 int32 num, __D1 int base );

INPUT
  A0 contains a pointer to the destination.
  D0 contains the signed integer to be represented.
  D1 contains the base in the range 2..36. Any base outside that range is
treated as base 10, but you shouldn't count on this.

OUTPUT
  s contains the representation of the number.
  D0 contains a pointer to just after the terminating \0.

--------------------------------------------------------------------------

[33mutostr32/UTOSTR32
[0m
SYNOPSIS
  __D0 char *utostr32( __A0 char *s, __D0 uint32 num, __D1 int base );

INPUT
  A0 contains a pointer to the destination.
  D0 contains the unsigned integer to be represented.
  D1 contains the base in the range 2..36. Any base outside that range is
treated as base 10, but you shouldn't count on this.

OUTPUT
  s contains the representation of the number.
  D0 contains a pointer to just after the terminating \0.

--------------------------------------------------------------------------

# End Of File #


[31m   <> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <>
[0m

