Closed BacchusFLT closed 4 months ago
I'm taking the output .lst file of an assembler (a09 for 6809) and using it to create an EQU file for a compiler (CamelForth for Vectrex 6809), which allows the Forth code to call the assembly routines in a combined target binary.
This is similar to what you're looking to do, here's the command line (Windows 10 command line), it might give you some ideas:
sed -n "/SYMBOL TABLE/,/SYMBOLS/p" vectrex_sargon.lst | sed -e "$d; 1d;" | awk -f sargon_equs_awk.txt | sort > sargon_equs.fs
I also do something similar (simpler) to this to create a comment file for MAME Debugger from my disassembler (dasmfw for 6809, not 6502bench) "info" files as they're manually-edited plain text, again.
I'm no expert with this, but it's worth spending the time to learn about it as it can make life a lot easier to work around functionality gaps.
Good luck!
Many thanks for the suggestion. I guess my first option would still have a checkbox in the setting conditioning adding a parameter to the assembly. That would have the assembler generate it and it would take no post processing.
ca65 docs say:
-g, --debug-info When this option (or the equivalent control command .DEBUGINFO) is used, the assembler will add a section to the object file that contains all symbols (including local ones) together with the symbol values and source file positions. The linker will put these additional symbols into the VICE label file, so even local symbols can be seen in the VICE monitor.
According to this it's also necessary to add -Ln out.lbl
. A quick experiment suggests that the output is what VICE wants:
al 008002 .foo
Letting the assembler generate the output would potentially be less work, but has some drawbacks:
I don't think there's a scenario where the assembler has information that SourceGen doesn't, in terms of mapping a label to an absolute address in memory, so there's no technical reason SourceGen can't do it.
I added a feature to the File menu, next to the assemble/export commands. It has been published in https://github.com/fadden/6502bench/releases/tag/v1.8.6-dev1
I don't have VICE set up so I haven't tried to actually use it. I'm generating essentially the same thing that ca65 does (described at https://www.cc65.org/doc/debugging-4.html), so hopefully it's correct and useful. Please give it a try and see if it does what you need it to.
I poked at VICE a little. It accepts the generated label files, but only keeps one copy of each symbol. So if you have multiple local labels called "@loop", it only keeps the last one. It rejects the internal uniquified name (which has a '§' in it), but if I replace that with '_' then you get the whole set.
In my deeds where I use 6502 bench, I most often use it to document the code I am working with. So the modus operandi is running the code in an emulator and in prallell document things in 6502 bench,
Here the emulator's debugger (I use VICE and RetroDebugger) have support for labels, so I can import a label file and have the debugger present them in the disassembly.
Request: So it would be most handy if 6502 bench could export the labels in the current project in a format that my debugger can read.
This is the format for such a file for VICE (it shows that several formats are supported):
https://vice-emu.sourceforge.io/vice_12.html
I haven't been able to find the ACME file format, but at least these two options can generate them: -l, --labeldump FILE select label dump file. This can also be given using the "!sl" pseudo opcode.
KickAssembler generates two different formats: (.sym and .vs) http://theweb.dk/KickAssembler/webhelp/content/ch12s06.html
My assumption is that trhe Assebler step could be given an extra parameter to have the assemblers generate these files, without any additional code in 6502 bench.