Skip to content
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

Relocation #4

Open
narpfel opened this issue Apr 22, 2017 · 0 comments
Open

Relocation #4

narpfel opened this issue Apr 22, 2017 · 0 comments

Comments

@narpfel
Copy link
Owner

narpfel commented Apr 22, 2017

Use case: morse.yay.

Currently, stuff like LUTs must be defined before using them. This results in the data for the LUT being located before the program code. This may upset disassemblers when the data bytes are not valid machine code (e. g. ending in a cut off multi byte opcode).

It would be better to define data segments at the start of the program and then relocate them to the end of the code segment. This could be accomplished by generating a mutable address container rather than the final address on the first pass. On another pass, these containers could be filled with the real addresses.

This would also make the jmp and call mnemonics that automatically select the right opcode easier.

The results of Program.after_code_segment would automatically be inserted at the end of the code segment, but it would be called before Program.main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant