Does this seem eggregious to anyone besides me?

Chat about anything CX16 related that doesn't fit elsewhere
ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

Does this seem eggregious to anyone besides me?

Post by ZeroByte »



On 12/1/2021 at 7:14 PM, Scott Robison said:




My algorithm was fast!



Yeah - you're just over 1 scanline of raster time. Mine's 2.5, General is 18 scan lines.

BruceMcF
Posts: 1336
Joined: Fri Jul 03, 2020 4:27 am

Does this seem eggregious to anyone besides me?

Post by BruceMcF »



On 12/2/2021 at 12:02 PM, ZeroByte said:




Yeah - you're just over 1 scanline of raster time. Mine's 2.5, General is 18 scan lines.



I don't know if my last code above works correctly, but I think it's on the order of 130 clock cycles. Fully unrolled loops saves a lot of that, since even three byte shifts by two bits don't save a lot of space by looping.

Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

Does this seem eggregious to anyone besides me?

Post by Scott Robison »



On 12/2/2021 at 4:39 PM, BruceMcF said:




I don't know if my last code above works correctly, but I think it's on the order of 130 clock cycles. Fully unrolled loops saves a lot of that, since even three byte shifts by two bits don't save a lot of space by looping.



Could be. I didn't analyze the question of "how to efficiently divide by 60". I just tried to find the fastest way to code the original expression given. Not to say I found the fastest way, just that I had noticed all the bit shifts were 8 bits off another bit shift, so I was able to avoid most bit twiddling and just do repeated adds with the bytes aligned to different positions.

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

Does this seem eggregious to anyone besides me?

Post by ZeroByte »


@BruceMcFI'll have to try it out. Do you know offhand how many bytes it compiles down to?

BruceMcF
Posts: 1336
Joined: Fri Jul 03, 2020 4:27 am

Does this seem eggregious to anyone besides me?

Post by BruceMcF »



On 12/3/2021 at 12:29 AM, ZeroByte said:




@BruceMcFI'll have to try it out. Do you know offhand how many bytes it compiles down to?



If I am counting the opcodes correctly, its around 75 bytes.

~~~~~~~~~~~~~~~~~~~~~

@Scott Robison


Quote




Could be. I didn't analyze the question of "how to efficiently divide by 60". I just tried to find the fastest way to code the original expression given. Not to say I found the fastest way, just that I had noticed all the bit shifts were 8 bits off another bit shift, so I was able to avoid most bit twiddling and just do repeated adds with the bytes aligned to different positions.



 



Yes, the difference is between finding an efficient way to find 0.016666... of something and an efficient way to find 0.01666259765625 of something.

For a dividend like 14,400, the difference seems like it would be smaller than the precision of a 16.8 answer.

Post Reply