Page Last Altered:

**Submitted by Steve Fewell**

**Description**:

[9F3B:] Check the value type (in A).

If variable type = 0 then issue a Type Mismatch error.

If variable type is negative then the first value is a Float, so jump to &9F23, which

does the following:

* Push FWA to Stack

* Get the second value from the expression handler (level 6) [A012]

* If second value is a String then generate a Type Mismatch error. [96DD]

* If second value is an Integer then convert it to a Float [96DD]

* Pop the first Float value from Stack to argp (&4A, &4B)

* Call the Floating-Point Multiplication routine to multiply the values (&A6A6)

* Set A = #&FF, as we have a Floating-Point result.

* Jump to 9FCA (Expression handler level 5) to check for further *,/,MOD or DIV operators.

Otherwise, the value is Integer.

If the IWA byte 4 or IWA byte 3 is zero or the top bit of IWA byte 2 is set,

then we are dealing with a large number, so we will need to use Floating-Point multiplication

(as the result will most likely not be an integer), so call 9F20. [Note: What happens if the IWA

contains &10FFFFFF, it looks like Floating-Point multiplication will not be used for this!].

9F20 does the following:

* Convert the Integer in the IWA to a Float (FWA).

* Push FWA to Stack

* Get the second value from the expression handler (level 6) [A012]

* If second value is a String then generate a Type Mismatch error. [96DD]

* If second value is an Integer then convert it to a Float [96DD]

* Pop the first Float value from Stack to argp (&4A, &4B)

* Call the Floating-Point Multiplication routine to multiply the values (&A6A6)

* Set A = #&FF, as we have a Floating-Point result.

* Jump to 9FCA (Expression handler level 5) to check for further *,/,MOD or DIV operators.

Otherwise, the first value (multiplicand) is an integer which isn't too large,

so push the first value to the stack and call the Expression Handler level 6 routine

(&A00F) to get the second value to multiply (the multiplier).

If the second value is a string then generate a Type Mismatch error.

If the second value is a Float then jump to &9F15 to do the following:

* Pop the first value (the Integer) from the Stack

* Push the second value (the Float) to the Stack

* Convert the Integer to a Float (and put it in the FWA).

* Pop the second Float value from Stack to argp (&4A, &4B)

* Call the Floating-Point Multiplication routine to multiply the values (&A6A6)

* Set A = #&FF, as we have a Floating-Point result.

* Jump to 9FCA (Expression handler level 5) to check for further *,/,MOD or DIV operators.

Otherwise, check whether the second value is too large for Integer multiplication

routine (it's too large if IWA byte 3 or 4 is not 0, or top bit of byte 2 is 1).

If the second value is too large for Integer Multiplication then jump to &9F12

to do the following:

* Convert the second value (which is Integer) to a Float

* Pop the first value (also an Integer) from the Stack

* Push the second value (the Float) to the Stack

* Convert the Integer to a Float (and put it in the FWA).

* Pop the second Float value from Stack to argp (&4A, &4B)

* Call the Floating-Point Multiplication routine to multiply the values (&A6A6)

* Set A = #&FF, as we have a Floating-Point result.

* Jump to 9FCA (Expression handler level 5) to check for further *,/,MOD or DIV operators.

Otherwise, both Integers are in the required range, so do the Integer Multiplication

routine (&9F64).

This routine automatically jumps back to 9FCA on completion, to check for further *,/,

MOD or DIV operators.

9F12 | 032 133 129 | 20 85 81 | JSR &8185 Convert Integer to Float | |

9F15 | 032 230 188 | 20 E6 BC | JSR &BCE6 Pop Integer from Stack | |

9F18 | 032 250 187 | 20 FA BB | JSR &BBFA Push FWA to Stack | |

9F1B | 032 133 129 | 20 85 81 | JSR &8185 Convert Integer to Float | |

9F1E | 128 013 | 80 0D | BRA 13 --> &9F2D | |

9F20 | 032 133 129 | 20 85 81 | JSR &8185 Convert Integer to Float | |

9F23 | 032 250 187 | 20 FA BB | JSR &BBFA Push FWA to Stack | |

9F26 | 032 018 160 | 20 12 A0 | JSR &A012 Expression handler Level 6 [Skip Spaces, ^] | |

9F29 | 168 | A8 | TAY | |

9F2A | 032 221 150 | 20 DD 96 | JSR &96DD Check Result Type (& If Int, Convert to Float) | |

9F2D | 032 232 187 | 20 E8 BB | JSR &BBE8 Pop Float to argp | |

9F30 | 032 166 166 | 20 A6 A6 | JSR &A6A6 Floating-Point multiplication | |

9F33 | 169 255 | A9 FF | LDA#&FF | |

9F35 | L | 076 202 159 | 4C CA 9F | JMP &9FCA Check for further *,/,MOD or DIV operators |

9F38 | L | 076 146 144 | 4C 92 90 | JMP &9092 Type Mismatch error |

9F3B | 168 | A8 | TAY | |

9F3C | 240 250 | F0 FA | BEQ -6 --> &9F38 | |

9F3E | 0 | 048 227 | 30 E3 | BMI -29 --> &9F23 |

9F40 | - | 164 045 | A4 2D | LDY &2D |

9F42 | , | 196 044 | C4 2C | CPY &2C |

9F44 | 208 218 | D0 DA | BNE -38 --> &9F20 | |

9F46 | + | 165 043 | A5 2B | LDA &2B |

9F48 | 010 | 0A | ASL A | |

9F49 | 152 | 98 | TYA | |

9F4A | i | 105 000 | 69 00 | ADC#&00 |

9F4C | 208 210 | D0 D2 | BNE -46 --> &9F20 | |

9F4E | 032 015 160 | 20 0F A0 | JSR &A00F Push Integer & Expression handler Level 6 [^] | |

9F51 | 168 | A8 | TAY | |

9F52 | 240 228 | F0 E4 | BEQ -28 --> &9F38 | |

9F54 | 0 | 048 191 | 30 BF | BMI -65 --> &9F15 |

9F56 | - | 164 045 | A4 2D | LDY &2D |

9F58 | , | 196 044 | C4 2C | CPY &2C |

9F5A | 208 182 | D0 B6 | BNE -74 --> &9F12 | |

9F5C | + | 165 043 | A5 2B | LDA &2B |

9F5E | 010 | 0A | ASL A | |

9F5F | 152 | 98 | TYA | |

9F60 | i | 105 000 | 69 00 | ADC#&00 |

9F62 | 208 174 | D0 AE | BNE -82 --> &9F12 | |

9F64 | ...imult Integer Multiplication |