#ifndef MZ_H #define MZ_H #include #include typedef struct { // pointer into program data into which load segment is added uint16_t offset, segment; } __attribute__((packed)) reloc; typedef struct { // no endian checks - this will only work on x86+vm anyway uint16_t mz, bytes, pages, relsz, len, minalloc, // can easily ignore - we have 895k free maxalloc, ss, sp, sum, ip, cs, rel, // pointer to overlay; // zero if main binary } __attribute__((packed)) mz; typedef struct { uint16_t ss, sp, ip, cs; } mz_start; uint32_t loadmz(mz*, uint8_t*, uint32_t, uint32_t, mz_start*); #endif