Super Fast binary to decimal routine

Página 2/2
1 |

Por retrocanada76

Hero (542)

Imagen del retrocanada76

14-10-2011, 23:00

The unrolling gets the best performance cause you don't add 0's or make conditional jumps to avoid them. I don't think 593 bytes is a really bad routine Smile

We can do a semi-unrolled, that will take bits 0 - 6 (1 byte BCD) , 7 - 13 (2-byte BCD), and so on avoiding adding zeroes. That would be smaller. And we can remove all #00's from the LUT.

Por ARTRAG

Enlighted (6923)

Imagen del ARTRAG

14-10-2011, 23:17

My two cent: if you use this code for printing score to the screen, you do not need to update it at full frame rate
You can keep trace of the score in ram in binary form and print it once out 20 frames

Por PingPong

Prophet (4093)

Imagen del PingPong

15-10-2011, 12:41

My two cent: if you use this code for printing score to the screen, you do not need to update it at full frame rate
You can keep trace of the score in ram in binary form and print it once out 20 frames

effectively.... Smile

Por bore

Master (161)

Imagen del bore

15-10-2011, 13:00

We can do a semi-unrolled, that will take bits 0 - 6 (1 byte BCD) , 7 - 13 (2-byte BCD), and so on avoiding adding zeroes. That would be smaller. And we can remove all #00's from the LUT.

Well, sort of, there are a few places where you add 0 but the result can be increased anyway becasue of a carry. In those cases you will still need to add 0 or do some other trick to add the carry to the result.
The current function also relies on the input data for looping. To loop sizes that are fractions of input bytes you will need to deal with a loop counter so I doubt that you can make it faster that way.
Perhaps you can use the table address in HL to count iterations.

Página 2/2
1 |