> If you can mark the EXEs as something other than MZ, you could perhaps 
> make a TSR loader stub that loads an x86 emulator on demand to run EXE 
> files.
> 
> COM... I think you're gonna be stuck with using only an EXE format because 
> trying to detect a COM file by architecture is fraught with peril.

  I'd suggest using 0xC3 0x00 as a magic number for any non-8086 executable.
Or, for preference, using a 4-byte magic number: 0xC3 0x00 0x00 followed by
a byte giving the supported CPU architecture. Then the logic in the loader 
would be:

0xC3 0x00 0x00 <suitable architecture>   -> run as native EXE
0xC3 0x00 0x00 <unsuitable architecture> -> return an error
0x4D 0x5A   (or 0x5A 0x4D)               -> run in emulator as x86 EXE
anything else                            -> run in emulator as x86 COM

  The reason for using 0xC3 0x00 as the magic number is that no useful 
DOS COM file will start with those bytes (0xC3 is x86 for RET). The extended
sequence 0xC3 0x00 0x00 also rules out CP/M-80 COM files, which might start
with 0xC3 but won't follow that with two zeroes.

-- 
John Elliott

------------------------------------------------------------------------------
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to