First post, by Peter Swinkels
Trying to better understand MS-DOS executable headers and what relocation items are I looked at the DOSBox source code and found this in the .\dosbox\src\dos\dos_execute.cpp file:
pos=head.reloctable;DOS_SeekFile(fhandle,&pos,0);
for (i=0;i<head.relocations;i++) {
readsize=4;DOS_ReadFile(fhandle,(Bit8u *)&relocpt,&readsize);
relocpt=host_readd((HostPt)&relocpt); //Endianize
PhysPt address=PhysMake(RealSeg(relocpt)+loadseg,RealOff(relocpt));
mem_writew(address,mem_readw(address)+relocate);
}
}
As far as I understand C++ it's iterating through each relocation item in the header and calling a function called "PhysMake". What exactly is going on in the above code?
Do not read if you don't like attention seeking self-advertisements!
Did you read it anyway? Well, you can find all sorts of stuff I made using various programming languages over here:
https://github.com/peterswinkels