2019-05-27 21:12:10 +00:00
|
|
|
/*********************************************************
|
|
|
|
* intlib - Standard Library Routines for Integer Values *
|
|
|
|
*********************************************************/
|
|
|
|
|
2022-04-04 23:47:16 +00:00
|
|
|
/* Set Integer Accumlator *
|
|
|
|
* Args: int w - Integer value *
|
|
|
|
* Sets: iacc = Argument *
|
|
|
|
* Returns: int w - Argument */
|
|
|
|
char iacc();
|
|
|
|
|
|
|
|
/* Integer Absolute Value *
|
|
|
|
* Args: int w - Integer value *
|
|
|
|
* Sets: iacc = Result *
|
|
|
|
* Returns: int v - Absolute value of w */
|
2019-05-27 21:12:10 +00:00
|
|
|
char iabs();
|
|
|
|
|
2022-04-04 23:47:16 +00:00
|
|
|
/* Integer Add: g + d *
|
|
|
|
* Setup: iset(g) - Augend *
|
|
|
|
* Args: int d - Addend *
|
|
|
|
* Sets: iacc, iover = Result *
|
|
|
|
* Returns: char c - Carry *
|
|
|
|
* int r - Sum */
|
2019-05-27 21:12:10 +00:00
|
|
|
char iadd();
|
|
|
|
|
2022-04-04 23:47:16 +00:00
|
|
|
/* Integer Add Char: c + d *
|
|
|
|
* Args: char c - Augend *
|
|
|
|
* int d - Addend *
|
|
|
|
* Sets: iacc, iover = result *
|
|
|
|
* Returns: char c - Carry *
|
|
|
|
* int r - Sum */
|
|
|
|
char iaddc();
|
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* ASCII to Integer *
|
|
|
|
* Convert ASCII string to Unsigned Integer *
|
|
|
|
* Args: &s - String to Convert *
|
2022-04-04 23:47:16 +00:00
|
|
|
* Sets: iacc = Result *
|
2020-10-06 16:30:20 +00:00
|
|
|
* Returns: char n - Number of digits parsed *
|
|
|
|
* int v - Numeric value of string */
|
2019-05-27 21:12:10 +00:00
|
|
|
char atoi();
|
|
|
|
|
2022-04-04 23:47:16 +00:00
|
|
|
/* Integer to ASCII *
|
|
|
|
* Convert Unsigned Integer to String *
|
|
|
|
* Setup: iset(i) - Unsigned Int to Convert *
|
|
|
|
* Args: &s - Destination String *
|
|
|
|
* Sets: iacc = Argument *
|
|
|
|
* Returns: char n - Length of string */
|
2019-05-27 21:12:10 +00:00
|
|
|
void itoa();
|
|
|
|
|
2022-04-04 23:47:16 +00:00
|
|
|
/* Integer unsigned Divide *
|
|
|
|
* Aetup: iset (n) - Numerator *
|
|
|
|
* Args: int d - Denominator *
|
|
|
|
* Sets: iacc = Quotient *
|
|
|
|
* Returns: int q - Quotient */
|
2019-05-27 21:12:10 +00:00
|
|
|
char idiv();
|
|
|
|
|
2022-04-04 23:47:16 +00:00
|
|
|
/* Integer unsigned Maximum *
|
2020-10-06 16:30:20 +00:00
|
|
|
* Return Largest of Two Integers *
|
2022-04-04 23:47:16 +00:00
|
|
|
* Setup: iset(i) - First Integer *
|
2020-10-06 16:30:20 +00:00
|
|
|
* Args: int j - Second Integer *
|
2022-04-04 23:47:16 +00:00
|
|
|
* Sets: iacc = Result *
|
2020-10-06 16:30:20 +00:00
|
|
|
* Returns: int m - Greater of the Two */
|
|
|
|
char imax();
|
2019-05-27 21:12:10 +00:00
|
|
|
|
2022-04-04 23:47:16 +00:00
|
|
|
/* Integer unsigned Minimum *
|
|
|
|
* Return smallest of Two Integers *
|
|
|
|
* Setup: setsrc(i) - First Integer *
|
|
|
|
* Args: int j - Second Integer *
|
|
|
|
* Sets: iacc = Result *
|
|
|
|
* Returns: int m - Lesser of the Two */
|
2020-10-06 16:30:20 +00:00
|
|
|
char imin();
|
2019-05-27 21:12:10 +00:00
|
|
|
|
2022-04-04 23:47:16 +00:00
|
|
|
/* Integer unsigned Modulo *
|
|
|
|
* Aetup: iset(n) - Numerator *
|
|
|
|
* Args: int d - Denominator *
|
|
|
|
* Sets: iacc = Result *
|
|
|
|
* Returns: int q - Modulus */
|
|
|
|
char idiv();
|
|
|
|
|
|
|
|
/* Integer unsigned Multiply: m * r *
|
|
|
|
* Setup: iset(m) - Muliplicand *
|
|
|
|
* Args: int r - Multiplier *
|
|
|
|
* Sets: iacc, iover = 32 bit Product *
|
|
|
|
* Returns: long p - 24 bit Product */
|
|
|
|
char imult();
|
|
|
|
|
|
|
|
/* Integer Multiply Char: c * r *
|
|
|
|
* Args: int c - Multplicand
|
|
|
|
* int r - Multiplier *
|
|
|
|
* Sets: iacc, iover = 32 bit Product *
|
|
|
|
* Returns: long p - 24 bit Product */
|
2020-10-06 16:30:20 +00:00
|
|
|
char imult();
|
2019-05-27 21:12:10 +00:00
|
|
|
|
2022-04-04 23:47:16 +00:00
|
|
|
/* Integer Shift Left *
|
|
|
|
* Args: char n - Number of Bits *
|
|
|
|
* int w - Value to Shift *
|
|
|
|
* Sets: iacc = Integer result *
|
|
|
|
* iover = Integer Overflow *
|
|
|
|
* Returns: long p - 24 bit Result */
|
2019-05-27 21:12:10 +00:00
|
|
|
char ishftl();
|
|
|
|
|
2022-04-04 23:47:16 +00:00
|
|
|
/* Integer Shift Right *
|
2020-10-06 16:30:20 +00:00
|
|
|
* Args: char n - Number of Bits *
|
|
|
|
* int w - Value to Shift *
|
2022-04-04 23:47:16 +00:00
|
|
|
* Sets: iacc = Integer result *
|
|
|
|
* iover = Integer Underflow *
|
|
|
|
* Returns: char u - Underflow Bits *
|
2020-10-06 16:30:20 +00:00
|
|
|
int r - Shifted Integer */
|
2019-05-27 21:12:10 +00:00
|
|
|
char ishftr();
|
|
|
|
|
2022-04-04 23:47:16 +00:00
|
|
|
/* Integer Subtract: m - s *
|
|
|
|
* Setup: iaet(m) - Minuend *
|
|
|
|
* Args: int s - Subtrahend *
|
|
|
|
* Sets: iacc, iover = result *
|
|
|
|
* Returns: char c - Carry *
|
|
|
|
* int d - Difference */
|
2019-05-27 21:12:10 +00:00
|
|
|
char isub();
|