Discussion:
CP/M-68k C floating point
Add Reply
Nick
2024-03-28 19:18:30 UTC
Reply
Permalink
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");
}


C>fptest
0.;42
Did it float?

On a positive note, Pascal MT68's floating point does work.
--
Nick
David Schultz
2024-03-28 20:23:09 UTC
Reply
Permalink
Post by Nick
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.
Post by Nick
6C>cc -f test.c
6C>a.rel
3.142
Did it float?
--
http://davesrocketworks.com
David Schultz
Nick
2024-03-28 21:12:08 UTC
Reply
Permalink
Post by David Schultz
Post by Nick
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
Post by David Schultz
Post by Nick
   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.
Post by David Schultz
Post by Nick
6C>cc -f test.c >>
6C>a.rel
 3.142
Did it float?
Thanks,
--
Nick
David Schultz
2024-03-28 21:57:16 UTC
Reply
Permalink
Post by Nick
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:
6C>a.rel
3.2@@
Did it float?

So use the 1.2 files.
--
http://davesrocketworks.com
David Schultz
David Schultz
2024-03-28 23:19:19 UTC
Reply
Permalink
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
Nick
2024-03-29 20:08:04 UTC
Reply
Permalink
Post by David Schultz
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
David Schultz
2024-03-29 22:01:33 UTC
Reply
Permalink
Post by Nick
Post by David Schultz
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.
Post by Nick
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.
Post by Nick
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
Loading...