Skip to content

Add a fast 16x16=16 multiplication algorithm#8

Merged
TobyLobster merged 1 commit intoTobyLobster:mainfrom
colinleroy:main
Aug 7, 2025
Merged

Add a fast 16x16=16 multiplication algorithm#8
TobyLobster merged 1 commit intoTobyLobster:mainfrom
colinleroy:main

Conversation

@colinleroy
Copy link
Copy Markdown
Contributor

Hope I did things correctly :)

16 bit x 16 bit unsigned multiply, 16 bit result (low-bytes)
Average cycles: 138.35
2144 bytes

@TobyLobster TobyLobster merged commit 0e94101 into TobyLobster:main Aug 7, 2025
@colinleroy
Copy link
Copy Markdown
Contributor Author

Thanks :)
By the way, would you be interested in setting up a division_test repo? I found it hard to find resources on fast division for the 6502. In the project where I need division (16 bits by 8 bits), I used an approximate algorithm based on inverse multiplication and that 16x16=16 multiplication algorithm: https://github.com/colinleroy/a2tools/blob/master/src/lib/approxdiv16x8.s
I'd love to see other options (ideally faster 😅)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants