2018-01-28 18:30:49 +00:00
|
|
|
/*********************************************
|
|
|
|
* stdlib - Standard Library Routines for C02 *
|
|
|
|
*********************************************/
|
|
|
|
|
|
|
|
/* Terminate Program Abnormally */
|
|
|
|
//void abort();
|
|
|
|
|
|
|
|
/* Terminate Program Normally */
|
|
|
|
//void exit();
|
|
|
|
|
|
|
|
/* Absolute Value *
|
|
|
|
* Args: b - Byte to get absolute value of *
|
|
|
|
* Returns: Absolute value of b */
|
|
|
|
char abs();
|
|
|
|
|
|
|
|
/* Convert ASCII String to Unsigned Byte *
|
|
|
|
* Args: &s - String to Convert *
|
2018-07-25 23:00:46 +00:00
|
|
|
* Returns: Numeric value of string *
|
|
|
|
* Number of digits parsed */
|
2018-01-28 18:30:49 +00:00
|
|
|
char atoc();
|
|
|
|
|
|
|
|
/* Convert Unsigned Byte to ASCII String *
|
|
|
|
* Args: c - Unsigned Byte to Convert *
|
2018-07-25 23:00:46 +00:00
|
|
|
* &s - String to populate *
|
|
|
|
* Returns: Length of string */
|
2018-01-28 18:30:49 +00:00
|
|
|
void ctoa();
|
|
|
|
|
2018-07-25 23:00:46 +00:00
|
|
|
/* Divide Unsigned Bytes *
|
|
|
|
* Args: n - Numerator *
|
|
|
|
* d - Denominator *
|
|
|
|
* Returns: Quotient, Remainder */
|
2018-01-28 18:30:49 +00:00
|
|
|
char div();
|
|
|
|
|
|
|
|
/* Maximum of Two Bytes *
|
|
|
|
* Args: b - First Byte *
|
|
|
|
* c - Second Byte *
|
|
|
|
* Returns: Greater of the Two */
|
|
|
|
char max();
|
|
|
|
|
|
|
|
/* Minimum of Two Bytes *
|
|
|
|
* Args: b - First Byte *
|
|
|
|
* c - Second Byte *
|
|
|
|
* Returns: Lesser of the Two */
|
|
|
|
char min();
|
|
|
|
|
2018-07-25 23:00:46 +00:00
|
|
|
/* Multiply Unsigned Bytes *
|
|
|
|
* Args: d - Multiplicand *
|
|
|
|
* r - Multiplier *
|
|
|
|
* Returns: Product LSB, MSB */
|
2018-01-28 18:30:49 +00:00
|
|
|
char mult();
|
|
|
|
|
|
|
|
/* Generate Pseudo-Random Number *
|
|
|
|
* Returns: Random number between 1 and 255 */
|
|
|
|
char rand();
|
|
|
|
|
|
|
|
/* Seed Pseudo-Random Number Generator *
|
|
|
|
* Args: n - Seed number */
|
|
|
|
void srand();
|
|
|
|
|