Does anyone fully understand the data output in ca65's (might actually be the linker that outputs the full file, actually), exhaustive debug file? I was successfully able to write a python script to translate this file into source-level debugging information for FCEUX, however, I encountered an odd situation which I haven't yet been able to explain.
Code: Select all
#Actual line of code.
line_number = line["line"] - 1
if 0 <= line_number < len(source_file_lines[file_name]):
line_of_code = source_file_lines[file_name][line_number].rstrip().replace("#", "")
In order to get the nl comments in FCEUX to show up as expected above the first instruction associated with the line of code, I had to add this - 1 calculation before grabbing the line of code from the source file. What concerns me is that some of these "line" objects report 0 as the line number, so this doesn't seem correct (i.e., it's not a case of counting from 0 in one case versus counting from 1 in another, I have arrays of source code lines that start from 0 and the debug output also appears to start from 0 for these "line" objects). Yet, most of the time I'm getting correct and expected output in the FCEUX debugger. (i.e., I see my line of code, followed by all the instructions assembled for that line of code, exactly as expected).
Just wondering if anyone out there understands the debug output in more detail and can help me explain why I had to put that - 1 there.