Hi Many many thx i have a look at this later when i wake up (get filled with coffee)....and you right the my example only works with a word and i have to show numbers in the hundred thousand so my routine would not work. and it would take around 500 clk cycles.

Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend

FedePede04 wrote:am i completely wrong when i saying, that you get the value as a CHR (string) and not a value form 0-9?

Yes, that is correct! You get a string of ascii characters, ready to print. I guess it's possible to convert to 0-9 values if you change the '0' constants loaded to 0 (and probably a few other things). I can take a look if you can't figure it out

if you like to have a look, then i would be very happy, i have a hard time to overlook this routine.my brain is pretty scramble at the moment, been very stress over a long period, so i does not work like it use to

Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend

mikro wrote:Out of curiosity, why would you want an optimised routine for task like this?

btw i forgot to say it is a Spectrum game from 1983 (msx1984) (done on many platforms) that i am play around withbut i doing it from the ground and up not using any of the original code, i have taken the original graphic and started to recolor it so it look more 16bit(i don't know how its going to look, I am not the greatest artist out there )

but again i am doing it more for fun(and to try to keep my brain fit) so hopeful i wont go dead in it and can release it later this year.....

Last edited by FedePede04 on Fri Jun 01, 2018 10:53 am, edited 2 times in total.

Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend

Mange Tak i have seen the BCD instruction before, never really got around to use it..for some reason i like my program to use hex numbers inside and to show decimal on the screen.i tried my code snipe about that i made, and i work, it take around 1.5 scanline, and with printing 6 char it take around 7 scanlines, the print routine can be optimized but i don't really think for the moment that i need to do it.

Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend

FedePede04 wrote:for some reason i like my program to use hex numbers inside and to show decimal on the screen.

You can have two separate variables, one normal int that you use for logic (e.g. bonus life when achieving a certain score) and one BCD used for display. Just increment both at the same time.

yes i can see that, but i think this over complicate the things, in this situation..

with the test i have done on the graphic, it look when i animate the sprite i have to skip 3 raster to make it look at the right speed, also i only have to have 8 16x16 sprite on the screen at the same time.

so in reality i have plenty of time, i just don't like to use Divu/Divs on the 68000, and i also wanted to to hear if other had some good idea.but i have learn some great things today, how the Divu can fail and also about BCD instruction, that i can use later so thx all

Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend

FedePede04 wrote:... i just don't like to use Divu/Divs on the 68000, and i also wanted to to hear if other had some good idea.but i have learn some great things today, how the Divu can fail and also about BCD instruction, that i can use later so thx all

What you essentially need (probably not, but you asked for it and I think it's a nice opportunity to show something - at least I consider - smart from a book I own ) is a fast replacement for a division by 10 that preserves the division rest (x / 10, x % 10).

At least on Hatari (and using a C compiler), that said algorithm is roughly 6 times faster than a plain div/mod (don't know how it does on real hw).

The idea is to replace the division with a multiplication of the inverse of the divisor and replace that with an approximation of shifts and adds. This will produce a (known) error that needs to be accounted for in the end:

FedePede04 wrote:... i just don't like to use Divu/Divs on the 68000, and i also wanted to to hear if other had some good idea.but i have learn some great things today, how the Divu can fail and also about BCD instruction, that i can use later so thx all

What you essentially need (probably not, but you asked for it and I think it's a nice opportunity to show something - at least I consider - smart from a book I own ) is a fast replacement for a division by 10 that preserves the division rest (x / 10, x % 10).

At least on Hatari (and using a C compiler), that said algorithm is roughly 6 times faster than a plain div/mod (don't know how it does on real hw).

The idea is to replace the division with a multiplication of the inverse of the divisor and replace that with an approximation of shifts and adds. This will produce a (known) error that needs to be accounted for in the end:

Again, you can remove the "move.b d0,(a0)+" and bsr to your PrintTheOne subroutine I guess. But I would imagine that since you want to print the score you'd kinda want to have ASCII values? But I might have misread - anyway, all good fun