| | h8/300 16-bit multiply
|
|
I'm trying to implement a 16bit multiply that leaves a 32bit result on the H8/300. The RCX ROM includes 16x16=16 and 32x32=32 multiplication routines, but not the intermediate step. Any hints or pointers? (it should be straightforward, but my eyes (...) (23 years ago, 27-Feb-02, to lugnet.robotics.rcx)
|
|
| | RE: h8/300 16-bit multiply
|
|
(...) The easiest thing is to cast your 16 bit values to 32 bits and use the built-in 32x32 multiply... Here's the code from pbForth that does it. (It's written in a pseudo- assebler, but you can probably figure it out...) #---...--- # UM* UM* ( u1 (...) (23 years ago, 4-Mar-02, to lugnet.robotics.rcx)
|
|
| | Re: h8/300 16-bit multiply
|
|
Thanks. I have a version just 2 words longer that doesn't use the ROM code. Basically it's the ROM's code, trimmed down after assuming high words are zero initially. It's completely untested though, so there may be a bug. CODE UM* \ 16x16=32 (...) (23 years ago, 4-Mar-02, to lugnet.robotics.rcx)
|
|
| | RE: h8/300 16-bit multiply
|
|
(...) <snipped code...> Are you sure that it works for signed numbers :-) (...) If you like, I can give you some notes on how my Forth was developed. I'm using a simple pseudo-assembler that lets me port this Forth to a new processor in less than a (...) (23 years ago, 4-Mar-02, to lugnet.robotics.rcx)
|