gauauu Posted May 14, 2018 Share Posted May 14, 2018 Has anybody written a converter to generate DASM/Stella compatible symbol files from the debug map output of ca65? I'm planning to write one later today, should be relatively straightforward, but thought I'd ask and see if anyone's already done so before I waste time reinventing things. (Although it's so simple, I guess I probably could have written one in the amount of time I spent googling, searching, and then asking this question. Ah well, the work we go through to avoid work....) Quote Link to comment Share on other sites More sharing options...
+stephena Posted May 14, 2018 Share Posted May 14, 2018 There has been talk over the years about revamping the disassembly support in Stella, and making more direct use of the files that DASM produces (lst, sym, etc). And to that end, also adding support for ca65 directly. We haven't yet found the time to work on any of this, but I keep it on the TODO list, and in the back of my mind, since I want to come back to it at some point. That being said, if you do get a converter written and don't mind releasing it under GPLv2, please consider donating it. We may make use of it in Stella at some point. Quote Link to comment Share on other sites More sharing options...
gauauu Posted May 14, 2018 Author Share Posted May 14, 2018 We haven't yet found the time to work on any of this, but I keep it on the TODO list, and in the back of my mind, since I want to come back to it at some point. That being said, if you do get a converter written and don't mind releasing it under GPLv2, please consider donating it. We may make use of it in Stella at some point. I'd be happy to donate it. Are there other considerations (language/features/etc?) that would be important to you? I was originally going to the write the simplest thing possible in python, but if there's value in making something more general or robust, I'm happy to spend a little more time. Alternatively, I'm willing to at least look at the Stella code that reads the list/symbol file, and see how hard it would be to bake in support for ca65 files. But I'm not sure that's worth the effort if you're planning to completely revamp how that all works? 1 Quote Link to comment Share on other sites More sharing options...
+stephena Posted May 16, 2018 Share Posted May 16, 2018 We are planning to add this to Stella at some point, but it may not even be this year. So don't feel you have to wait. Go ahead and write this in whatever language you were going to use. We can still use your ideas/research, even if we don't use the actual code (most of the time, the research is the most important part anyway). 1 Quote Link to comment Share on other sites More sharing options...
gauauu Posted May 16, 2018 Author Share Posted May 16, 2018 Here's my first pass, which is a super-simple python script that converts ca65 list files to dasm sym format. It could almost be done as just a sed regex instead, but anyway, here you go. You mentioned licenses, so I grant anyone a license to use this under any OSI-approved license of your choosing :-) Usage -- link with the -L flag, then call debugMap.py ld65 -L $(CC65_PATH)/share/cc65/lib -m map.txt -Ln labels.txt --dbgfile $(title).dbg -C foo.cfg blah blah blah python debugMap.py labels.txt mygame.sym debugMap.py: #!/usr/bin/python3 import sys def convert_maps(labels_filename, sym_filename): labels_file = open(labels_filename, "r") label_lines = labels_file.readlines() labels = {} for line in label_lines: parts = line.split() label = parts[2][1:] addr = parts[1][2:].lower() labels[label] = addr sym_file = open(sym_filename, "w") for label, addr in labels.items(): sym_file.write(label + " " + addr + " (R )\n") if __name__ == "__main__": convert_maps(sys.argv[1], sys.argv[2]) I might also take a look modifying stella directly to read them, but we'll see. It depends on how motivated I feel. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.