User Tools

Site Tools


base:fastest_multiplication_2023

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
base:fastest_multiplication_2023 [2024-02-13 07:57] reposebase:fastest_multiplication_2023 [2024-02-13 08:11] (current) – missing comments in first multiplication repose
Line 1: Line 1:
 The research continues in 2023 and the fastest multiply got faster! The research continues in 2023 and the fastest multiply got faster!
-Thanks to a 6502 simulator written in C and the analyzing of statistics in the program branches and boundary crossings, the exact speed of routines are now known. This analysis has inspired new optimizations! The new routine executes in a blazing 187.1 cycles on average (a 6% speedup or 11.5 cycles faster from my original code which was 198.6), with inputs in zero page and outputs in zero page plus two registers, not including caller setup or RTS. \\+Thanks to a 6502 simulator written in C and the analyzing of statistics in the program branches and boundary crossings, the exact speed of routines are now known. This analysis has inspired new optimizations! The new routine executes in a blazing 187.1 cycles on average (a 6% speedup or 11.5 cycles faster from my original code which was 198.6), with inputs in zero page and outputs in zero page plus two registers, not including caller setup or RTS. 14 bytes of zp, 2044 in tables, 112 bytes of code. The claim to "fastest" is based on tests of over 100 published routines here: https://github.com/tobyLobster/multiply_test/?tab=readme-ov-file#the-results\\
 Code in ACME assembly format. Please adjust addresses to be usable for your situation. Code in ACME assembly format. Please adjust addresses to be usable for your situation.
 <code> <code>
-from 6502.org, by Repose: http://forum.6502.org/viewtopic.php?p=106519#p106519+World's fastest unsigned 16x16=32 bit multiply2023 version by Repose
 ; ;
 ; 16 bit x 16 bit unsigned multiply, 32 bit result ; 16 bit x 16 bit unsigned multiply, 32 bit result
Line 33: Line 33:
  
 ; Align tables to start of page ; Align tables to start of page
 +; Note - the last byte of each table is never referenced, as a+b<=510
 sqrlo sqrlo
     !for i, 0, 511 {     !for i, 0, 511 {
Line 74: Line 75:
     ; set multiplicand as y0     ; set multiplicand as y0
     ldy y0     ldy y0
 +    
 +    ;x1y0l =  low(x1*y0)
 +    ;x1y0h = high(x1*y0)
     sec     sec
     lda (p_sqr_lo),y     lda (p_sqr_lo),y
base/fastest_multiplication_2023.1707807464.txt.gz · Last modified: 2024-02-13 07:57 by repose