-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add symbol output #16
Comments
I'm so glad you're finding it useful! As I understand it, you're using it for teaching at a university? I'd love to know more details! A symbol file output was definitely in the plans. Do you have a particular need for that syntax? I was thinking something like this:
...which would mirror the source code syntax (except that sublabels have to be written in full), and should still be easy for other people to write a regex to extract values. Also, could you please check the LogiSim output formats? I've tried reading LogiSim's documentation online, and adapting the code from your fork, but since I've never used that app, I'm not sure if the outputs are correct. |
Hi, yes, I am using it on two demonstration projects for my students: 1) computer made in LogiSim (yes, your LogiSim formats are correct) and 2) FPGA-based computer (this one would use the symbols if/when you make them). My students were impressed to see custom assembler for both platforms. Thanks again for that! |
I've added new command line options |
Thank you! I will start on the debugger part of my emulator to introduce symbols. You have made an excellent software! |
Hi, However, I have encountered a funny problem: sometimes in my assembler code, I just enter the number, not the label: Is it possible to extend your symbol file with the list of addresses of the exact usage of that symbol? If there is a list of addresses where the VK_P symbol was actually used, then my debugger would know not to put the VK_P symbol in the line where it was not used. For example: The example above would mean that the symbol draw_next_line has the actual value of 0xb946, and it was used at the addresses: 0xb230 and 0xb2a4. Those addresses could be the actual addresses in the assembled code where the label draw_next_line existed and was used. I don't know if I was clear enough, so please ask me more details about this feature request. |
Yeah, I had the feeling this would be a problem... I'm not exactly sure how to solve this right now. My first instinct was to make the symbol output differentiate between address labels and variables, like so: ; labels
draw_next_line = 0xb946
some_other_label = 0x8080
; variables
VK_P = 0x19
some_var = 0x55 ...but you'd probably want the debugger to show variable names as well as address labels, when you actually use them. So this distinction might not be very useful in your case. About your solution involving usage listings, I think it might not completely solve the issue in the general case? Imagine I had some kind of instruction like Another idea is to use the annotated output format, which lists addresses, bytes, and the source code excerpts that generated them. This annotated file should be easy to parse, too. What do you think? |
Hi,
The resulting executable would look like this:
Now, the symbols are:
labels: The occurrences of symbols in the executable are at the following addresses:
So, whenever your assembler replaces a label or variable with the actual number, it would be nice if it would write down the exact address where that symbol was used some way similar, or equal to the one written above. Is it possible for your code to write down the exact address of the occurrence of a symbol? For example, in the code above, the
The executable would be like this: Huh, so many words. I hope that I was at least a bit clear about this topic. |
I've been thinking a lot about this, but I still haven't got the time to work on a solution. The crux of the problem seems to be keeping track of named variables as they go through arbitrarily-complex expressions in the body of an instruction definition (since those can even be blocks of code with multiple expressions in sequence). Perhaps something can be done for the simpler cases of a single expression with clean variable usage. |
Thanks for still thinking about this. I agree that the simplest cases should be done. That certainly works for me. |
I'll close this since there's now an |
Hi, Thanks for the great product! I have been using it for couple of years.
I think that you don't have the following feature: symbol list. This means that when you assemble the output file, you could have an additional option, for example: -sym symbols.txt
That option would generate the symbol list (symbols.txt file) containing addresses of all labels in the output assembled file. Something like this:
0x00000000 start:
0x000000fa main:
etc.
That feature would help me implement debugger that would show labels instead of addresses.
I hope I was clear enough for you.
Best regards,
Milan
The text was updated successfully, but these errors were encountered: