neon wrote:
Also, the code should not assume its actual load address. Right at the start of "loader", it should do a far jump or push/retf to fix it.
I cannot possibly disagree with this advise more strongly
the truth is, while it is true (as I stated in my previous posts) that you cannot know what CS:IP combination in use, it is also true (as I stated in my previous posts) that it doesn't matter what the CS:IP combination is
Quote:
Not doing so may cause unexpected behavior on systems that loads the code in a different segment then what your code expects (i.e. loading to 0:0x7c00 instead of 0x7c0:0.)
the only "unexpected behavior" that can possibly occur is IP wrapping around to zero before getting to the end of your code... which would only happen if CS was set to something really weird (like CS:IP == F7C1:FFF0)... which doesn't happen often enough to care about, and even when it does, it is safe enough to assume it can reach the end of the BPB -- that means, if you assume CS <= 0xF7C0 || CS >= 0xF7E0 (and half of those values would fail to boot DOS/Windows too) then there is no need to care what CS is