User Tools

Site Tools


base:8bit_multiplication_16bit_product_fast_no_tables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
base:8bit_multiplication_16bit_product_fast_no_tables [2020-02-02 22:00] djmipsbase:8bit_multiplication_16bit_product_fast_no_tables [2020-02-09 12:28] djmips
Line 3: Line 3:
 ; by djmips  ; by djmips 
 ; ;
-; inputs are mul1 and mul2 and should be zero +; inputs are mul1 and mul2 and should be zero page.  
-output is 16 bit in A : mul1+A should be zero entering but if you want it will factor in as 1/2 added to the result.
 ; ;
 +; output is 16 bit in A : mul1   (A is high byte)
 +;
 +; length = 65 bytes 
 ; total cycles worst case = 113 ; total cycles worst case = 113
 ; total cycles best case = 97 ; total cycles best case = 97
Line 12: Line 15:
  
 MUL: MUL:
-     dec mul2 ;5  ; decrement mul2 because we will be adding with carry set for speed (an extra one) +     dec mul2 ; decrement mul2 because we will be adding with carry set for speed (an extra one) 
-     ror mul1 ;5      \ +     ror mul1 
-     bcc b1   ;2/3      Best case 8 Worst case 10 +     bcc b1 
-     adc mul2 ;3       / +     adc mul2 
-b1: ror     ;2       \ +b1:  ror 
-     ror mul1 ;5         \ +     ror mul1 
-     bcc b2   ;2/3      /  Best case 10 Worst case 12 +     bcc b2 
-     adc mul2 ;3       /   +     adc mul2
 b2:  ror b2:  ror
      ror mul1      ror mul1
      bcc b3      bcc b3
-     adc mul2  ; 10 or 12+     adc mul2
 b3:  ror b3:  ror
      ror mul1      ror mul1
      bcc b4      bcc b4
-     adc mul2  ; 10 or 12+     adc mul2
 b4:  ror b4:  ror
      ror mul1      ror mul1
      bcc b5      bcc b5
-     adc mul2   ; 10 or 12 +     adc mul2
 b5:  ror b5:  ror
      ror mul1      ror mul1
      bcc b6      bcc b6
-     adc mul2   ; 10 or 12 +     adc mul2
 b6:  ror b6:  ror
      ror mul1      ror mul1
      bcc b7      bcc b7
-     adc mul2   ; 10 or 12 +     adc mul2
 b7:  ror b7:  ror
      ror mul1      ror mul1
      bcc b8      bcc b8
-     adc mul2  ; 10 or 12 +     adc mul2 
-b8:  ror    ; 2 +b8:  ror 
-     ror mul1  ; 5 +     ror mul1 
-     inc mul2  ; 5+     inc mul2
      rts      rts
 </code> </code>
  
  
base/8bit_multiplication_16bit_product_fast_no_tables.txt · Last modified: 2023-03-15 03:25 by djmips