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

Add 'self-referencing' XREF feature to our OOVPA's #39

Open
RadWolfie opened this issue Aug 23, 2018 · 0 comments
Open

Add 'self-referencing' XREF feature to our OOVPA's #39

RadWolfie opened this issue Aug 23, 2018 · 0 comments
Labels
enhancement New feature or request good for beginner Good for newcomers help wanted Extra attention is needed needs-developer-discussion Need developer discussion to come with agreement. OOVPA Any OOVPA change relative

Comments

@RadWolfie
Copy link
Member

Moved from Cxbx-Reloaded/Cxbx-Reloaded#669

Original post by @PatrickvL:

I've got an idea on XREF's that point inside a function itself;

Currently, the (offset+value)-tuples are used for two purposes;

  1. Actual byte values at specified offsets - this is the primary usage
  2. XREF ID's at specified offsets - this is a secondary usage

(Note : A while ago, I swapped the members of XREF entries, so that the uint08 is used as Offset, while the uint16 is used as XREF ID. I did this, so that we can have up to 2^16=65536 XREF ID's instead of only 2^8=256, without sacrificing storage space.)

Anyway, we could add an additional usage to the (offset+value)-tuples:
3. uint08 Delta, uint16 Offset - a third usage of the same tuple definition.

We would need to add a counter to the OOVPA to indicate the amount of these entries.

I'm not yet sure if these tuples should come before or after the normal XREF entries,
but they should surely come before the normal (offset+value)-tuples / OV-pairs.

Then, we would need to add the neccesary code that checks for each of the Offset's,
if the function references itself with the given Delta or not.

I suspect most (if not all) internal references will be relatively addressed
(see https://en.wikipedia.org/wiki/Addressing_mode#PC-relative ).

(We could allow absolute addressed references too, but log if this ever happens,
but I don't expect it will ever show up.)

If any of the internal 'self'-references fails, the checking on this address failed,
so should stop and return to the caller, who will probably try another address.

For this issue:

  • discuss this idea
  • reach consensus
  • formulate follow-up steps

Thinking about this some more, maybe this didn't really necessary, since the same offsets could just as well be checked with regular offset+value pairs.

@RadWolfie RadWolfie added enhancement New feature or request help wanted Extra attention is needed good for beginner Good for newcomers OOVPA Any OOVPA change relative needs-developer-discussion Need developer discussion to come with agreement. labels Aug 23, 2018
@RadWolfie RadWolfie mentioned this issue Aug 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good for beginner Good for newcomers help wanted Extra attention is needed needs-developer-discussion Need developer discussion to come with agreement. OOVPA Any OOVPA change relative
Projects
None yet
Development

No branches or pull requests

1 participant