]> git.sur5r.net Git - cc65/blob - libsrc/runtime/umul8x8r16.s
Fix comments and TELEMON uppercase
[cc65] / libsrc / runtime / umul8x8r16.s
1 ;
2 ; Ullrich von Bassewitz, 2010-11-02
3 ;
4 ; CC65 runtime: 8x8 => 16 unsigned multiplication
5 ;
6
7         .export         umul8x8r16, umul8x8r16m
8         .importzp       ptr1, ptr3
9
10
11 ;---------------------------------------------------------------------------
12 ; 8x8 => 16 unsigned multiplication routine.
13 ;
14 ;   LHS            RHS          result      result in also
15 ; -------------------------------------------------------------
16 ;   .A (ptr3-low)  ptr1-low     .XA             ptr1
17 ;
18
19 umul8x8r16:
20         sta     ptr3
21 umul8x8r16m:
22         lda     #0              ; Clear byte 1
23         ldy     #8              ; Number of bits
24         lsr     ptr1            ; Get first bit of RHS into carry
25 @L0:    bcc     @L1
26         clc
27         adc     ptr3
28 @L1:    ror
29         ror     ptr1
30         dey
31         bne     @L0
32         tax
33         stx     ptr1+1          ; Result in .XA and ptr1
34         lda     ptr1            ; Load the result
35         rts                     ; Done