[Coco] GCC: DFLOAT / DIRECT_PAGE
John E. Malmberg
wb8tyw at qsl.net
Fri Nov 14 12:34:21 EST 2003
I found some references to how to build the .md file in an .info file
in the GCC distribution that may help.
It looks like I need to define some instructions to operate on a double
float for the compiler to be happy. I have to look up in the ANSI C
specifications to see what the minimum size for a double is, and review
the 6809 instruction set to see how it could be implemented.
The simplest case would be if I can alias it to be the same as a float.
I do not think I will be that lucky.
The .info file also may provide how to implement a "direct page" type
modifier.
The main thing seems to be to put instruction templates to operate on
that type in the .md file.
If I can do it, this is what I will do for direct_page:
1. The compiler will treat it like a hint, just as register is a hint.
This means that the compiler will prefer to use direct page addressing
mode for the designated variable, but since it also has the absolute
address for the variable, or a stack/register relative address for
the variable, it can decide to use that instead.
2. The compiler will default to treating the direct page pointer as
what other platforms refer to as a frame pointer for stack variables
that are in range.
This will get the most benefit out of the direct page pointer, but
may be an issue with ISRs if they are expecting the direct page
pointer to have been pre-initialized. This definitely affects ROM
BASIC, I do not know about Flex-09 or OS-9.
A direct page reference, depending on the internals of the CPU may take
one less clock cycle than an 8 bit stack or register offset. I would need
to look at the 6809 specs to see if this is the case. The difference
is that a register offset has to do an 8 bit fetch and 16 bit add, and
a direct page reference just has to do an 8 bit fetch.
3. The direct_page attribute for a variable name will be able to take
a value indicating the program section that the variable will be in.
The attributes of the program section will determine the real address
of the program section. GCC already knows how to do the program section
part.
-John
wb8tyw at qsl.net
Personal Opinion Only
More information about the Coco
mailing list