/* */
/* */
/* */
-/* (C) 2009, Ullrich von Bassewitz */
+/* (C) 2009-2011, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
unsigned __fastcall__ cc65_umul8x8r16 (unsigned char lhs, unsigned char rhs);
/* Multiplicate two unsigned 8 bit to yield an unsigned 16 bit result */
+unsigned long __fastcall__ cc65_umul16x8r32 (unsigned lhs, unsigned char rhs);
+/* Multiplicate an unsigned 16 bit by an unsigned 8 bit number yielding a 24
+ * bit unsigned result that is extended to 32 bits for easier handling from C.
+ */
+
unsigned long __fastcall__ cc65_umul16x16r32 (unsigned lhs, unsigned rhs);
/* Multiplicate two unsigned 16 bit to yield an unsigned 32 bit result */
--- /dev/null
+;
+; Ullrich von Bassewitz, 2011-07-10
+;
+; CC65 library: 16x8 => 32 unsigned multiplication
+;
+
+ .export _cc65_umul16x8r32
+ .import umul8x16r24, popax
+
+ .include "zeropage.inc"
+
+
+;---------------------------------------------------------------------------
+; 16x8 => 32 unsigned multiplication routine. We use 8x16 => 24 and clear
+; the high byte of the result
+
+.proc _cc65_umul16x8r32
+
+ sta ptr1
+ lda #0
+ sta sreg+1 ; Clear high byte of result
+ jsr popax
+ jmp umul8x16r24
+
+.endproc
+
+