2 ms·
Just to clarify, APE is both an EXE and a COM file. The COM file format is basically just flat executable code. The only thing you need to do, to be a legal .co
by jart 4y ago
Just to clarify, APE is both an EXE and a COM file. The COM file format is basically just flat executable code. The only thing you need to do, to be a legal .com file, is if the program is loaded and execution starts from the first byte -- it works. APE meets that requirement for Linux and bare metal. It uses a polyglot to tell if the processor is running in real mode or long mode within its DOS stub. https://github.com/jart/cosmopolitan/blob/066ed2b2b229dce4d1f49be86179bb8efa9b9724/ape/ape.S#L171 https://github.com/jart/cosmopolitan/blob/066ed2b2b229dce4d1... APE is also a legal EXE file because it has the MZ header. However... I thought it'd be more cool to signal as a DOS binary than to signal as a Windows binary, since signalling as the latter would probably be a turnoff for the Mac/Linux/BSD crowds, who are also supported by APE.