informedcitizenry / 6502.Net

A .Net-based Cross-Assembler for Several 8-Bit Microprocessors
MIT License
58 stars 17 forks source link

Is there any way to relate the program counter to the line in the code? #16

Closed SuperJMN closed 1 year ago

SuperJMN commented 1 year ago

I mean, if Program Counter (PC) is 9, for example, is there any way to know which line of the generated assembly corresponds to it?

Thanks :)

informedcitizenry commented 1 year ago

Have you looked at the --list and --verbose-asm? Example:

 dotnet 6502.net.dll mysource.s -o myprogram.bin --list mysource_list.s --verbose-asm

Let me know if that works. If your question is whether any object contains a reference from a specific line of source to generated code, not really.

SuperJMN commented 1 year ago

Thanks! I've located the exact information I need to provide debug info (program counter to line).

I've updated my fork to provide such information in this commit: https://github.com/SuperJMN/6502.Net/commit/bb49876bdd7c8b952d7a3faaf34538ea1b25765f

I ignored the StatementListing because it's string formatted and doesn't provide the line number.

I had to come with a custom solution (DebugInfo).

I hope your code could provide this information in the future. Thanks a lot!