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

Feature Request: 16-Bit SegPtr reference lookup compressed to SegPtr #1185

Open
Elthial opened this issue Jul 2, 2022 · 0 comments
Open
Assignees
Labels
bug This issue describes a defect in Reko

Comments

@Elthial
Copy link

Elthial commented Jul 2, 2022

So I am wondering if it is possible to compress a SegPtr lookup in Reko HL code into just the SegPtr and use that to work out further variable references.

The issue is with 16-Bit segmented memory, all the segptr's need to be in the initial [Data] segment (3EDB for me atm) because that's the assumed ds segment unless otherwise provided. This means that any variable reference outside of the [Data] segment must first do a lookup to a [Data] SegPtr lookup table and then do the rest of the ptr.

This is one of the reasons why the variable EQ and types explode so heavily with 16 bit segmented code, as each segment lookup ptr becomes its own eq_**** rather than compressing into a common segptr eq_*****

Additionally this seems to be a breaking factor in defining user defined variables / structs as it is unable to link all the reference together.

Example:

struct Eq_19636 * es_24 = ds->ptr54B8; if ((&es_24->tFFFFC614.b0000)[wLoc04_342 * 0x11] == ~0x00)

which has the reko .inc file of:

{
    unsigned char Name;
    unsigned char Body;
    unsigned char Dexterity;
    unsigned char Charisma;
    unsigned char Skill_BowsAndBlade;
    unsigned char Skill_Pistol;
    unsigned char Skill_Rifle;
    unsigned char Skill_Gunnery;
    unsigned char Skill_Piloting;
    unsigned char Skill_Tech;
    unsigned char Skill_Medical;  
    unsigned char Weapon;
    unsigned char Piloting;
    unsigned char ArmourType;
    unsigned char ArmourValue;
    unsigned char Health;
    unsigned char Riding;
} Infantry;


//Infantry Variables
[[reko::address("3092:C614")]] Infantry CrescentHawk00_Jason; 

es_24 = ds->ptr54B8; references segptr 0x3092
tFFFFC614 is 0xC614 which should be the beginning of the user defined struct.

The struct itself exists in the "3092 global variables" of reko, so the typedef has worked till that point.

Any thoughts on whether this might be possible or any alternative approaches that might be better?

@uxmal uxmal self-assigned this Jul 2, 2022
@uxmal uxmal added the bug This issue describes a defect in Reko label Jul 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a defect in Reko
Projects
None yet
Development

No branches or pull requests

2 participants