MZ Format Support for HX DOS Extender This is some simple startup code for 32 bit dpmi clients linked as MZ executables. It supports a flat, non-zero based 32-bit memory model. The PE format - as supported by DPMILD32 - is more powerful, but for small utilities where size of executable or dynamic linking is no issue the MZ format offers the benefit of faster load time. The startup code, after having finished its job, will jump to entry mainCRTStartup with registers set to: - cs= 32 bit code selector - ds/es/ss= 32 bit data selector (same base as CS) - fs is NULL - gs holds flat, zero-based 4 GB selector - esp -> top of stack (default of stack size is 512 kB) - ecx contains heap size allocated (default size is 512 kB) Stack and heap size defaults may be overridden by defining publics in the source code. See STKSIZE.ASM for details. The program will be loaded by the dos program loader in conventional memory, so it is limited in size to free amount of this memory. As default, the startup code will move the image to extended memory, although this may be avoided (see LOADEXT.ASM for details). I have tried out 6 OMF linkers how they work with 32bit MZ object modules: - LINK.EXE from Digital Mars. Is free and does a good job. - TLINK.EXE from Borland: with switch /3 this linker is able to handle 32-bit segments of any size, but at least versions up to 7.1 have difficulties calculating correct value of stack segment. This may be corrected by patching stack offset (word at offset 0Eh) in executable (has to be same value as in .MAP file). - QLINK.EXE from Qualitas. Does a good job, but when using a response file it has problems with multiple libraries. Also it doesn't work on Win NT/2K/XP. - LINK.EXE from Microsoft: there is a limitation of 64 kB size for segments, even it is marked as 32-bit. This is true for groups as well. - AINK.EXE: seems to have problems with externals, so I wasn't able to successfully link a binary. Hints about this issue are welcome. - WLINK.EXE from Open Watcom. Is open source, but currently doesn't work because it is unable to handle 32bit object modules. As well it seems to have problems with segments > 64 kB. Support for Win32 emulation is included in OMF libraries: - DKRNL32S.LIB (emulates KERNEL32) - DUSER32S.LIB (emulates USER32) - DADVAPIS.LIB (emulates ADVAPI32) Samples for MZ format are supplied in Samples directory. Japheth