Formatting 16-bit number as decimal?
Moderator: Moderators
The simplest routines just need to specify how they accept and return values, and what registers they preserve. More complex ones need to specify any memory they use for temporary and persistent variables. That covers most routines. It's not hard at all to make modular libraries. When I realized this years ago, that assembly could be modularized just like C code, my assembly code became much cleaner and easy to work with. As with a high-level language, it helps to work out a small set of techniques, rather than doing obscure, unique things for each routine.
PROTIP: A lot of the time, you can get away with comparing the square of the distance between the two to the square of the sum of their radii, no roots involved.Bregalad wrote:(I use [a square root function as a black box] to compute the distance between an enemy and the player on the screen).
If we standardize local variables to be $0000-$000F, that might make modularization a bit easier.
Re:
This link is dead ... any leads?? Would love to explore some of the fast code.blargg wrote: ↑Mon Apr 05, 2010 11:52 pm Celius, it's interesting how yours are branchless in order to be constant-time.
If you want fastest, we beat that to death a few years ago, with one that at worst does 8-bit in 56 clocks, 16-bit in 208 clocks, and 24-bit in 430 clocks.
Re: Formatting 16-bit number as decimal?
The linked thread can now be found here. We've had some domain and subdomain changes over the years that have broken early links.
Re: Formatting 16-bit number as decimal?
Thank you!
-
- Posts: 1669
- Joined: Tue Feb 07, 2017 2:03 am
Re: Formatting 16-bit number as decimal?
either way the "number converting" section here might be of interest https://codebase64.org/doku.php?id=base:6502_6510_maths