• CP/M-68k C floating point

    From Nick@21:1/5 to All on Thu Mar 28 19:18:30 2024
    Is the floating point broken in the DRI (Alcyon Corp?) C compiler in
    CP/M-68k? I can compile and link a simple test program against libf.a
    and clib, but it prints garbage where I would expect a formatted
    floating point number.

    main()
    {
    float afloat;
    afloat= 3.142;
    printf("%6.3f\n", afloat);
    printf("Did it float?\n");
    }


    fptest
    0.;42
    Did it float?

    On a positive note, Pascal MT68's floating point does work.

    --
    Nick

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nick@21:1/5 to David Schultz on Thu Mar 28 21:12:08 2024
    On 28/03/2024 20:23, David Schultz wrote:
    On 3/28/24 2:18 PM, Nick wrote:
    main()
    {
       float afloat;cp68 -i 0: $1.c $1.i
    c068 $1.i $1.1 $1.2 $1.3 -e
    era $1.i
    c168 $1.1 $1.2 $1.s
    era $1.1
    era $1.2
    as68 -l -u -s 0: $1.s
    era $1.s

       afloat= 3.142;
       printf("%6.3f\n", afloat);
       printf("Did it float?\n");
    }

    Since this works for me, what I want to know is exactly how you built it.


    I'm using the sub files included in the distribution. My file is FPTEST.C.

    "CE FPTEST" followed by "CLINKE FPTEST"

    CE.SUB:

    cp68 -i 0: $1.c $1.i
    c068 $1.i $1.1 $1.2 $1.3 -e
    era $1.i
    c168 $1.1 $1.2 $1.s
    era $1.1
    era $1.2
    as68 -l -u -s 0: $1.s
    era $1.s

    CLINKE.SUB:

    lo68 -r -o $1.68k 0:s.o $1.o $2.o $3.o $4.o $5.o $6.o $7.o $8.o $9.o
    0:clib 0:libe.a


    I'm using the software supplied for my 68k-MBC which is supposed to be a
    build of CP/M-68k v1.3.

    cc -f test.c >>
    a.rel
     3.142
    Did it float?



    Thanks,
    --
    Nick

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Schultz@21:1/5 to Nick on Thu Mar 28 15:23:09 2024
    On 3/28/24 2:18 PM, Nick wrote:
    main()
    {
      float afloat;
      afloat= 3.142;
      printf("%6.3f\n", afloat);
      printf("Did it float?\n");
    }

    Since this works for me, what I want to know is exactly how you built it.

    cc -f test.c

    a.rel
    3.142
    Did it float?


    --
    http://davesrocketworks.com
    David Schultz

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Schultz@21:1/5 to Nick on Thu Mar 28 16:57:16 2024
    On 3/28/24 4:12 PM, Nick wrote:
    I'm using the software supplied for my 68k-MBC which is supposed to be a build of CP/M-68k v1.3.

    The bug fixes from 1.2 to 1.3 were minimal. I am using my sim along with
    those files.

    Checking my archives, I see that the file lengths for LIBE.A in the 1.2
    and 1.3 distributions are very slightly different.

    I copied the 1.3 version of LIBE.A and tried that. It appears broken:
    a.rel
    3.2@@
    Did it float?

    So use the 1.2 files.


    --
    http://davesrocketworks.com
    David Schultz

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Schultz@21:1/5 to All on Thu Mar 28 18:19:19 2024
    I was getting this feeling that something like this had turned up
    before. A quick showed that it had. Seven years ago so it wasn't quite
    at the top of my memory.

    https://groups.google.com/g/comp.os.cpm/c/YkDf-JLNY4k/m/6g1fYSSDAQAJ

    --
    http://davesrocketworks.com
    David Schultz

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nick@21:1/5 to David Schultz on Fri Mar 29 20:08:04 2024
    On 28/03/2024 23:19, David Schultz wrote:
    I was getting this feeling that something like this had turned up
    before. A quick showed that it had. Seven years ago so it wasn't quite
    at the top of my memory.

    https://groups.google.com/g/comp.os.cpm/c/YkDf-JLNY4k/m/6g1fYSSDAQAJ


    Thanks for the pointers David, and your simulator. I used it to
    familiarise myself with 68k while I was waiting for parts for the MBC. I
    also copied the microemacs over as it's a bit of a steep learning curve
    with ed.

    Building using cc worked for me on the sim so I'll try copying the stuff
    over from v1.2. I noticed that cc calls LINK68 rather than LO68, is that significant? I'll look at the source code and see if I can figure out
    what to pass to LINK68.

    Also, I used AR68 to look at the contents of LIBE.A and LIBF.A. LIBF.A
    has a number of extra maths functions added in v1.3.

    --
    Nick

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Schultz@21:1/5 to Nick on Fri Mar 29 17:01:33 2024
    On 3/29/24 3:08 PM, Nick wrote:
    On 28/03/2024 23:19, David Schultz wrote:
    I was getting this feeling that something like this had turned up
    before. A quick showed that it had. Seven years ago so it wasn't quite
    at the top of my memory.

    https://groups.google.com/g/comp.os.cpm/c/YkDf-JLNY4k/m/6g1fYSSDAQAJ


    Thanks for the pointers David, and your simulator. I used it to
    familiarise myself with 68k while I was waiting for parts for the MBC. I
    also copied the microemacs over as it's a bit of a steep learning curve
    with ed.

    ed is just a PITA to use. It works but it is very simple. I spent a lot
    of time typing in the source for RED (from DDJ) using ed just so I could
    have a screen editor. Switching to uEmacs later.

    Building using cc worked for me on the sim so I'll try copying the stuff
    over from v1.2. I noticed that cc calls LINK68 rather than LO68, is that significant? I'll look at the source code and see if I can figure out
    what to pass to LINK68.

    They are mostly equivalent. Except for differences in how to tell them
    what to do.

    Also, I used AR68 to look at the contents of LIBE.A and LIBF.A. LIBF.A
    has a number of extra maths functions added in v1.3.

    But do they work? If they do, and you need them, try extracting them
    from libf.a and using standalone. If that works, use ar to add them to
    the 1.2 libf.a

    --
    http://davesrocketworks.com
    David Schultz

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)