2 ; Ullrich von Bassewitz, 2011-07-10
4 ; CC65 runtime: 8x16 => 24 unsigned multiplication
7 .export umul8x16r24, umul8x16r24m
8 .export umul8x16r16, umul8x16r16m
10 .include "zeropage.inc"
13 ;---------------------------------------------------------------------------
14 ; 8x16 => 24 unsigned multiplication routine. Because the overhead for a
15 ; 8x16 => 16 unsigned multiplication routine is small, we will tag it with
16 ; the matching labels as well.
18 ; routine lhs rhs result result also in
19 ; -----------------------------------------------------------------------
20 ; umul8x16r24 ptr1-lo ax ax:sreg-lo ptr1:sreg-lo
21 ; umul8x16r24m ptr1-lo ptr3 ax:sreg-lo ptr1:sreg-lo
23 ; ptr3 ist left intact by the routine.
37 ldy #8 ; Number of bits
38 ldx ptr3 ; Get into register for speed
40 ror a ; Get next bit into carry
59 sta ptr1 ; Save low byte of result
60 ldx ptr1+1 ; Load high byte of result