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
Limited autoimport with globs in .import and .importzp #346
Comments
|
I bookmarked this issue a while ago as something I would like as well and finally this past weekend I gave it a try. Code at https://github.com/cacciatc/cc65/tree/limited-autoimport-with-globs. Note, it's a WIP, but it has been working with my preliminary tests and I am now using the globbed import's on my own NES project with no issues so far. Let me know what you think. Implementation Notes
; defined elsewhere
; .export mod1_var
; .export mod_var
.import mod*
.import mod1*
; picked up by .import mod1*
lda mod1_var
Most of the time the above wouldn't be a problem I think; however in the case of (3) there can be problems.
The following could cause a linker warning since the globbed import that picks up the symbol might not be the one you expect: ; defined elsewhere
; .exportzp mod1_var
; .export mod_var
.importzp mod1*
.import mod*
; picked up by .import mod*
lda mod1_var
Not sure if there is a way around the above behavior. The undefined symbol's address size when we get to SymCheckUndefined is the default, but maybe you can determine the required address size from the rest of the expr before then? Dunno enough at this time.
|
|
Could you get this fork updated to upstream/master? I've found some other people who might be interested. |
|
Weird, I don't remember deleting that fork. Will see if I can track the code down on my local machine. |
|
Found the code: Formatting may be a little messed up. Thought I had some tests as well, but couldn't find those... |
In my ca65 project, I have one .s file that defines sprite sheets and exports their IDs as symbols of the form
SHEET_Hero,SHEET_Fungoid,SHEET_TurtleSoldier,SHEET_Lift, etc. (Names are changed.) I'd like to be able to refer to these sprite sheets in other files, setting up autoimport only for undefined symbols with a particular prefix:This feature request is inspired by Python's
importstatement and Java'simportstatement, both of which support*as a wildcard.The text was updated successfully, but these errors were encountered: