building for am9511

Post Reply
jacotton
Member
Posts: 89
Joined: Fri Nov 24, 2017 1:35 am

building for am9511

Post by jacotton »

$ make
zcc +cpm -create-app --am9511 --list --c-code-in-asm -m dec2flt.c -odec2flt
../../_DEVELOPMENT/math/float/am9511/asm/z80/am32_popf.asm:42: error: undefined symbol: __IO_APU_STATUS
^---- (__IO_APU_STATUS)
../../_DEVELOPMENT/math/float/am9511/asm/z80/am32_popf.asm:46: error: undefined symbol: __IO_APU_DATA
^---- __IO_APU_DATA
../../_DEVELOPMENT/math/float/am9511/asm/z80/am32_pushf.asm:49: error: undefined symbol: __IO_APU_DATA
^---- __IO_APU_DATA
../../_DEVELOPMENT/math/float/am9511/asm/z80/am32_pushf.asm:143: error: undefined symbol: __IO_APU_DATA
^---- __IO_APU_DATA
../../_DEVELOPMENT/math/float/am9511/asm/z80/am32_pushi.asm:46: error: undefined symbol: __IO_APU_DATA
^---- __IO_APU_DATA
../../_DEVELOPMENT/math/float/am9511/asm/z80/am32_pushi.asm:70: error: undefined symbol: __IO_APU_DATA
^---- __IO_APU_DATA

Certain that there is a flag to fix this, lost as to what it is. I did try the examples on the web page, it produces un runnable code
orged at 9000h. Not real useful for me.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: building for am9511

Post by dom »

I think you need to -pragma-define:__IO_API_STATUS=nn -pragma-define:__IO_APU_DATA=mm where nn and mm are the ports that the chip is attached to.
User avatar
feilipu
Member
Posts: 45
Joined: Tue Nov 15, 2016 5:02 am

Re: building for am9511

Post by feilipu »

Most of the defines that you need are available only for the RC2014, so in newlib you can use

Code: Select all

zcc +rc2014 -subtype=cpm etc etc
But the trouble with this is that newlib targets don't have the full cpm disk access capabilities.

Otherwise use the definition in the rc2014 target as a guide and add it to your own cpm target builds.
__IO_APU_PORT_BASE

Your missing definitions are referenced to the port base in this file.
You'll need to rebuild the am9511 library though to pick up the new definition.
jacotton
Member
Posts: 89
Joined: Fri Nov 24, 2017 1:35 am

Re: building for am9511

Post by jacotton »

At this point in time, I am trying to get a test program running on the rc2014. After that, its off to the s100 machine.

BTW: your fix works. I get a clean build, but my test is broken. Runs with the out of the box math48, so could be a few different
problems, maybe dead chip.
User avatar
feilipu
Member
Posts: 45
Joined: Tue Nov 15, 2016 5:02 am

Re: building for am9511

Post by feilipu »

I've looked at how to fix this for the +cpm target, and the fix will be very easy, but I'm not exactly sure how to do it most elegantly.

All the definitions required are already present in the library, so there's no need to add more. However the definitions are not being included by the +cpm target when the --am9511 math alias is being applied.

Probably, I'll need to include the public inclusions file in the alias so that the definitions are present. But there might be a more elegant way.
User avatar
feilipu
Member
Posts: 45
Joined: Tue Nov 15, 2016 5:02 am

Re: building for am9511

Post by feilipu »

jacotton wrote: Sat Mar 26, 2022 12:29 am BTW: your fix works. I get a clean build, but my test is broken. Runs with the out of the box math48, so could be a few different
problems, maybe dead chip.
Also try your test with --math32. The --am9511 library is the same in many ways, specifically using 32-bit floats and all the calling conventions, and this will help narrow down whether the problem is your hardware or a code mismatch somewhere.
User avatar
feilipu
Member
Posts: 45
Joined: Tue Nov 15, 2016 5:02 am

Re: building for am9511

Post by feilipu »

Probably, I'll need to include the public inclusions file in the alias so that the definitions are present. But there might be a more elegant way.
Perhaps a bit overdue, but I've separated the am9511 maths from the rc2014 target entirely. This should address all the issues.

Now to build the library with a specific address for the Am9511 device the base port will only need to be configured within the library itself. Currently it is set to the RC2014 APU Module standard of 0x42.

For memory mapped use of the Am9511 (like with the DAI) there is a bit more work to do, but for I/O use this should be enough.
jacotton
Member
Posts: 89
Joined: Fri Nov 24, 2017 1:35 am

Re: building for am9511

Post by jacotton »

After updating to today's repo, we are almost there.
This init_floatpack seems to just do a return.

rm -f iotest.hex iotest.asm iotest.list iotest.lst iotest.bin
rm -f dec2flt DEC2FLT.COM *.list *.lis *.bin
rm -f mathtest *.lst *.COM
rm -f *.o
zcc +cpm -create-app --list --c-code-in-asm --am9511 -c font.c
zcc +cpm -create-app --list --c-code-in-asm --am9511 -c snaplib.c
zcc +cpm -create-app --list --c-code-in-asm --am9511 -c liboled.c
zcc +cpm -create-app --list --c-code-in-asm --am9511 mathtest.c font.o snaplib.o liboled.o -omathtest
mathtest.c:282:6: warning: Converting type: char text[80]* to char * s [-Wincompatible-pointer-types]
mathtest.c:284:4: warning: Converting type: double fl* to long * [-Wincompatible-pointer-types]
mathtest.c:284:4: warning: Converting type: double fl* to long * [-Wincompatible-pointer-types]
../_DEVELOPMENT/l/sccz80/9-common/f48/fa.asm:12: error: undefined symbol: init_floatpack
^---- init_floatpack
make: *** [Makefile:23: mathtest] Error 1
jacotton
Member
Posts: 89
Joined: Fri Nov 24, 2017 1:35 am

Re: building for am9511

Post by jacotton »

I put this in my source code and got a build
ASM
GLOBAL init_floatpack
init_floatpack: ret
ENDASM
User avatar
feilipu
Member
Posts: 45
Joined: Tue Nov 15, 2016 5:02 am

Re: building for am9511

Post by feilipu »

For interest, when I'm messing around with floating point and long interactions in C, I use this union to reference them.

Code: Select all

union flong
{
    float f;
    unsigned long l;
};
With this I can then print the hex values of the floats I'm debugging.

Code: Select all

#pragma printf = "%lx %x %ld %d %.14f %s %c" // enables %lx %x %ld %d %.14f %s %c only

    union flong flr, flx, fle;

    printf("\n\nfloor(%.10f) should be %.10f and we got %.10f\n", flx.f, fle.f, flr.f);
    printf("floor(0x%.8lx) should be 0x%.8lx and we got 0x%.8lx\n",flx.l, fle.l, flr.l);
Helps my thoughts greatly.
Post Reply