...
so apart from the different restart number, much the same as the OS calls. In the text we will assume a macro has been defined and use the following:
FPP <function symbol>mnemonic>
Parameters are passed to and from the FPP in a rather bizarre collection of registers. The main register group is HLhlC (remember, lower case for alternate set), and where a second parameter is required it is passed in DEdeB. These divide into mantissa and exponent as follows:
...
There are certain exceptions, which are explained where relevant (for instance one operation returns the numeric value of a string, so takes a pointer to the string in HL as its parameter). Here is the full list of parameter bytes and the FPP functions which they invoke. First number is the index number of the operation for FP_BAS. Second number is the RST 18H function code:
Mnemonic | RST codeFunction Index Number | Function Code | Functionality | Description |
---|---|---|---|---|
FP_AND | 0 | $21 | (Integer only) bitwise logical AND | Input parameters in HLhlC and DEdeB. Result in HLhlC. |
FP_IDV | 1 | $24 | (Integer only) quotient after division | Input parameters in HLhlC and DEdeB (returns HLhlC / DEdeB). Result in HLhlC. |
FP_EOR | 2 | $27 | (Integer only) bitwise logical excusive OR | Input parameters in HLhlC and DEdeB. Result in HLhlC. |
FP_MOD | 3 | $2A | (Integer only) remainder after division | Input parameters in HLhlC and DEdeB (returns the remainder of HLhlC / DEdeB). Result in HLhlC. |
FP_OR | 4 | $2D | (Integer only) bitwise logical OR | Input parameters in HLhlC and DEdeB. Result in HLhlC. |
FP_LEQ | 5 | $30 | Test for less than or equal to | Input parameters in HLhlC and DEdeB (test is HLhlC <= DEdeB). Result in HLhlC (-1 for TRUE; 0 for FALSE). |
FP_NEQ | 6 | $33 | Test for not equal to | Input parameters in HLhlC and DEdeB. Result in HLhlC (-1 for TRUE; 0 for FALSE). |
FP_GEQ | 7 | $36 | Test for greater than or equal to | Input parameters in HLhlC and DEdeB (test is HLhlC >= DEdeB). Result in HLhlC (-1 for TRUE; 0 for FALSE). |
FP_LT | 8 | $39 | Test for less than | Input parameters in HLhlC and DEdeB (test is HLhlC < DEdeB). Result in HLhlC (-1 for TRUE; 0 for FALSE). |
FP_EQ | 9 | $3C | Test for equality | Input parameters in HLhlC and DEdeB. Result in HLhlC (-1 for TRUE; 0 for FALSE). |
FP_MUL | 10 | $3F | Multiplication | Input parameters in HLhlC and DEdeB. Result in HLhlC. |
FP_ADD | 11 | $42 | Addition | Input parameters in HLhlC and DEdeB. Result in HLhlC. |
FP_GT | 12 | $45 | Test for greater than | Input parameters in HLhlC and DEdeB (test is HLhlC > DEdeB). Result in HLhlC (-1 for TRUE; 0 for FALSE). |
FP_SUB | 13 | $48 | Subtraction | Input parameters in HLhlC and DEdeB (returns HLhlC - DEdeB). Result in HLhlC. |
FP_PWR | 14 | $4B | Raise to power | Input parameters in HLhlC and DEdeB (returns HLhlC ^ DEdeB). Result in HLhlC. |
FP_DIV | 15 | $4E | Division | Input parameters in HLhlC and DEdeB (returns HLhlC / DEdeB). Result in HLhlC. |
FP_ABS | 16 | $51 | Magnitude (ABSolute value) | Input parameters in HLhlC. Result in HLhlC. |
FP_ACS | 17 | $54 | Inverse cosine (Arc CoSine) | Input parameters in HLhlC. Result in HLhlC, in radians. |
FP_ASN | 18 | $57 | Inverse sine (Arc SiNe) | Input parameters in HLhlC. Result in HLhlC, in radians. |
FP_ATN | 19 | $5A | Inverse tangent (Arc TaNgent) | Input parameters in HLhlC. Result in HLhlC, in radians. |
FP_COS | 20 | $5D | Cosine | Input parameters in HLhlC, in radians. Result in HLhlC. |
FP_DEG | 21 | $60 | Convert radians to degrees | Input parameters in HLhlC, in radians. Result in HLhlC, in degrees. |
FP_EXP | 22 | $63 | Exponentiation | Raise 'e' [2.718...] to power of. Input parameters in HLhlC. Result in HLhlC. |
FP_INT | 23 | $66 | Integer truncation | (floor truncation, not rounding) Input parameters in HLhlC. Result in HLhlC. |
FP_LN | 24 | $69 | Natural (Naperian or base 'e') logarithm | Input parameters in HLhlC. Result in HLhlC. |
FP_LOG | 25 | $6C | Common (base 10) logarithm | Input parameters in HLhlC. Result in HLhlC. |
FP_NOT | 26 | $6F | (Integer only) bitwise logical NOT | Input parameters in HLhlC. Result in HLhlC. |
FP_RAD | 27 | $72 | Convert degrees to radians | Input parameters in HLhlC, in degrees. Result in HLhlC, in radians. |
FP_SGN | 28 | $75 | Sign (signum) | Input parameters in HLhlC. Result in HLhlC. |
FP_SIN | 29 | $78 | Sine | Input parameters in HLhlC, in radians. Result in HLhlC. |
FP_SQR | 30 | $7B | Square root | Input parameters in HLhlC. Result in HLhlC. |
FP_TAN | 31 | $7E | Tangent | Input parameters in HLhlC, in radians. Result in HLhlC. |
FP_ZER | 32 | $81 | Return the constant zero (as an integer) | Input irrelevant. Result in HLhlC (all zero). |
FP_ONE | 33 | $84 | Return the floating point constant 1 | Input irrelevant. Result in HLhlC (HL=hl=0, C=$80) |
FP_TRU | 34 | $87 | Return the integer constant -1 | Input irrelevant. Result in HLhlC (HL=hl=$FFFF, C=$00) |
FP_PI | 35 | $8A | Returns pi | (the floating point representation of pi) Input irrelevant. Result in HLhlC. |
FP_VAL | 36 | $8D | Returns the numeric value of a string | HL points to start of string (null-terminated). Result in HLhlC, and DE points to last character read; if the call succeeded, this will be the terminator byte. If the call failed, HLhlC = 0. |
FP_STR | 37 | $90 | Return string representation of number | Number to convert to string, in in HLhlC. DE points to space to insert string. DE points to character after string when call returns. The de (alternate) register pair contains a format control variable which has the effect of the two middle bytes of the BBC BASIC format control variable @%:
|
FP_FIX | 38 | $93 | Round a number to integer | Input parameters in HLhlC (the call has no effect with C=0). Result in HLhlC. |
FP_FLT | 39 | $96 | Convert from integer to floating point | Input parameters in HLhlC (the call has no effect with C<>0). Result in HLhlC. |
FP_TST | 40 | $99 | Test a number for zero and sign | Input parameters in HLhlC. Result in A (0 for zero; $40 for positive; $C0 for negative). |
FP_CMP | 41 | $9C | Compare two numeric values | Input parameters in HLhlC (left) and DEdeB (right). Result in A:
|
FP_NEG | 42 | $9F | Negate number, ie. result = -input | Input parameters in HLhlC. Result in HLhlC. |
FP_BAS | $A2 | Execute operation using index number | Perform one of the above functions using the operation index number in A, eg.: ld a, 33 should call FP_ONE and return 1 (floating point). This facility can be useful if the operation depends on some parameter, to avoid writing selfmodifying code. |