New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zcc: further process global defs file generated by z80asm -g #73
Comments
A few more thoughts on this before an implementation is attempted:
I'm looking at copt and its regular expression engine to see if it can be reused in zcc to do this regular expression thing. |
The changes have been made to zcc. The regular expression engine used by copt is reused in zcc to filter the global defc file. The options with description below: -g -gp -gf filename -gpf filename In "filename" there is one rule per line. The line can be optionally preceded by ";", "+", "-" which mean comment, accept, reject respectively (if not present, accept is implied). Each public symbol is matched against the rules in order found in "filename". The first match determines whether the symbol will be accepted or rejected. An example:
The first rule will accept the specific symbol The purpose of this change is to make it easier to manually create bankswitched programs or export an interface to a compiled binary. |
I thought I'd share this perverse application of using the global def file generated by The problem is how to communicate a In C, the name of an array is an alias for a constant address. So this twisted bit of code uses this to communicate the size of a structure to an asm file via the address of an array.
Here's an example communicating the size of "struct data". dummy.c
And the regular expression file "dummy.rxp"
After a compile: The file "dummy.def" is created with one defc:
which can be directly included into the asm file. |
Related to #42 (although a global def file is also being used to build the bifrost*2 engine in the new c lib zx library where the engine is produced as a pre-assembled binary with entry points communicated via the global defs).
The problem being considered is how to communicate public entry points to already assembled binaries easily. The application is the manual distribution of a binary across several memory banks where calls across banks must be done via trampoline to the publicly exported interface in another bank.
The global defs file produced by z80asm -g is exactly what is needed. However it currently produces a file with every publicly exported symbol defined as a "defc foo = $xxx ; modulename" in the defs file. There is nothing wrong with this information - what is needed is a way to use that more easily.
Some things that would help:
Addition of "PUBLIC foo" for each define so that the user doesn't have to manually add PUBLIC to symbols needed in other compiles (other compiles will add the global defs file to gain knowledge of entry points).
A means to filter out unneeded symbols. In the new library especially, a lot of extra public constants may appear in the global defs file that is irrelevant to a bankswitching task and may interfere with the same constants defined during compiles of other portions of the project.
The suggestion is to have zcc process the global defs file to the required form by introducing new flags to accompany -g: -g, -gp, -gf filename, -gF filename, -gpf filename, -gpF filename
The 'p' corresponds to adding the "PUBLIC foo" exports into the defs file. The "f" indicates that a following file will contain symbols that will be accepted from the defs file. The "F" indicates that a following file will contain symbols that will be rejected from the defs file.
With this arrangement I think the user has a good way to get out of the global defs file what is needed.
Does it sound reasonable?
The text was updated successfully, but these errors were encountered: