We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS

Bithacks

From SnesLab
Revision as of 07:24, 6 April 2021 by Runic Rain (talk | contribs) (A community page containing bithacks for the 65c816)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Bithacks are optimization tricks that utilize information in bits and bit manipulation to accomplish their tasks. Usually they work in a slightly non-obvious way, (the most famous being the fast inverse sqrt), and bit manipulation in general is harder on the 65c816. To that end here is a collection of some useful tricks.

Math Bithacks

Signed Division By 2 (5 bytes / 10 cycles)
inputs: A
outputs: A

STA $00
ASL $00
ROR