KW: Is there a recommended set of command line options for Z88DK and the Next?

If you like transforming your statements into code, this is the place for you

Moderator: Programming Moderators


User avatar
MrKWatkins
Posts: 41
Joined: Tue May 30, 2017 8:37 pm

Re: KW: Is there a recommended set of command line options for Z88DK and the Next?

Post by MrKWatkins » Fri Oct 05, 2018 10:00 pm

Alcoholics Anonymous wrote:
Fri Oct 05, 2018 4:49 am
Ah, the command line argument to sccz80.
...On that subject are there any other command line options other than -lm I need to use to get the floating point maths working for the Next? I'm trying to use the roundf function but I'm getting:

Code: Select all

Errors in source file D:\z88dk\lib\config\..\..\\libsrc\_DEVELOPMENT\target\zxn\zxn_crt.asm:
Error at file 'math/float/math48/c/sdcc_iy/cm48_sdcciy_round_fastcall.asm' line 15: symbol 'am48_round' not defined
Any ideas? Might be my code of course...

Alcoholics Anonymous
Posts: 513
Joined: Mon May 29, 2017 7:00 pm

Re: KW: Is there a recommended set of command line options for Z88DK and the Next?

Post by Alcoholics Anonymous » Sat Oct 06, 2018 5:38 am

MrKWatkins wrote:
Fri Oct 05, 2018 10:00 pm
...On that subject are there any other command line options other than -lm I need to use to get the floating point maths working for the Next? I'm trying to use the roundf function but I'm getting:

Code: Select all

Errors in source file D:\z88dk\lib\config\..\..\\libsrc\_DEVELOPMENT\target\zxn\zxn_crt.asm:
Error at file 'math/float/math48/c/sdcc_iy/cm48_sdcciy_round_fastcall.asm' line 15: symbol 'am48_round' not defined
Any ideas? Might be my code of course...
Just -lm is needed but not every function in the standard is implemented. Unfortunately round is one of them (floor, ceil and of course conversion to int/long is there). I probably ran out of gas at that point but if you need it I can maybe finish it off.

The set of functions in the float library is here:

https://github.com/z88dk/z88dk/tree/mas ... math48/z80

Some of those files are empty and those are the ones not implemented. You can't see the file sizes in the web interface but it looks like it's all the ones with the comment "new math48 directory structure to act as template for other math libr…"

User avatar
MrKWatkins
Posts: 41
Joined: Tue May 30, 2017 8:37 pm

Re: KW: Is there a recommended set of command line options for Z88DK and the Next?

Post by MrKWatkins » Sat Oct 06, 2018 10:20 am

Alcoholics Anonymous wrote:
Sat Oct 06, 2018 5:38 am
I probably ran out of gas at that point but if you need it I can maybe finish it off.
No it's not urgent, a cast to byte is good enough for now.

Happy to look at implementing myself if you're accepting pull requests?

Alcoholics Anonymous
Posts: 513
Joined: Mon May 29, 2017 7:00 pm

Re: KW: Is there a recommended set of command line options for Z88DK and the Next?

Post by Alcoholics Anonymous » Sat Oct 06, 2018 3:54 pm

MrKWatkins wrote:
Sat Oct 06, 2018 10:20 am
Happy to look at implementing myself if you're accepting pull requests?
Yes it's open and we always accept pull requests.

The floating point format described by the original programmer (and maybe you recognize the name Anders Hjelsberg :) )
https://github.com/z88dk/z88dk/blob/mas ... AL.txt#L42

A 48-bit float is held in registers BCDEHL; this allows two floats to be held in registers at the same time one in the main set and the other in the EXX set.

The code has been changed by putting the primary accumulator in the EXX set (called AC' for accumulator in the exx set) and the secondary operand in the main set (called AC for accumulator in the main set). Some investigation of floor, ceil, trunc, and the dfix functions may help to understand what has to be done for round.

User avatar
feilipu
Posts: 2
Joined: Mon May 29, 2017 11:17 pm

Re: KW: Is there a recommended set of command line options for Z88DK and the Next?

Post by feilipu » Wed Oct 23, 2019 12:51 am

Since the last post, I've finished a new IEEE 32-bit floating point implementation, which can be linked by either of these options.

Code: Select all

--math32
--math32_z80n
The main advantage over the normal 48-bit math48 or genmath solution is performance.
  • The --math32 linkage provides a z80 standard implementation, using a soft multiply, is about 2x performance of math48 for some benchmarks (n-body).
  • The --math32_z80n linkage is specific to the ZXNext, using the mul de instruction extensively, and is about 5x performance of math48.
More information in the math32 library itself.
Backer #154
Engineering is interesting,
and if you don't agree you can fuck off.
text
code
twitter

Post Reply