Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
zcc: further process global defs file generated by z80asm -g #73
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:
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?
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:
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.
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".
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.