-
Notifications
You must be signed in to change notification settings - Fork 458
Expand macros in listing #2279
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
base: master
Are you sure you want to change the base?
Expand macros in listing #2279
Conversation
But you see the disadvantage?
The bytes are emmited in the line with .BYTE, not with the .ENDREP. Note also that the address at the beginning has already progressed (to 000001r), and thus, it is wrong for this line. If you have more than a simple .BYTE in .REPEAT .ENDREP (think of segment changes!), it will not work, either. |
@spiro-trikaliotis - ty for pointing this out. I will fix it |
A big rework of original PR - thanks to @spiro-trikaliotis for pointing out deficiencies. Now 2 modes of macro expansion , short and long.
Samples from msbasic (nested 3 deep, with repeats, and segment switches) Original output
Short expansion. With code lines, segments statements and the macro invocation lines
Full expansion
|
Do we still see the non-expanded macro somewhere? Could you perhaps make it output the non expanded one before the first expansion or something like that? Also, please use --expand-macros instead of --expand_macros |
@mrdudz - not sure what you mean. The macro definition is still output like before. Is that what you meant. This patch doesnt remove anything from the listing, only adds stuff Will fix the long option name |
I see, sorry - i thought for a moment that the above excerpt is a complete listing |
Why close this? |
closed for the same reason as the macro one - certainly this one is better served by a different solution (I now know my way around the dbgfile output of the linker - it provides all the info I need, I am using it to do a huge upgrade of db65 ), and it just sat for 2 months, I dont like to leave PRs dangling |
2 months is nothing really :) Especially when it comes to the assembler (compiler and library has priority) - i don't have a lot of time for these things, so please be patient - i will look at it at some point. Obviously, if you have a better solution, then make a PR for that instead :) |
The added options should also be added to the documentation. |
@mrdudz Not sure If i have fixed the sgml correctly. I dont know how to render it. Especially as I needed two lines |
Upvote for this - do you need help with the SGML? |
@dominicbeesley - I just copied what was already there, but I do not know how to render the sgml to make sure that I did it right. |
I think you just do a
at the top level then check the ca65.html file. D |
diff looks ok to me, does it still work? :) |
This code expands macros in the listing. This is extremely useful for macros that include segment switches (its what made me do this) but is also generally useful.
adds command line switches
It does not try to save to macro source code, instead the macro is 'disassembled' when it is expanded. This was, I felt, less invasive on the internal data structures. This does mean that the expansion is not 100% like the input but is certainly sufficient to work out what line generated what code, and importantly what segment it went into.
Here is sample from msbasic.s (from https://github.com/mist64/msbasic) with and without expansion, it target 3 different segments
without
with expansion
these macros are nested 3 deep (thats what the > characters show)