Written By - Sandeep Dutta . sandeep.dutta@usa.net (1999)
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
- This program is distributed in the hope that it will be useful,
+ This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ GNU Library General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
{
a*b; // hush the compiler
- // muluint=(int)(lsb_a*lsb_b) + (char)(msb_a*msb_b)<<8
- // ^^^
+ /* muluint=
+ (int)(lsb_a*lsb_b) +
+ (char)(msb_a*lsb_b)<<8 +
+ (char)(lsb_a*msb_b)<<8
+ */
_asm
- push dph ; msb_a
- mov b,dpl ; lsb_a
+ mov r2,dph ; msb_a
+ mov r3,dpl ; lsb_a
+
+ mov b,r3 ; lsb_a
mov dptr,#__muluint_PARM_2
movx a,@dptr ; lsb_b
- mul ab
+ mul ab ; lsb_a*lsb_b
mov r0,a
mov r1,b
- pop b ; msb_a
+
+ mov b,r2 ; msb_a
+ movx a,@dptr ; lsb_b
+ mul ab ; msb_a*lsb_b
+ add a,r1
+ mov r1,a
+
+ mov b,r3 ; lsb_a
inc dptr
movx a,@dptr ; msb_b
- mul ab
+ mul ab ; lsb_a*msb_b
add a,r1
+
mov dph,a
mov dpl,r0
ret