538:. "Every PE file begins with a small MS-DOS executable. ... The first bytes of a PE file begin with the traditional MS-DOS header, called an IMAGE_DOS_HEADER. The only two values of any importance are e_magic and e_lfanew. ... The e_magic field (a WORD) needs to be set to the value 0x5A4D. ... In ASCII representation, 0x5A4D is MZ, the initials of Mark Zbikowski, one of the original architects of MS-DOS."
1267:
25:
1278:
288:, and the stack pointer register is set to whatever value is contained in the header information (thus if the header specifies a 512 byte stack, the stack pointer is set to 200h). It is possible to not use a separate stack segment and simply use the code segment for the stack if desired.
295:) register normally contains the same value as the CS (code segment) register and is not loaded with the actual segment address of the data segment when an EXE file is initialized; it is necessary for the programmer to set it themselves, generally done via the following instructions:
264:
information, which allows multiple segments to be loaded at arbitrary memory addresses, and it supports executables larger than 64k; however, the format still requires relatively low memory limits. These limits were later bypassed using
377:
introduced a new program termination function, INT 21h
Function 4Ch which does not require saving the PSP segment address at the start of the program, and Microsoft advised against the use of the older DOS 1.x method.
369:
Program termination would then be performed by a RETF instruction, which would retrieve the original segment address with the PSP from the stack and then jump to address 0, which contained an INT 20h instruction.
739:
487:
338:, it was also necessary to have the CS register pointing to the segment with the PSP at program termination; this was done via the following instructions:
1282:
398:(although some graphics modes are unsupported). 64-bit versions of Windows cannot execute them. Alternative ways to run these executables include
701:
578:
732:
779:
42:
531:
774:
108:
1303:
663:
89:
1271:
892:
725:
61:
633:
46:
68:
1102:
1187:
1137:
678:
284:
EXE files normally have separate segments for the code, data, and stack. Program execution begins at address 0 of the
1217:
238:
75:
35:
807:
668:
571:
475:
529:
Inside
Windows: An In-Depth Look into the Win32 Portable Executable File Format - MSDN Magazine, February 2002
57:
1308:
1132:
1107:
917:
461:
278:
261:
748:
503:
784:
564:
144:
1077:
673:
451:
395:
199:
1142:
1057:
1052:
897:
789:
257:
129:
417:
82:
1197:
483:
195:
608:
479:
947:
618:
535:
528:
421:
902:
658:
242:
191:
1297:
1192:
1047:
942:
683:
556:
1067:
1022:
446:
410:
292:
285:
266:
157:
application/x-dosexec, application/x-msdos-program, application/x-ms-dos-executable
1212:
877:
591:
425:
374:
335:
234:
215:
177:
162:
24:
717:
962:
952:
849:
839:
819:
643:
587:
391:
387:
212:
181:
152:
1207:
1162:
1037:
1032:
1027:
1017:
1237:
1202:
1002:
987:
982:
927:
922:
812:
623:
253:
140:
1252:
1222:
1177:
1152:
1087:
1082:
1072:
977:
967:
957:
937:
907:
882:
859:
854:
844:
769:
456:
413:
1232:
1227:
1127:
1117:
1112:
1092:
1042:
1007:
932:
887:
829:
802:
648:
403:
399:
246:
1247:
1182:
1172:
1157:
1122:
1012:
972:
834:
824:
688:
628:
603:
230:
1242:
1167:
1147:
1097:
1062:
912:
706:
638:
613:
429:
721:
560:
394:-based operating systems can execute them using their built-in
870:
441:
223:
219:
136:
18:
277:
The environment of an EXE program run by DOS is found in its
551:
16:
Executable file format used for .EXE files in MS-DOS
995:
868:
756:
409:MZ DOS executables can be created by linkers, like
187:
173:
167:
161:
151:
128:
49:. Unsourced material may be challenged and removed.
733:
572:
252:The MZ DOS executable file is newer than the
8:
237:: 4D 5A) at the beginning of the file (the "
123:
386:MZ DOS executables can be run from DOS and
1277:
762:
740:
726:
718:
579:
565:
557:
109:Learn how and when to remove this message
256:and differs from it. The DOS executable
521:
122:
7:
47:adding citations to reliable sources
245:, one of the leading developers of
229:The file can be identified by the
14:
474:Paul, Matthias R. (2002-10-07) .
390:-based operating systems. 32-bit
1276:
1266:
1265:
504:"masm .com(PSP) related trouble"
23:
490:from the original on 2017-09-03
34:needs additional citations for
552:OSDev Wiki - MZ format details
1:
508:alt.lang.asm discussion group
241:"). "MZ" are the initials of
502:Matthias Paul (2002-10-07).
808:Multitasking MS-DOS 4.0/4.1
1325:
1218:Technical Support SuperDOS
432:can create them directly.
1261:
765:
697:
599:
428:'s WLINK; additionally,
340:
297:
153:Internet media type
1304:Executable file formats
918:Datapac System Manager
749:Disk operating systems
462:Executable compression
279:Program Segment Prefix
702:Comparison of formats
254:COM executable format
484:alt.msdos.programmer
476:"Re: Run a COM file"
43:improve this article
1078:DEC BATCH-11/DOS-11
757:MS-DOS, IBM PC DOS,
452:Portable Executable
396:Virtual DOS machine
200:Portable Executable
125:
58:"DOS MZ executable"
1058:Concurrent DOS V60
1053:Concurrent DOS 68K
898:Concurrent CP/M-86
759:compatible systems
534:2018-07-11 at the
130:Filename extension
1291:
1290:
798:
797:
715:
714:
209:DOS MZ executable
205:
204:
196:Linear Executable
124:DOS MZ executable
119:
118:
111:
93:
1316:
1280:
1279:
1269:
1268:
763:
742:
735:
728:
719:
581:
574:
567:
558:
539:
526:
511:
498:
496:
495:
365:
362:
359:
356:
353:
350:
347:
344:
334:In the original
325:
322:
319:
316:
313:
310:
307:
304:
301:
273:Segment handling
188:Extended to
169:
126:
114:
107:
103:
100:
94:
92:
51:
27:
19:
1324:
1323:
1319:
1318:
1317:
1315:
1314:
1313:
1294:
1293:
1292:
1287:
1257:
996:Other platforms
991:
948:NetWare PalmDOS
864:
794:
758:
752:
746:
716:
711:
693:
595:
585:
548:
543:
542:
536:Wayback Machine
527:
523:
518:
501:
493:
491:
473:
470:
468:Further reading
438:
384:
367:
366:
363:
360:
357:
354:
351:
348:
345:
342:
332:
327:
326:
323:
320:
317:
314:
311:
308:
305:
302:
299:
275:
198:
194:
147:
115:
104:
98:
95:
52:
50:
40:
28:
17:
12:
11:
5:
1322:
1320:
1312:
1311:
1309:DOS technology
1306:
1296:
1295:
1289:
1288:
1286:
1285:
1274:
1262:
1259:
1258:
1256:
1255:
1250:
1245:
1240:
1235:
1230:
1225:
1220:
1215:
1210:
1205:
1200:
1195:
1190:
1185:
1180:
1175:
1170:
1165:
1160:
1155:
1150:
1145:
1140:
1135:
1130:
1125:
1120:
1115:
1110:
1105:
1100:
1095:
1090:
1085:
1080:
1075:
1070:
1065:
1060:
1055:
1050:
1045:
1040:
1035:
1030:
1025:
1020:
1015:
1010:
1005:
999:
997:
993:
992:
990:
985:
980:
975:
970:
965:
960:
955:
950:
945:
940:
935:
930:
925:
920:
915:
910:
905:
903:Concurrent DOS
900:
895:
890:
885:
880:
875:
873:
866:
865:
863:
862:
857:
852:
847:
842:
837:
832:
827:
822:
817:
816:
815:
810:
799:
796:
795:
793:
792:
787:
782:
777:
772:
766:
760:
754:
753:
747:
745:
744:
737:
730:
722:
713:
712:
710:
709:
704:
698:
695:
694:
692:
691:
686:
681:
676:
671:
666:
661:
656:
651:
646:
641:
636:
631:
626:
621:
616:
611:
606:
600:
597:
596:
586:
584:
583:
576:
569:
561:
555:
554:
547:
546:External links
544:
541:
540:
520:
519:
517:
514:
513:
512:
499:
469:
466:
465:
464:
459:
454:
449:
444:
437:
434:
383:
380:
341:
331:
328:
298:
274:
271:
243:Mark Zbikowski
211:format is the
203:
202:
192:New Executable
189:
185:
184:
175:
174:Type of format
171:
170:
165:
159:
158:
155:
149:
148:
134:
132:
117:
116:
31:
29:
22:
15:
13:
10:
9:
6:
4:
3:
2:
1321:
1310:
1307:
1305:
1302:
1301:
1299:
1284:
1275:
1273:
1264:
1263:
1260:
1254:
1251:
1249:
1246:
1244:
1241:
1239:
1236:
1234:
1231:
1229:
1226:
1224:
1221:
1219:
1216:
1214:
1211:
1209:
1206:
1204:
1201:
1199:
1196:
1194:
1193:Sinclair QDOS
1191:
1189:
1186:
1184:
1181:
1179:
1176:
1174:
1171:
1169:
1166:
1164:
1161:
1159:
1156:
1154:
1151:
1149:
1146:
1144:
1141:
1139:
1136:
1134:
1131:
1129:
1126:
1124:
1121:
1119:
1116:
1114:
1111:
1109:
1106:
1104:
1101:
1099:
1096:
1094:
1091:
1089:
1086:
1084:
1081:
1079:
1076:
1074:
1071:
1069:
1066:
1064:
1061:
1059:
1056:
1054:
1051:
1049:
1048:Commodore DOS
1046:
1044:
1041:
1039:
1036:
1034:
1031:
1029:
1026:
1024:
1021:
1019:
1016:
1014:
1011:
1009:
1006:
1004:
1001:
1000:
998:
994:
989:
986:
984:
981:
979:
976:
974:
971:
969:
966:
964:
961:
959:
956:
954:
951:
949:
946:
944:
943:Multiuser DOS
941:
939:
936:
934:
931:
929:
926:
924:
921:
919:
916:
914:
911:
909:
906:
904:
901:
899:
896:
894:
891:
889:
886:
884:
881:
879:
876:
874:
872:
867:
861:
858:
856:
853:
851:
848:
846:
843:
841:
838:
836:
833:
831:
828:
826:
823:
821:
818:
814:
811:
809:
806:
805:
804:
801:
800:
791:
788:
786:
783:
781:
778:
776:
773:
771:
768:
767:
764:
761:
755:
750:
743:
738:
736:
731:
729:
724:
723:
720:
708:
705:
703:
700:
699:
696:
690:
687:
685:
682:
680:
677:
675:
672:
670:
667:
665:
662:
660:
657:
655:
652:
650:
647:
645:
642:
640:
637:
635:
632:
630:
627:
625:
622:
620:
617:
615:
612:
610:
607:
605:
602:
601:
598:
593:
589:
582:
577:
575:
570:
568:
563:
562:
559:
553:
550:
549:
545:
537:
533:
530:
525:
522:
515:
509:
505:
500:
489:
485:
481:
477:
472:
471:
467:
463:
460:
458:
455:
453:
450:
448:
445:
443:
440:
439:
435:
433:
431:
427:
423:
419:
415:
412:
407:
405:
401:
397:
393:
389:
382:Compatibility
381:
379:
376:
371:
339:
337:
329:
296:
294:
289:
287:
282:
280:
272:
270:
268:
267:DOS extenders
263:
259:
255:
250:
248:
244:
240:
236:
233:string "MZ" (
232:
227:
225:
221:
217:
214:
210:
201:
197:
193:
190:
186:
183:
179:
176:
172:
166:
164:
160:
156:
154:
150:
146:
142:
138:
133:
131:
127:
121:
113:
110:
102:
91:
88:
84:
81:
77:
74:
70:
67:
63:
60: –
59:
55:
54:Find sources:
48:
44:
38:
37:
32:This article
30:
26:
21:
20:
1068:Cromemco DOS
1023:Apple ProDOS
653:
524:
507:
492:. Retrieved
447:DOS extender
411:Digital Mars
408:
385:
372:
368:
333:
293:data segment
290:
286:code segment
283:
276:
251:
239:magic number
228:
208:
206:
163:Magic number
120:
105:
96:
86:
79:
72:
65:
53:
41:Please help
36:verification
33:
1213:SpartaDOS X
592:object file
426:Open Watcom
375:DOS 2.x API
336:DOS 1.x API
330:Termination
235:hexadecimal
216:file format
1298:Categories
963:PC-MOS/386
953:Novell DOS
850:SISNE plus
840:Novell DOS
820:IBM PC DOS
780:Comparison
588:Executable
516:References
494:2017-09-03
392:Windows NT
388:Windows 9x
262:relocation
218:used for .
213:executable
182:executable
99:April 2015
69:newspapers
1208:SpartaDOS
1163:NewDos/80
1038:Atari TOS
1033:Atari DOS
1028:Apple SOS
1018:Apple DOS
480:Newsgroup
418:MS linker
260:contains
222:files in
1272:Category
1238:TurboDOS
1203:SmartDOS
1143:MicroDOS
1003:AmigaDOS
988:TurboDOS
983:Towns OS
928:K8918-OS
923:DOS Plus
813:MS-DOS 7
785:Commands
775:Timeline
532:Archived
488:Archived
436:See also
291:The DS (
1253:Z80-RIO
1223:Top-DOS
1178:RealDOS
1153:MSX-DOS
1088:DOS/360
1083:DIP DOS
1073:CSI-DOS
978:SCP1700
968:REAL/32
958:OpenDOS
938:MP/M-86
908:CP/M-86
883:4690 OS
878:4680 OS
860:FreeDOS
855:PTS-DOS
845:ROM-DOS
594:formats
482::
457:DOS API
414:Optlink
83:scholar
1281:
1270:
1233:TRSDOS
1228:TR-DOS
1128:iS-DOS
1118:IDEDOS
1113:GEMDOS
1093:DOS XL
1043:BW-DOS
1008:AMSDOS
933:FlexOS
888:86-DOS
869:Other
830:DR-DOS
803:MS-DOS
669:OS/360
649:Mach-O
404:DOSEMU
400:DOSBox
258:header
247:MS-DOS
178:Binary
85:
78:
71:
64:
56:
1248:Z-DOS
1183:SB-80
1173:PTDOS
1158:MyDOS
1123:IMDOS
1013:ANDOS
973:SB-86
835:H-DOS
825:DOS/V
790:Games
751:(DOS)
689:XCOFF
629:ECOFF
604:a.out
231:ASCII
90:JSTOR
76:books
1283:List
1243:UDOS
1198:RDOS
1168:OS/M
1148:MP/M
1138:MDOS
1133:ISIS
1108:FLEX
1098:Edos
1063:CP/M
913:CP/K
893:ADOS
707:.exe
644:Hunk
639:GOFF
614:COFF
590:and
430:FASM
422:VALX
402:and
373:The
361:PUSH
343:PUSH
312:DATA
207:The
62:news
1188:SCP
1103:EOS
871:x86
770:API
679:PEF
664:OMF
634:ELF
624:COM
619:CMD
609:AIF
442:DOS
424:or
349:XOR
315:MOV
300:MOV
224:DOS
220:EXE
145:dll
143:, .
141:com
139:, .
137:exe
45:by
1300::
674:PE
659:NE
654:MZ
506:.
486:.
478:.
420:,
416:,
406:.
364:AX
358:AX
352:AX
346:DS
324:AX
318:DS
303:AX
281:.
269:.
249:.
226:.
180:,
168:MZ
741:e
734:t
727:v
684:X
580:e
573:t
566:v
510:.
497:.
355:,
321:,
309:@
306:,
135:.
112:)
106:(
101:)
97:(
87:·
80:·
73:·
66:·
39:.
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.