Created
July 27, 2024 15:45
-
-
Save ben221199/0bb62e233f2f2df66de43ed7623a5bf9 to your computer and use it in GitHub Desktop.
Binary Template files for 010 Editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct mapdef_s { | |
unsigned short md_spmap; /* 16 bit SEG ptr to next map (0 if end) */ | |
unsigned char md_abstype; /* 8 bit map/abs sym flags */ | |
unsigned char md_pad; /* 8 bit pad */ | |
unsigned short md_segentry; /* 16 bit entry point segment value */ | |
unsigned short md_cabs; /* 16 bit count of constants in map */ | |
unsigned short md_pabsoff; /* 16 bit ptr to constant offsets */ | |
unsigned short md_cseg; /* 16 bit count of segments in map */ | |
unsigned short md_spseg; /* 16 bit SEG ptr to segment chain */ | |
unsigned char md_cbnamemax; /* 8 bit maximum symbol name length */ | |
unsigned char md_cbname; /* 8 bit symbol table name length */ | |
if(md_cbname>0){ | |
unsigned char md_achname[md_cbname]; /* <n> name of symbol table (.sym ) */ | |
} | |
}; | |
struct segdef_s { | |
unsigned short gd_spsegnext; /* 16 bit SEG ptr to next segdef (0 if end), | |
relative to mapdef */ | |
unsigned short gd_csym; /* 16 bit count of symbols in sym list */ | |
unsigned short gd_psymoff; /* 16 bit ptr to symbol offsets array, | |
16 bit SEG ptr if MSF_BIG_GROUP set, | |
either relative to segdef */ | |
unsigned short gd_lsa; /* 16 bit Load Segment address */ | |
unsigned short gd_in0; /* 16 bit instance 0 physical address */ | |
unsigned short gd_in1; /* 16 bit instance 1 physical address */ | |
unsigned short gd_in2; /* 16 bit instance 2 physical address */ | |
unsigned char gd_type; /* 16 or 32 bit symbols in group */ | |
unsigned char gd_pad; /* pad byte to fill space for gd_in3 */ | |
unsigned short gd_spline; /* 16 bit SEG ptr to linedef, | |
relative to mapdef */ | |
unsigned char gd_fload; /* 8 bit boolean 0 if seg not loaded */ | |
unsigned char gd_curin; /* 8 bit current instance */ | |
unsigned char gd_cbname; /* 8 bit Segment name length */ | |
if(gd_cbname>0){ | |
unsigned char gd_achname[gd_cbname]; /* <n> name of segment or group */ | |
} | |
}; | |
struct endmap_s { | |
unsigned short em_spmap; /* end of map chain (SEG ptr 0) */ | |
unsigned char em_rel; /* release */ | |
unsigned char em_ver; /* version */ | |
}; | |
struct symdef16_s { | |
unsigned short sd16_val; /* 16 bit symbol addr or const */ | |
unsigned char sd16_cbname; /* 8 bit symbol name length */ | |
if(sd16_cbname>0){ | |
unsigned char sd16_achname[sd16_cbname]; /* <n> symbol name */ | |
} | |
}; | |
struct symdef_s { | |
unsigned long sd_lval; /* 32 bit symbol addr or const */ | |
unsigned char sd_cbname; /* 8 bit symbol name length */ | |
if(sd_cbname>0){ | |
unsigned char sd_achname[sd_cbname]; /* <n> symbol name */ | |
} | |
}; | |
void ReadMap(){ | |
SetBackColor(cLtGreen); | |
mapdef_s pMap; | |
SetBackColor(cNone); | |
FSkip(1); | |
local int i; | |
for(i=0;i<pMap.md_cabs;i++){ | |
ReadSymbol(); | |
} | |
SetBackColor(cNone); | |
FSkip(pMap.md_cabs*2);//Offsets | |
while(FTell()%16!=0){ | |
FSkip(1); | |
} | |
for(i=0;i<pMap.md_cseg;i++){ | |
ReadSegment(); | |
} | |
} | |
void ReadSegment(){ | |
SetBackColor(cLtYellow); | |
segdef_s se_segdef; | |
local int i; | |
for(i=0;i<se_segdef.gd_csym;i++){ | |
ReadSymbol(); | |
} | |
SetBackColor(cNone); | |
FSkip(se_segdef.gd_csym*2);//Offsets | |
while(FTell()%16!=0){ | |
FSkip(1); | |
} | |
} | |
void ReadSymbol(){ | |
SetBackColor(cLtRed); | |
symdef16_s sy_symdef; | |
} | |
void ReadMapEnd(){ | |
SetBackColor(cLtBlue); | |
endmap_s pMapEnd; | |
} | |
local uint spmap; | |
while(!FEof()){ | |
spmap = ReadUShort(FTell()); | |
if(spmap!=0){ | |
ReadMap(); | |
continue; | |
} | |
ReadMapEnd(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment