Fat binaries were larger than programs supporting only the PowerPC or 68k, which led to the creation of a number of utilities that would strip out the unneeded version. In the era of small hard drives, when 80 MB hard drives were a common size, these utilities were sometimes useful, as program code was generally a large percentage of overall drive usage, and stripping the unneeded members of a fat binary would free up a significant amount of space on a hard drive.
It was also possible to create libraries (e.g. using NeXTStep's libtool) with different targeted object files.
Apple Computer acquired NeXT in 1996 and continued to work with the OPENSTEP code. Mach-O became the native object file format in Apple's free Darwin operating system (2000) and Apple's Mac OS X (2001), and NeXT's Multi-Architecture Binaries continued to be supported by the operating system. Under Mac OS X, Multi-Architecture Binaries can be used to support multiple variants of an architecture, for instance to have different versions of 32-bit code optimized for the PowerPC G3, PowerPC G4, and PowerPC 970 generations of processors. It can also be used to support multiple architectures, such as 32-bit and 64-bit PowerPC, or PowerPC and x86, or x86-64 and ARM64.
Universal binary format was not necessary for forward migration of pre-existing native PowerPC applications; from 2006 to 2011, Apple supplied Rosetta, a PowerPC (PPC)-to-x86 dynamic binary translator, to play this role. However, Rosetta had a fairly steep performance overhead, so developers were encouraged to offer both PPC and Intel binaries, using Universal binaries. The obvious cost of Universal binary is that every installed executable file is larger, but in the years since the release of the PPC, hard-drive space has greatly outstripped executable size; while a Universal binary might be double the size of a single-platform version of the same application, free-space resources generally dwarf the code size, which becomes a minor issue. In fact, often a Universal-binary application will be smaller than two single-architecture applications because program resources can be shared rather than duplicated. If not all of the architectures are required, the lipo and ditto command-line applications can be used to remove versions from the Multi-Architecture Binary image, thereby creating what is sometimes called a thin binary.
In addition, Multi-Architecture Binary executables can contain code for both 32-bit and 64-bit versions of PowerPC and x86, allowing applications to be shipped in a form that supports 32-bit processors but that makes use of the larger address space and wider data paths when run on 64-bit processors.
In order to avoid this, some methods have been devised to build fat binaries which contain both a CP/M-80 and a DOS program, preceded by initial code which is interpreted correctly on both platforms. The methods either combine two fully functional programs each built for their corresponding environment, or add stubs which cause the program to exit gracefully if started on the wrong processor. For this to work, the first few instructions (sometimes also called gadget headers) in the .COM file have to be valid code for both 8086 and 8080 processors, which would cause the processors to branch into different locations within the code.
For example, the utilities in Simeon Cran's emulator MyZ80 start with the opcode sequence EBh, 52h, EBh. An 8086 sees this as a jump and reads its next instruction from offset +154h whereas an 8080 or compatible processor goes straight through and reads its next instruction from +103h.
A similar sequence used for this purpose is EBh, 03h, C3h.
John C. Elliott's FATBIN is a utility to combine a CP/M-80 and a DOS .COM file into one executable. His derivative of the original PMsfx modifies archives created by Yoshihiko Mino's PMarc to be self-extractable under both, CP/M-80 and DOS, starting with EBh, 18h, 2Dh, 70h, 6Dh, 73h, 2Dh to also include the "-pms-" signature for self-extracting PMA archives, thereby also representing a form of executable ASCII code.
Another method to keep a DOS-compatible operating system from erroneously executing .COM programs for CP/M-80 and MSX-DOS machines is to start the 8080 code with C3h, 03h, 01h, which is decoded as a "RET" instruction by x86 processors, thereby gracefully exiting the program, while it will be decoded as "JP 103h" instruction by 8080 processors and simply jump to the next instruction in the program. Similar, the CP/M assembler Z80ASM+ by SLR Systems would display an error message when erroneously run on DOS.
C9h is never appropriate as the first byte of a program for any x86 processor (it has different meanings for different generations, but is never a meaningful first byte); the executable loader in some versions of DOS rejects COM files that start with C9h, avoiding incorrect operation.
Under DOS, some files, by convention, have file extensions which do not reflect their actual file type. For example, COUNTRY.SYS is not a DOS device driver, but a binary NLS database file for use with the CONFIG.SYS COUNTRY directive and the NLSFUNC driver. Likewise, the PC DOS and DR-DOS system files IBMBIO.COM and IBMDOS.COM are special binary images loaded by bootstrap loaders, not COM-style programs. Trying to load COUNTRY.SYS with a DEVICE statement or executing IBMBIO.COM or IBMDOS.COM at the command prompt will cause unpredictable results.
It is sometimes possible to avoid this by utilizing techniques similar to those described above. For example, DR-DOS 7.02 and higher incorporate a safety feature developed by Matthias R. Paul: If these files are called inappropriately, tiny embedded stubs will just display some file version information and exit gracefully. Additionally, the message is specifically crafted to follow certain "magic" patterns recognized by the external NetWare & DR-DOS VERSION file identification utility.
A similar protection feature was the 8080 instruction C7h ("RST 0") at the very start of Jay Sage's and Joe Wright's Z-System type-3 and type-4 "Z3ENV" programs as well as "Z3TXT" language overlay files, which would result in a warm boot (instead of a crash) under CP/M-80 if loaded inappropriately.
The following approaches are similar to fat binaries in that multiple versions of machine code of the same purpose are provided in the same file.
Many math libraries feature hand-written assembly routines that are automatically chosen according to CPU capability. Examples include glibc, Intel MKL, and OpenBLAS. In addition, the library loader in glibc supports loading from alternative paths for specific CPU features.
A similar, but byte-level granular approach originally devised by Matthias R. Paul and Axel C. Frinke is to let a small self-discarding, relaxing and relocating loader embedded into the executable file alongside any number of alternative binary code snippets conditionally build a size- or speed-optimized runtime image of a program or driver necessary to perform (or not perform) a particular function in a particular target environment at load-time through a form of dynamic dead code elimination (DDCE).
Devanbu, Premkumar T.; Fong, Philip W. L.; Stubblebine, Stuart G. (19–25 April 1998). "3.3 Java and TH" (PDF). Techniques for Trusted Software Engineering. Proceedings of the 20th International Conference on Software Engineering. Proceedings - International Conference on Software Engineering. Kyoto, Japan. p. 131. doi:10.1109/ICSE.1998.671109. ISBN 0-8186-8368-6. ISSN 0270-5257. Archived (PDF) from the original on 2014-01-16. Retrieved 2021-09-29. (10 pages) 0-8186-8368-6
Pero, Nicola (2008-12-18). "gnustep/tools-make: README.Packaging". GitHub. Archived from the original on 2022-05-25. Retrieved 2022-05-26. https://github.com/gnustep/tools-make/blob/master/README.Packaging#L145
"PackagingDrafts/GNUstep". Fedora Project Wiki. 2009-02-25. Archived from the original on 2022-05-25. Retrieved 2022-05-26. https://fedoraproject.org/wiki/PackagingDrafts/GNUstep#.22Fat.22_unflattened_layout
"Domain System Software Release Notes, Software Release 10.1" (PDF) (first printing ed.). Chelmsford, Massachusetts, USA: Apollo Computer Inc. December 1988. p. 2-16. Order No. 005809-A03. Archived (PDF) from the original on 2023-05-26. Retrieved 2022-07-24. (256 pages) http://bitsavers.org/pdf/apollo/release_notes/005809-A03_10.1_Release_Notes_Dec88.pdf
Engst, Adam C. (1994-08-22). "Should Fat Binaries Diet?". TidBITS. No. 240. TidBITS Publishing Inc. ISSN 1090-7017. Archived from the original on 2021-09-29. Retrieved 2021-09-29. /wiki/Adam_C._Engst
Engst, Adam C. (1994-08-29). "Fat Binary Comments". TidBITS. No. 241. TidBITS Publishing Inc. ISSN 1090-7017. Archived from the original on 2021-09-29. Retrieved 2021-09-29. /wiki/Adam_C._Engst
"Chapter 1 - Resource Manager / Resource Manager Reference - Resource File Format". Inside Macintosh: Mac OS Runtime Architectures. Apple Computer. 1996-07-06. Archived from the original on 2021-09-29. Retrieved 2021-09-29. http://developer.apple.com/legacy/mac/library/documentation/mac/MoreToolbox/MoreToolbox-99.html
"Chapter 7 - Fat Binary Programs - Creating Fat Binary Programs". Inside Macintosh: Mac OS Runtime Architectures. Apple Computer. 1997-03-11. Archived from the original on 2021-09-29. Retrieved 2011-06-20. [1] https://web.archive.org/web/20210929074105/https://developer.apple.com/library/archive/documentation/mac/runtimehtml/RTArch-87.html
"Chapter 8 - PEF Structure". Inside Macintosh: Mac OS Runtime Architectures. Apple Computer. 1997-03-11. Archived from the original on 2021-09-29. Retrieved 2021-09-29. https://developer.apple.com/library/archive/documentation/mac/runtimehtml/RTArch-89.html
Engst, Adam C. (1994-08-22). "Should Fat Binaries Diet?". TidBITS. No. 240. TidBITS Publishing Inc. ISSN 1090-7017. Archived from the original on 2021-09-29. Retrieved 2021-09-29. /wiki/Adam_C._Engst
Engst, Adam C. (1994-08-29). "Fat Binary Comments". TidBITS. No. 241. TidBITS Publishing Inc. ISSN 1090-7017. Archived from the original on 2021-09-29. Retrieved 2021-09-29. /wiki/Adam_C._Engst
Tevanian, Avadis; DeMoney, Michael; Enderby, Kevin; Wiebe, Douglas; Snyder, Garth (1995-07-11) [1993-08-20]. "Method and apparatus for architecture independent executable files" (PDF). Redwood City, California, USA: NeXT Computer, Inc. US patent 5432937A. Archived (PDF) from the original on 2020-12-14. Retrieved 2022-05-26. [2] (9 pages); Tevanian, Avadis; DeMoney, Michael; Enderby, Kevin; Wiebe, Douglas; Snyder, Garth (1997-02-18) [1995-02-28]. "Method and apparatus for architecture independent executable files" (PDF). Redwood City, California, USA: NeXT Computer, Inc. US patent 5604905A. Archived (PDF) from the original on 2022-05-26. Retrieved 2022-05-26. (9 pages) https://patentimages.storage.googleapis.com/8a/87/fc/3991741ae9c814/US5432937.pdf
"Universal Binaries and 32-bit/64-bit PowerPC Binaries". Mac OS X ABI Mach-O File Format Reference. Apple Inc. 2009-02-04 [2003]. Archived from the original on 2012-04-27. https://web.archive.org/web/20120427213052/http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html%23//apple_ref/doc/uid/20001298-154889
Singh, Amit (2006-06-19). "2.6.2 Fat Binaries". Mac OS X Internals - A Systems Approach. Pearson Education. p. 66. ISBN 978-0-13270226-3. Retrieved 2021-09-28. 978-0-13270226-3
"rEFIt - EFI Fat Binaries". refit.sourceforge.net. Retrieved 2022-10-18. https://refit.sourceforge.net/info/fat_binary.html
This isn't a problem for CP/M-86 style executables under CP/M-86, CP/M-86 Plus, Personal CP/M-86, S5-DOS, Concurrent CP/M-86, Concurrent DOS, Concurrent DOS 286, FlexOS, Concurrent DOS 386, DOS Plus, Multiuser DOS, System Manager and REAL/32 because they use the file extension .CMD rather than .COM for these files. (The .CMD extension, however, is conflictive with the file extension for batchjobs written for the command line processor CMD.EXE under the OS/2 and Windows NT operating system families.) /wiki/CP/M-86
Paul, Matthias R. (2002-10-07) [2000]. "Re: Run a COM file". Newsgroup: alt.msdos.programmer. Archived from the original on 2017-09-03. Retrieved 2017-09-03. [3] (NB. Has details on DOS COM program calling conventions.) https://groups.google.com/d/msg/alt.msdos.programmer/d7blJjY0H5M/Qu3VeTOIGVcJ
Wilkinson, William "Bill" Albert (2005-04-02) [2003, 1999-02-16, February 1987, 1986-11-15, 1986-11-10]. Written at Heath Company, USA. "Something COMmon About MS-DOS and CP/M". REMark. Vol. 8, no. 2. St. Joseph, Michigan, USA: Heath/Zenith Users' Group (HUG). pp. 55–57. #85. P/N 885-2085. Archived from the original on 2021-12-13. [4] https://www.heco.wxwilki.com/commscpm.html
Wilkinson, William "Bill" Albert (2005-04-02) [2003, 1999-02-16, February 1987, 1986-11-15, 1986-11-10]. Written at Heath Company, USA. "Something COMmon About MS-DOS and CP/M". REMark. Vol. 8, no. 2. St. Joseph, Michigan, USA: Heath/Zenith Users' Group (HUG). pp. 55–57. #85. P/N 885-2085. Archived from the original on 2021-12-13. [4] https://www.heco.wxwilki.com/commscpm.html
Cha, Sang Kil; Pak, Brian; Brumley, David; Lipton, Richard Jay (2010-10-08) [2010-10-04]. Platform-Independent Programs (PDF). Proceedings of the 17th ACM conference on Computer and Communications Security (CCS'10). Chicago, Illinois, USA: Carnegie Mellon University, Pittsburgh, Pennsylvania, USA / Georgia Institute of Technology, Atlanta, Georgia, USA. pp. 547–558. doi:10.1145/1866307.1866369. ISBN 978-1-4503-0244-9. Archived (PDF) from the original on 2022-05-26. Retrieved 2022-05-26. [5] (12 pages) (See also: [6]) (NB. Does not address the scenario specifically for 8080 vs. 8086 instruction set architectures (as for CP/M and DOS), but describes the general "self-identifying program" concept of platform-independent programs (PIPs) through what the authors call a gadget header (that is, chunks of program logic not to be confused with ROP gadgets) for x86, MIPS and ARM: i.e.
0Eh, B2h, 02h, A9h, 0Eh, B2h, 02h, 3Ah, 24h, 77h, 01h, 04h or 90h, EBh, 20h, 2Ah, 90h, EBh, 20h, 3Ah, 24h, 77h, 01h, 04h.) 978-1-4503-0244-9
Cha, Sang Kil; Pak, Brian; Brumley, David; Lipton, Richard Jay (2010-10-08) [2010-10-04]. Platform-Independent Programs (PDF). Proceedings of the 17th ACM conference on Computer and Communications Security (CCS'10). Chicago, Illinois, USA: Carnegie Mellon University, Pittsburgh, Pennsylvania, USA / Georgia Institute of Technology, Atlanta, Georgia, USA. pp. 547–558. doi:10.1145/1866307.1866369. ISBN 978-1-4503-0244-9. Archived (PDF) from the original on 2022-05-26. Retrieved 2022-05-26. [5] (12 pages) (See also: [6]) (NB. Does not address the scenario specifically for 8080 vs. 8086 instruction set architectures (as for CP/M and DOS), but describes the general "self-identifying program" concept of platform-independent programs (PIPs) through what the authors call a gadget header (that is, chunks of program logic not to be confused with ROP gadgets) for x86, MIPS and ARM: i.e.
0Eh, B2h, 02h, A9h, 0Eh, B2h, 02h, 3Ah, 24h, 77h, 01h, 04h or 90h, EBh, 20h, 2Ah, 90h, EBh, 20h, 3Ah, 24h, 77h, 01h, 04h.) 978-1-4503-0244-9
Wilkinson, William "Bill" Albert; Seligman, Cory; Drushel, Richard F.; Harston, Jonathan Graham; Elliott, John C. (1999-02-17). "MS-DOS & CP/M-Compatible Binaries". Newsgroup: comp.os.cpm. Archived from the original on 2021-12-13. Retrieved 2021-12-13. (NB. Some of the opcodes in Elliott's example code (EBh, 44h, EBh and EBh, 04h, ...) might be mixed up.) https://groups.google.com/g/comp.os.cpm/c/nSiKFzq1gGE/m/PzpfpSbNx34J
Elliott, John C. (2009-10-27). "CP/M info program". Newsgroup: comp.os.cpm. Archived from the original on 2021-12-13. Retrieved 2021-12-13. […] DOS protection feature […] The idea is based on the utilities in Simeon Cran's MYZ80 emulator; the DOS-protection header in those goes one better by not changing any Z80 registers. The magic sequence is EB 52 EB: […] XCHG […] MOV D,D […] XCHG […] but that means the DOS code ends up quite a way away from the start of the program. […] More fun can be had with self-extract PMArc archives. Start one with […] defb 0EBh, 018h, '-pms-' […] and it's treated as a valid archive by the PMA utilities, sends 8086 processors to 011Ah, and Z80 processors to 0130h. […] https://groups.google.com/g/comp.os.cpm/c/RMWG4qSdbM0/m/UGll0BzoiW0J
ChristW (2012-11-14) [2012-11-13]. Chen, Raymond (ed.). "Microsoft Money crashes during import of account transactions or when changing a payee of a downloaded transaction". The New Old Thing. Archived from the original on 2018-07-05. Retrieved 2018-05-19. […] byte sequence […] EB 03 C3 yy xx […] If you create a .COM file with those 5 bytes as the first ones […] you'll see 'JMP SHORT 3', followed by 3 garbage bytes. […] If you look at a Z80 disassembly […] that translates to 'EX DE,HL; INC BC;' […] The 3rd byte is 'JUMP' followed by the 16-bit address specified as yy xx […] you'll have a .COM file that runs on MS-DOS and […] CP/M […] (NB. While the author speaks about the Z80, this sequence also works on the 8080 and compatible processors.) /wiki/Raymond_Chen_(Microsoft)
Brehm, Andrew J. (2016). "CP/M and MS-DOS Fat Binary". DesertPenguin.org. Archived from the original on 2018-05-19. Retrieved 2018-05-19. (NB. While the article speaks about the Z80, the code sequence also works on the 8080 and compatible processors.) http://www.desertpenguin.org/blog/cpm-and-ms-dos-fat-binary/
Elliott, John C. (1996-06-13). "Upload to micros.hensa.ac.uk". Newsgroup: comp.os.cpm. Archived from the original on 2021-12-13. Retrieved 2021-12-13. […] FATBIN 1.00 - combine a CP/M .COM file and a DOS .COM file to create one which runs on both platforms. […] It was used to create: […] MSODBALL 2.05 - convert floppy discs between Amstrad 706k format and a DOS 706k format. […] Both the programs run under CP/M-80 and DOS. […] https://groups.google.com/g/comp.os.cpm/c/RNMu9TVfJ98/m/QZEasTIH3R4J
Elliott, John C. (1998-06-28) [1997-04-01]. "FATBIN v1.01". Archived from the original on 1998-06-28. (NB. FATBN101.COM 22k 1997-04-01 FATBIN v1.01. Creates fat binary files which will run under both CP/M and DOS. Distributed in a self-extracting archive for CP/M-80 and DOS.) https://web.archive.org/web/19980628081239/http://www.seasip.demon.co.uk/Cpm/software/fatbnsea.com
Elliott, John C. (2002-03-11). "DSKWRITE v1.00". Fossies - the Fresh Open Source Software Archive. Archived from the original on 2021-12-12. Retrieved 2021-12-12. […] DSKWRITE.Z80 contains source for the CP/M version. […] DSKWRITE.ASM contains source for the DOS version. […] To get the single .COM file, you need to use FBMAKE: […] [7] (NB. Mentions FBMAKE from the FATBNSEA.COM package.) https://fossies.org/linux/libdsk/dskwrite/dskwrite.txt
Wilkinson, William "Bill" Albert; Seligman, Cory; Drushel, Richard F.; Harston, Jonathan Graham; Elliott, John C. (1999-02-17). "MS-DOS & CP/M-Compatible Binaries". Newsgroup: comp.os.cpm. Archived from the original on 2021-12-13. Retrieved 2021-12-13. (NB. Some of the opcodes in Elliott's example code (EBh, 44h, EBh and EBh, 04h, ...) might be mixed up.) https://groups.google.com/g/comp.os.cpm/c/nSiKFzq1gGE/m/PzpfpSbNx34J
Elliott, John C. (2012-06-20) [2005-01-05]. "Generic CP/M". Seasip.info. Archived from the original on 2021-11-17. Retrieved 2021-12-12. […] Self-extracting archives are .COM files containing a number of smaller files. When you run one, it will create its smaller files […] The self-extract archive programs will run under DOS (2 or later) or CP/M, with identical effects. To extract them under Unix, you can use ZXCC […] FATBNSEA.COM […] FATBIN combines a CP/M-80 .COM file and a DOS .COM file to produce one that will work on both systems. […] M3C4SEA.COM […] M3CONV version 4 - converts Spectrum snapshots in the .Z80 or .SNA format to or from Multiface 3 format (Multiface 3 -> Z80 only on a PC). […] PMSFX21X.COM […] PMSFX is the program that was used to generate these self-unpacking archives. This version (2.11) can generate archives which unpack themselves under CP/M or DOS. You will need PMARC to use PMSFX. New: Under DOS, it supports exact file sizes. […] SP2BMSEA.COM […] Converts a Stop Press Canvas file to a Windows .BMP […] [8] https://www.seasip.info/Cpm/software/fatbnsea.com
Elliott, John C. (1997-01-18) [1997-01-11]. "PMSFX 2". Newsgroup: comp.os.cpm. Archived from the original on 2021-12-13. Retrieved 2021-12-13. […] I've written a version of PMSFX that produces .COM files unpackable under DOS and CP/M (the first three bytes are both legal Z80 code, legal 8086 code and legal PMA header) […] as a self-extracting archive. […] https://groups.google.com/g/comp.os.cpm/c/tmvc1Wzz28A/m/s6GzKZKqSk0J
Wilkinson, William "Bill" Albert; Seligman, Cory; Drushel, Richard F.; Harston, Jonathan Graham; Elliott, John C. (1999-02-17). "MS-DOS & CP/M-Compatible Binaries". Newsgroup: comp.os.cpm. Archived from the original on 2021-12-13. Retrieved 2021-12-13. (NB. Some of the opcodes in Elliott's example code (EBh, 44h, EBh and EBh, 04h, ...) might be mixed up.) https://groups.google.com/g/comp.os.cpm/c/nSiKFzq1gGE/m/PzpfpSbNx34J
Elliott, John C. (2012-06-20) [2005-01-05]. "Generic CP/M". Seasip.info. Archived from the original on 2021-11-17. Retrieved 2021-12-12. […] Self-extracting archives are .COM files containing a number of smaller files. When you run one, it will create its smaller files […] The self-extract archive programs will run under DOS (2 or later) or CP/M, with identical effects. To extract them under Unix, you can use ZXCC […] FATBNSEA.COM […] FATBIN combines a CP/M-80 .COM file and a DOS .COM file to produce one that will work on both systems. […] M3C4SEA.COM […] M3CONV version 4 - converts Spectrum snapshots in the .Z80 or .SNA format to or from Multiface 3 format (Multiface 3 -> Z80 only on a PC). […] PMSFX21X.COM […] PMSFX is the program that was used to generate these self-unpacking archives. This version (2.11) can generate archives which unpack themselves under CP/M or DOS. You will need PMARC to use PMSFX. New: Under DOS, it supports exact file sizes. […] SP2BMSEA.COM […] Converts a Stop Press Canvas file to a Windows .BMP […] [8] https://www.seasip.info/Cpm/software/fatbnsea.com
Elliott, John C. (2009-10-27). "CP/M info program". Newsgroup: comp.os.cpm. Archived from the original on 2021-12-13. Retrieved 2021-12-13. […] DOS protection feature […] The idea is based on the utilities in Simeon Cran's MYZ80 emulator; the DOS-protection header in those goes one better by not changing any Z80 registers. The magic sequence is EB 52 EB: […] XCHG […] MOV D,D […] XCHG […] but that means the DOS code ends up quite a way away from the start of the program. […] More fun can be had with self-extract PMArc archives. Start one with […] defb 0EBh, 018h, '-pms-' […] and it's treated as a valid archive by the PMA utilities, sends 8086 processors to 011Ah, and Z80 processors to 0130h. […] https://groups.google.com/g/comp.os.cpm/c/RMWG4qSdbM0/m/UGll0BzoiW0J
Wilkinson, William "Bill" Albert (2005-04-02) [2003, 1999-02-16, February 1987, 1986-11-15, 1986-11-10]. Written at Heath Company, USA. "Something COMmon About MS-DOS and CP/M". REMark. Vol. 8, no. 2. St. Joseph, Michigan, USA: Heath/Zenith Users' Group (HUG). pp. 55–57. #85. P/N 885-2085. Archived from the original on 2021-12-13. [4] https://www.heco.wxwilki.com/commscpm.html
This works because a (suitable) return instruction can be used to exit programs under CP/M-80, CP/M-86 and DOS, although the opcodes, exact conditions and underlying mechanisms differ: Under CP/M-80, programs can terminate (that is, warm boot into the BIOS) by jumping to 0 in the zero page, either directly with RST 0 (8080/8085/Z80 opcode C7h), or by calling BDOS function 0 through the CALL 5 interface. Alternatively, as the stack is prepared to hold a 0 return address before passing control to a loaded program, they can, for as long as the stack is flat, also be exited by issuing a RET (opcode C9h) instruction, thereby falling into the terminating code at offset 0 in the zero page. Although DOS has a dedicated INT 20h interrupt as well as INT 21h API sub-functions to terminate programs (which are preferable for more complicated programs), for machine-translated programs DOS also emulates CP/M's behaviour to some extent: A program can terminate itself by jumping to offset 0 in its PSP (the equivalent to CP/M's zero page), where the system had previously planted an INT 20h instruction. Also, a loaded program's initial stack is prepared to hold a word of 0, so that a program issuing a near return RETN (8088/8086 opcode C3h) will implicitly jump to the start of its code segment as well, thereby eventually reaching the INT 20h as well.[a] In CP/M-86, the zero page is structured differently and there is no CALL 5 interface, but the stack return method and BDOS function 0 (but now through INT E0h) both work as well. /wiki/Return_instruction
Wilkinson, William "Bill" Albert; Seligman, Cory; Drushel, Richard F.; Harston, Jonathan Graham; Elliott, John C. (1999-02-17). "MS-DOS & CP/M-Compatible Binaries". Newsgroup: comp.os.cpm. Archived from the original on 2021-12-13. Retrieved 2021-12-13. (NB. Some of the opcodes in Elliott's example code (EBh, 44h, EBh and EBh, 04h, ...) might be mixed up.) https://groups.google.com/g/comp.os.cpm/c/nSiKFzq1gGE/m/PzpfpSbNx34J
Elliott, John C.; Lopushinsky, Jim (2002) [1998-04-11]. "CP/M 3 COM file header". Seasip.info. Archived from the original on 2016-08-30. Retrieved 2016-08-29. http://www.seasip.info/Cpm/rsxrec.html
This works because a (suitable) return instruction can be used to exit programs under CP/M-80, CP/M-86 and DOS, although the opcodes, exact conditions and underlying mechanisms differ: Under CP/M-80, programs can terminate (that is, warm boot into the BIOS) by jumping to 0 in the zero page, either directly with RST 0 (8080/8085/Z80 opcode C7h), or by calling BDOS function 0 through the CALL 5 interface. Alternatively, as the stack is prepared to hold a 0 return address before passing control to a loaded program, they can, for as long as the stack is flat, also be exited by issuing a RET (opcode C9h) instruction, thereby falling into the terminating code at offset 0 in the zero page. Although DOS has a dedicated INT 20h interrupt as well as INT 21h API sub-functions to terminate programs (which are preferable for more complicated programs), for machine-translated programs DOS also emulates CP/M's behaviour to some extent: A program can terminate itself by jumping to offset 0 in its PSP (the equivalent to CP/M's zero page), where the system had previously planted an INT 20h instruction. Also, a loaded program's initial stack is prepared to hold a word of 0, so that a program issuing a near return RETN (8088/8086 opcode C3h) will implicitly jump to the start of its code segment as well, thereby eventually reaching the INT 20h as well.[a] In CP/M-86, the zero page is structured differently and there is no CALL 5 interface, but the stack return method and BDOS function 0 (but now through INT E0h) both work as well. /wiki/Return_instruction
On 8088/8086 processors, the opcode C9h is an undocumented alias for CBh ("RETF", popping CS:IP from the stack), whereas it decodes as "LEAVE" (set SP to BP and pop BP) on 80188/80186 and newer processors. /wiki/8088
Wilkinson, William "Bill" Albert; Seligman, Cory; Drushel, Richard F.; Harston, Jonathan Graham; Elliott, John C. (1999-02-17). "MS-DOS & CP/M-Compatible Binaries". Newsgroup: comp.os.cpm. Archived from the original on 2021-12-13. Retrieved 2021-12-13. (NB. Some of the opcodes in Elliott's example code (EBh, 44h, EBh and EBh, 04h, ...) might be mixed up.) https://groups.google.com/g/comp.os.cpm/c/nSiKFzq1gGE/m/PzpfpSbNx34J
Wilkinson, William "Bill" Albert; Seligman, Cory; Drushel, Richard F.; Harston, Jonathan Graham; Elliott, John C. (1999-02-17). "MS-DOS & CP/M-Compatible Binaries". Newsgroup: comp.os.cpm. Archived from the original on 2021-12-13. Retrieved 2021-12-13. (NB. Some of the opcodes in Elliott's example code (EBh, 44h, EBh and EBh, 04h, ...) might be mixed up.) https://groups.google.com/g/comp.os.cpm/c/nSiKFzq1gGE/m/PzpfpSbNx34J
Cha, Sang Kil; Pak, Brian; Brumley, David; Lipton, Richard Jay (2010-10-08) [2010-10-04]. Platform-Independent Programs (PDF). Proceedings of the 17th ACM conference on Computer and Communications Security (CCS'10). Chicago, Illinois, USA: Carnegie Mellon University, Pittsburgh, Pennsylvania, USA / Georgia Institute of Technology, Atlanta, Georgia, USA. pp. 547–558. doi:10.1145/1866307.1866369. ISBN 978-1-4503-0244-9. Archived (PDF) from the original on 2022-05-26. Retrieved 2022-05-26. [5] (12 pages) (See also: [6]) (NB. Does not address the scenario specifically for 8080 vs. 8086 instruction set architectures (as for CP/M and DOS), but describes the general "self-identifying program" concept of platform-independent programs (PIPs) through what the authors call a gadget header (that is, chunks of program logic not to be confused with ROP gadgets) for x86, MIPS and ARM: i.e.
0Eh, B2h, 02h, A9h, 0Eh, B2h, 02h, 3Ah, 24h, 77h, 01h, 04h or 90h, EBh, 20h, 2Ah, 90h, EBh, 20h, 3Ah, 24h, 77h, 01h, 04h.) 978-1-4503-0244-9
This isn't a problem for CP/M-86 style executables under CP/M-86, CP/M-86 Plus, Personal CP/M-86, S5-DOS, Concurrent CP/M-86, Concurrent DOS, Concurrent DOS 286, FlexOS, Concurrent DOS 386, DOS Plus, Multiuser DOS, System Manager and REAL/32 because they use the file extension .CMD rather than .COM for these files. (The .CMD extension, however, is conflictive with the file extension for batchjobs written for the command line processor CMD.EXE under the OS/2 and Windows NT operating system families.) /wiki/CP/M-86
Necasek, Michal (2018-01-30) [2018-01-28, 2018-01-26]. "WordStar Again". OS/2 Museum. Archived from the original on 2019-07-28. Retrieved 2019-07-28. […] The reason to suspect such difference is that version 3.2x also supported CP/M-86 (the overlays are identical between DOS and CP/M-86, only the main executable is different) […] the .OVR files are 100% identical between DOS and CP/M-86, with a flag (clearly shown in the WordStar 3.20 manual) switching between them at runtime […] the OS interface in WordStar is quite narrow and well abstracted […] the WordStar 3.2x overlays are 100% identical between the DOS and CP/M-86 versions. There is a runtime switch which chooses between calling INT 21h (DOS) and INT E0h (CP/M-86). WS.COM is not the same between DOS and CP/M-86, although it's probably not very different either. […] http://www.os2museum.com/wp/wordstar-again/comment-page-1/
Necasek, Michal (2018-01-30) [2018-01-28, 2018-01-26]. "WordStar Again". OS/2 Museum. Archived from the original on 2019-07-28. Retrieved 2019-07-28. […] The reason to suspect such difference is that version 3.2x also supported CP/M-86 (the overlays are identical between DOS and CP/M-86, only the main executable is different) […] the .OVR files are 100% identical between DOS and CP/M-86, with a flag (clearly shown in the WordStar 3.20 manual) switching between them at runtime […] the OS interface in WordStar is quite narrow and well abstracted […] the WordStar 3.2x overlays are 100% identical between the DOS and CP/M-86 versions. There is a runtime switch which chooses between calling INT 21h (DOS) and INT E0h (CP/M-86). WS.COM is not the same between DOS and CP/M-86, although it's probably not very different either. […] http://www.os2museum.com/wp/wordstar-again/comment-page-1/
Lineback, Nathan. "GSX Screen Shots". Toastytech.com. Archived from the original on 2020-01-15. Retrieved 2020-01-15. http://toastytech.com/guis/gsx.html
Paul, Matthias R. (2002-04-11). "Re: [fd-dev] ANNOUNCE: CuteMouse 2.0 alpha 1". freedos-dev. Archived from the original on 2020-02-21. Retrieved 2020-02-21. […] FreeKEYB is […] a true .COM and .SYS driver (tiny model) in one. You can safely overwrite the first JMP, that's part of what I meant by "tricky header". […] you can replace the FFFFh:FFFFh by a 3-byte jump and a pending DB FFh. It works with MS-DOS, PC DOS, DR-DOS, and most probably any other DOS issue as well. […] https://marc.info/?l=freedos-dev&m=101853130816682&w=2
Paul, Matthias R. (2002-04-06). "Re: [fd-dev] ANNOUNCE: CuteMouse 2.0 alpha 1". freedos-dev. Archived from the original on 2020-02-07. Retrieved 2020-02-07. […] Add a SYS device driver header to the driver, so that CTMOUSE could be both in one, a normal TSR and a device driver - similar to our FreeKEYB advanced keyboard driver. […] This is not really needed under DR DOS because INSTALL= is supported since DR DOS 3.41+ and DR DOS preserves the order of [D]CONFIG.SYS directives […] but it would […] improve the […] flexibility on MS-DOS/PC DOS systems, which […] always execute DEVICE= directives prior to any INSTALL= statements, regardless of their order in the file. […] software may require the mouse driver to be present as a device driver, as mouse drivers have always been device drivers back in the old times. These mouse drivers have had specific device driver names depending on which protocol they used ("PC$MOUSE" for Mouse Systems Mode for example), and some software may search for these drivers in order to find out the correct type of mouse to be used. […] Another advantage would be that device drivers usually consume less memory (no environment, no PSP) […] It's basically a tricky file header, a different code to parse the command line, a different entry point and exit line, and some segment magics to overcome the ORG 0 / ORG 100h difference. Self-loadhighing a device driver is a bit more tricky as you have to leave the driver header where it is and only relocate the remainder of the driver […] https://marc.info/?l=freedos-dev&m=101807226917577
Paul, Matthias R. (2002-04-11). "Re: [fd-dev] ANNOUNCE: CuteMouse 2.0 alpha 1". freedos-dev. Archived from the original on 2020-02-21. Retrieved 2020-02-21. […] FreeKEYB is […] a true .COM and .SYS driver (tiny model) in one. You can safely overwrite the first JMP, that's part of what I meant by "tricky header". […] you can replace the FFFFh:FFFFh by a 3-byte jump and a pending DB FFh. It works with MS-DOS, PC DOS, DR-DOS, and most probably any other DOS issue as well. […] https://marc.info/?l=freedos-dev&m=101853130816682&w=2
Paul, Matthias R. (2002-04-11). "Re: [fd-dev] ANNOUNCE: CuteMouse 2.0 alpha 1". freedos-dev. Archived from the original on 2020-02-21. Retrieved 2020-02-21. […] FreeKEYB is […] a true .COM and .SYS driver (tiny model) in one. You can safely overwrite the first JMP, that's part of what I meant by "tricky header". […] you can replace the FFFFh:FFFFh by a 3-byte jump and a pending DB FFh. It works with MS-DOS, PC DOS, DR-DOS, and most probably any other DOS issue as well. […] https://marc.info/?l=freedos-dev&m=101853130816682&w=2
Paul, Matthias R. (2002-04-06). "Re: [fd-dev] ANNOUNCE: CuteMouse 2.0 alpha 1". freedos-dev. Archived from the original on 2020-02-07. Retrieved 2020-02-07. […] Add a SYS device driver header to the driver, so that CTMOUSE could be both in one, a normal TSR and a device driver - similar to our FreeKEYB advanced keyboard driver. […] This is not really needed under DR DOS because INSTALL= is supported since DR DOS 3.41+ and DR DOS preserves the order of [D]CONFIG.SYS directives […] but it would […] improve the […] flexibility on MS-DOS/PC DOS systems, which […] always execute DEVICE= directives prior to any INSTALL= statements, regardless of their order in the file. […] software may require the mouse driver to be present as a device driver, as mouse drivers have always been device drivers back in the old times. These mouse drivers have had specific device driver names depending on which protocol they used ("PC$MOUSE" for Mouse Systems Mode for example), and some software may search for these drivers in order to find out the correct type of mouse to be used. […] Another advantage would be that device drivers usually consume less memory (no environment, no PSP) […] It's basically a tricky file header, a different code to parse the command line, a different entry point and exit line, and some segment magics to overcome the ORG 0 / ORG 100h difference. Self-loadhighing a device driver is a bit more tricky as you have to leave the driver header where it is and only relocate the remainder of the driver […] https://marc.info/?l=freedos-dev&m=101807226917577
Paul, Matthias R. (2002-04-06). "Re: [fd-dev] ANNOUNCE: CuteMouse 2.0 alpha 1". freedos-dev. Archived from the original on 2020-02-07. Retrieved 2020-02-07. […] Add a SYS device driver header to the driver, so that CTMOUSE could be both in one, a normal TSR and a device driver - similar to our FreeKEYB advanced keyboard driver. […] This is not really needed under DR DOS because INSTALL= is supported since DR DOS 3.41+ and DR DOS preserves the order of [D]CONFIG.SYS directives […] but it would […] improve the […] flexibility on MS-DOS/PC DOS systems, which […] always execute DEVICE= directives prior to any INSTALL= statements, regardless of their order in the file. […] software may require the mouse driver to be present as a device driver, as mouse drivers have always been device drivers back in the old times. These mouse drivers have had specific device driver names depending on which protocol they used ("PC$MOUSE" for Mouse Systems Mode for example), and some software may search for these drivers in order to find out the correct type of mouse to be used. […] Another advantage would be that device drivers usually consume less memory (no environment, no PSP) […] It's basically a tricky file header, a different code to parse the command line, a different entry point and exit line, and some segment magics to overcome the ORG 0 / ORG 100h difference. Self-loadhighing a device driver is a bit more tricky as you have to leave the driver header where it is and only relocate the remainder of the driver […] https://marc.info/?l=freedos-dev&m=101807226917577
This problem could have been avoided by choosing non-conflicting file extensions, but, once introduced, these particular file names were retained from very early versions of MS-DOS/PC DOS for compatibility reasons with (third-party) tools hard-wired to expect these specific file names. /wiki/File_extension
Paul, Matthias R. (2001-06-10) [1995]. "DOS COUNTRY.SYS file format" (COUNTRY.LST file) (1.44 ed.). Archived from the original on 2016-04-20. Retrieved 2016-08-20. http://www.columbia.edu/~em36/wpdos/MatthiasPaulCPI.zip
Other DOS files of this type are KEYBOARD.SYS, a binary keyboard layout database file for the keyboard driver KEYB under MS-DOS and PC DOS, IO.SYS containing the DOS BIOS under MS-DOS, and MSDOS.SYS, a text configuration file under Windows 95/MS-DOS 7.0 and higher, but originally a binary system file containing the MS-DOS kernel. However, MS-DOS and PC DOS do not provide crash-protected system files at all, and these file names are neither used nor needed in DR-DOS 7.02 and higher, which otherwise does provide crash-protected system files. /wiki/DOS
Paul, Matthias R. (2001-06-10) [1995]. "DOS COUNTRY.SYS file format" (COUNTRY.LST file) (1.44 ed.). Archived from the original on 2016-04-20. Retrieved 2016-08-20. http://www.columbia.edu/~em36/wpdos/MatthiasPaulCPI.zip
Other DOS files of this type are KEYBOARD.SYS, a binary keyboard layout database file for the keyboard driver KEYB under MS-DOS and PC DOS, IO.SYS containing the DOS BIOS under MS-DOS, and MSDOS.SYS, a text configuration file under Windows 95/MS-DOS 7.0 and higher, but originally a binary system file containing the MS-DOS kernel. However, MS-DOS and PC DOS do not provide crash-protected system files at all, and these file names are neither used nor needed in DR-DOS 7.02 and higher, which otherwise does provide crash-protected system files. /wiki/DOS
This problem could have been avoided by choosing non-conflicting file extensions, but, once introduced, these particular file names were retained from very early versions of MS-DOS/PC DOS for compatibility reasons with (third-party) tools hard-wired to expect these specific file names. /wiki/File_extension
This is the reason why these files have the hidden attribute set, so that they are not listed by default, thereby reducing the risk of being invoked accidentally. /wiki/File_attribute
Paul, Matthias R. (1997-07-30) [1994-05-01]. "Chapter II.4. Undokumentierte Eigenschaften externer Kommandos - SYS.COM". NWDOS-TIPs — Tips & Tricks rund um Novell DOS 7, mit Blick auf undokumentierte Details, Bugs und Workarounds. MPDOSTIP (in German) (3 ed.). Archived from the original on 2017-09-10. Retrieved 2014-08-06. Für ein zukünftiges Update für Calderas OpenDOS 7.01 habe ich den Startcode von IBMBIO.COM so modifiziert, daß er - falls fälschlicherweise als normales Programm gestartet - ohne Absturz zur Kommandozeile zurückkehrt. Wann diese Sicherheitsfunktion in die offizielle Version Einzug halten wird, ist jedoch noch nicht abzusehen. (NB. NWDOSTIP.TXT is a comprehensive work on Novell DOS 7 and OpenDOS 7.01, including the description of many undocumented features and internals. It is part of the author's yet larger MPDOSTIP.ZIP collection maintained up to 2001 and distributed on many sites at the time. The provided link points to a HTML-converted older version of the NWDOSTIP.TXT file.) [9] http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm
Paul, Matthias R. (1997-10-02). "Caldera OpenDOS 7.01/7.02 Update Alpha 3 IBMBIO.COM README.TXT". Archived from the original on 2003-10-04. Retrieved 2009-03-29. [10] https://web.archive.org/web/20031004074600/http://www-student.informatik.uni-bonn.de/~frinke/ibmbioa3.zip
Paul, Matthias R. (1997-07-30) [1994-05-01]. "Chapter II.4. Undokumentierte Eigenschaften externer Kommandos - SYS.COM". NWDOS-TIPs — Tips & Tricks rund um Novell DOS 7, mit Blick auf undokumentierte Details, Bugs und Workarounds. MPDOSTIP (in German) (3 ed.). Archived from the original on 2017-09-10. Retrieved 2014-08-06. Für ein zukünftiges Update für Calderas OpenDOS 7.01 habe ich den Startcode von IBMBIO.COM so modifiziert, daß er - falls fälschlicherweise als normales Programm gestartet - ohne Absturz zur Kommandozeile zurückkehrt. Wann diese Sicherheitsfunktion in die offizielle Version Einzug halten wird, ist jedoch noch nicht abzusehen. (NB. NWDOSTIP.TXT is a comprehensive work on Novell DOS 7 and OpenDOS 7.01, including the description of many undocumented features and internals. It is part of the author's yet larger MPDOSTIP.ZIP collection maintained up to 2001 and distributed on many sites at the time. The provided link points to a HTML-converted older version of the NWDOSTIP.TXT file.) [9] http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm
DR-DOS 7.03 WHATSNEW.TXT - Changes from DR-DOS 7.02 to DR-DOS 7.03. Caldera, Inc. 1998-12-24. Archived from the original on 2019-04-08. Retrieved 2019-04-08. https://web.archive.org/web/20190408142232/http://www.lookas.net/ftp/incoming/darbui/Justas/DRDOS/WHATSNEW.TXT
Paul, Matthias R. (2001-06-10) [1995]. "DOS COUNTRY.SYS file format" (COUNTRY.LST file) (1.44 ed.). Archived from the original on 2016-04-20. Retrieved 2016-08-20. http://www.columbia.edu/~em36/wpdos/MatthiasPaulCPI.zip
Paul, Matthias R. (2001-06-10) [1995]. "DOS COUNTRY.SYS file format" (COUNTRY.LST file) (1.44 ed.). Archived from the original on 2016-04-20. Retrieved 2016-08-20. http://www.columbia.edu/~em36/wpdos/MatthiasPaulCPI.zip
Paul, Matthias R. (1997-07-30) [1994-05-01]. "Chapter II.4. Undokumentierte Eigenschaften externer Kommandos - SYS.COM". NWDOS-TIPs — Tips & Tricks rund um Novell DOS 7, mit Blick auf undokumentierte Details, Bugs und Workarounds. MPDOSTIP (in German) (3 ed.). Archived from the original on 2017-09-10. Retrieved 2014-08-06. Für ein zukünftiges Update für Calderas OpenDOS 7.01 habe ich den Startcode von IBMBIO.COM so modifiziert, daß er - falls fälschlicherweise als normales Programm gestartet - ohne Absturz zur Kommandozeile zurückkehrt. Wann diese Sicherheitsfunktion in die offizielle Version Einzug halten wird, ist jedoch noch nicht abzusehen. (NB. NWDOSTIP.TXT is a comprehensive work on Novell DOS 7 and OpenDOS 7.01, including the description of many undocumented features and internals. It is part of the author's yet larger MPDOSTIP.ZIP collection maintained up to 2001 and distributed on many sites at the time. The provided link points to a HTML-converted older version of the NWDOSTIP.TXT file.) [9] http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm
The COUNTRY.SYS file formats supported by the MS-DOS/PC DOS and the DR-DOS families of operating systems contain similar data but are organized differently and incompatible. Since the entry points into the data structures are at different offsets in the file it is possible to create "fat" COUNTRY.SYS databases, which could be used under both DOS families.[b] However, DR-DOS 7.02 and its NLSFUNC 4.00 (and higher) include an improved parser capable of reading both types of formats (and variants), even at the same time, so that Janus-headed files are not necessary.[c][d] The shipped files are nevertheless "fat" for including a tiny executable stub just displaying an embedded message when invoked inappropriately.[d][b] /wiki/MS-DOS
Sage, Jay (May–June 1988). Carlson, Art (ed.). "ZCPR 3.4 - Type-4 Programs". The Computer Journal (TCJ) - Programming, User Support, Applications. ZCPR3 Corner (32). Columbia Falls, Montana, USA: 10–17 [16]. ISSN 0748-9331. ark:/13960/t1wd4v943. Retrieved 2021-11-29. [11][12] https://archive.org/details/the-computer-journal-32
Sage, Jay (May–June 1992) [March–June 1992]. Carlson, Art; McEwen, Chris (eds.). "Type-3 and Type-4 Programs". The Computer Journal (TCJ) - Programming, User Support, Applications. Z-System Corner - Some New Applications of Type-4 Programs (55). S. Plainfield, New Jersey, USA: Socrates Press: 13–19 [14, 16]. ISSN 0748-9331. ark:/13960/t4dn54d22. Retrieved 2021-11-29. [13][14] https://archive.org/details/the-computer-journal-55
Sage, Jay (November–December 1992). Carlson, Art; Kibler, Bill D. (eds.). "Regular Feature, ZCPR Support, Language Independence, part 2". The Computer Journal (TCJ) - Programming, User Support, Applications. The Z-System Corner (58). Lincoln, CA, USA: 7–10. ISSN 0748-9331. ark:/13960/t70v9g87h. Retrieved 2020-02-09. […] there was an opcode of "RST 0", which, if executed, would result in a warm boot. A file containing a Z3TXT module should never be executed, but at a cost of one byte we could protect ourself against that outside chance. The header also contained the string of characters "Z3TXT" followed by a null (0) byte. Many Z-System modules include such identifiers. In this category are resident command packages (RCPs), flow command packages (FCPs), and environment descriptor modules (Z3ENVs). Programs, such as Bridger Mitchell's […] JETLDR.COM, that load these modules from files into memory can use the ID string to validate the file, that is, to make sure that it is the kind of module that the user has stated it to be. User mistakes and damaged files can thus be detected. […] The header, thus, now stands as follows: […] rst […] db 'Z3TXT',0 ; null-terminated ID […] ; 12345678 ; must be 8 characters, […] db 'PROGNAME' ; pad with spaces […] ; 123 ; must be 3 characters […] db 'ENG' ; name of language […] dw LENGTH ; length of module […] [15][16] https://archive.org/details/the-computer-journal-58
Sage, Jay (May–June 1988). Carlson, Art (ed.). "ZCPR 3.4 - Type-4 Programs". The Computer Journal (TCJ) - Programming, User Support, Applications. ZCPR3 Corner (32). Columbia Falls, Montana, USA: 10–17 [16]. ISSN 0748-9331. ark:/13960/t1wd4v943. Retrieved 2021-11-29. [11][12] https://archive.org/details/the-computer-journal-32
Sage, Jay (May–June 1992) [March–June 1992]. Carlson, Art; McEwen, Chris (eds.). "Type-3 and Type-4 Programs". The Computer Journal (TCJ) - Programming, User Support, Applications. Z-System Corner - Some New Applications of Type-4 Programs (55). S. Plainfield, New Jersey, USA: Socrates Press: 13–19 [14, 16]. ISSN 0748-9331. ark:/13960/t4dn54d22. Retrieved 2021-11-29. [13][14] https://archive.org/details/the-computer-journal-55
Sage, Jay (November–December 1992). Carlson, Art; Kibler, Bill D. (eds.). "Regular Feature, ZCPR Support, Language Independence, part 2". The Computer Journal (TCJ) - Programming, User Support, Applications. The Z-System Corner (58). Lincoln, CA, USA: 7–10. ISSN 0748-9331. ark:/13960/t70v9g87h. Retrieved 2020-02-09. […] there was an opcode of "RST 0", which, if executed, would result in a warm boot. A file containing a Z3TXT module should never be executed, but at a cost of one byte we could protect ourself against that outside chance. The header also contained the string of characters "Z3TXT" followed by a null (0) byte. Many Z-System modules include such identifiers. In this category are resident command packages (RCPs), flow command packages (FCPs), and environment descriptor modules (Z3ENVs). Programs, such as Bridger Mitchell's […] JETLDR.COM, that load these modules from files into memory can use the ID string to validate the file, that is, to make sure that it is the kind of module that the user has stated it to be. User mistakes and damaged files can thus be detected. […] The header, thus, now stands as follows: […] rst […] db 'Z3TXT',0 ; null-terminated ID […] ; 12345678 ; must be 8 characters, […] db 'PROGNAME' ; pad with spaces […] ; 123 ; must be 3 characters […] db 'ENG' ; name of language […] dw LENGTH ; length of module […] [15][16] https://archive.org/details/the-computer-journal-58
This works because a (suitable) return instruction can be used to exit programs under CP/M-80, CP/M-86 and DOS, although the opcodes, exact conditions and underlying mechanisms differ: Under CP/M-80, programs can terminate (that is, warm boot into the BIOS) by jumping to 0 in the zero page, either directly with RST 0 (8080/8085/Z80 opcode C7h), or by calling BDOS function 0 through the CALL 5 interface. Alternatively, as the stack is prepared to hold a 0 return address before passing control to a loaded program, they can, for as long as the stack is flat, also be exited by issuing a RET (opcode C9h) instruction, thereby falling into the terminating code at offset 0 in the zero page. Although DOS has a dedicated INT 20h interrupt as well as INT 21h API sub-functions to terminate programs (which are preferable for more complicated programs), for machine-translated programs DOS also emulates CP/M's behaviour to some extent: A program can terminate itself by jumping to offset 0 in its PSP (the equivalent to CP/M's zero page), where the system had previously planted an INT 20h instruction. Also, a loaded program's initial stack is prepared to hold a word of 0, so that a program issuing a near return RETN (8088/8086 opcode C3h) will implicitly jump to the start of its code segment as well, thereby eventually reaching the INT 20h as well.[a] In CP/M-86, the zero page is structured differently and there is no CALL 5 interface, but the stack return method and BDOS function 0 (but now through INT E0h) both work as well. /wiki/Return_instruction
"Table of IO Device Characteristics - Console or Teletypewriters". PDP-6 Multiprogramming System Manual (PDF). Maynard, Massachusetts, USA: Digital Equipment Corporation (DEC). 1965. p. 43. DEC-6-0-EX-SYS-UM-IP-PRE00. Archived (PDF) from the original on 2014-07-14. Retrieved 2014-07-10. (1+84+10 pages) http://bitsavers.trailing-edge.com/pdf/dec/pdp6/DEC-6-0-EX-SYS-UM-IP-PRE00_Multiprogramming_System_Manual_1965.pdf
"5.1.1.1. Device Dependent Functions - Data Modes - Full-Duplex Software A(ASCII) and AL(ASCII Line)". PDP-10 Reference Handbook: Communicating with the Monitor - Time-Sharing Monitors (PDF). Vol. 3. Digital Equipment Corporation (DEC). 1969. pp. 5-3–5-6 [5-5 (431)]. Archived (PDF) from the original on 2011-11-15. Retrieved 2014-07-10. (207 pages) http://bitsavers.org/pdf/dec/pdp10/1970_PDP-10_Ref/1970PDP10Ref_Part3.pdf
"2. Operating System Call Conventions". CP/M 2.0 Interface Guide (PDF) (1 ed.). Pacific Grove, California, USA: Digital Research. 1979. p. 5. Archived (PDF) from the original on 2020-02-28. Retrieved 2020-02-28. […] The end of an ASCII file is denoted by a control-Z character (1AH) or a real end of file, returned by the CP/M read operation. Control-Z characters embedded within machine code files (e.g., COM files) are ignored, however, and the end of file condition returned by CP/M is used to terminate read operations. […] (56 pages) http://bitsavers.org/pdf/digitalResearch/cpm/2.0/CPM_2_0_Interface_Guide_1979.pdf
Hogan, Thom (1982). "3. CP/M Transient Commands". Osborne CP/M User Guide - For All CP/M Users (2 ed.). Berkeley, California, USA: A. Osborne/McGraw-Hill. p. 74. ISBN 0-931988-82-9. Retrieved 2020-02-28. […] CP/M marks the end of an ASCII file by placing a CONTROL-Z character in the file after the last data character. If the file contains an exact multiple of 128 characters, in which case adding the CONTROL-Z would waste 127 characters, CP/M does not do so. Use of the CONTROL-Z character as the end-of-file marker is possible because CONTROL-Z is seldom used as data in ASCII files. In a non-ASCII file, however, CONTROL-Z is just as likely to occur as any other character. Therefore, it cannot be used as the end-of-file marker. CP/M uses a different method to mark the end of a non-ASCII file. CP/M assumes it has reached the end of the file when it has read the last record (basic unit of disk space) allocated to the file. The disk directory entry for each file contains a list of the disk records allocated to that file. This method relies on the size of the file, rather than its content, to locate the end of the file. […] [17][18] 0-931988-82-9
BC_Programmer (2010-01-31) [2010-01-30]. "Re: Copy command which merges several files tags the word SUB at the end". Computer Hope Forum. Archived from the original on 2020-02-26. Retrieved 2020-02-26. https://www.computerhope.com/forum/index.php?topic=99159.0
"What are the differences between Linux and Windows .txt files (Unicode encoding)". Superuser. 2011-08-03 [2011-06-08]. Archived from the original on 2020-02-26. Retrieved 2020-02-26. https://superuser.com/questions/294219/what-are-the-differences-between-linux-and-windows-txt-files-unicode-encoding
Gordon, Ryan C. (October 2009). "FatELF: Universal Binaries for Linux". icculus.org. Archived from the original on 2020-08-27. Retrieved 2010-07-13. /wiki/Ryan_C._Gordon
Gordon, Ryan C. (November 2009). "FatELF specification, version 1". icculus.org. Archived from the original on 2020-08-27. Retrieved 2010-07-25. /wiki/Ryan_C._Gordon
Gordon, Ryan C. (October 2009). "FatELF: Universal Binaries for Linux". icculus.org. Archived from the original on 2020-08-27. Retrieved 2010-07-13. /wiki/Ryan_C._Gordon
Windisch, Eric (2009-11-03). "Subject: Newsgroups: gmane.linux.kernel, Re: FatELF patches..." gmane.org. Archived from the original on 2016-11-15. Retrieved 2010-07-08. https://web.archive.org/web/20161115002617/http://article.gmane.org/gmane.linux.kernel/908851
Gordon, Ryan C. (2009). "FatELF: Universal Binaries for Linux. - The proof-of-concept virtual machine download page". icculus.org. Archived from the original on 2022-05-21. Retrieved 2022-05-26. (NB. VM image of Ubuntu 9.04 with Fat Binary support.) /wiki/Ryan_C._Gordon
Holwerda, Thom (2009-11-05). "Ryan Gordon Halts FatELF Project". Linux. osnews.com. Archived from the original on 2022-05-26. Retrieved 2010-07-05. /wiki/Thom_Holwerda
Brockmeier, Joe "Zonker" (2010-06-23). "SELF: Anatomy of an (alleged) failure". LWN.net. Linux Weekly News. Archived from the original on 2022-05-26. Retrieved 2011-02-06. https://lwn.net/Articles/392862/
Mulder, Sijmen J. (2021-03-06) [2018-04-25]. "sjmulder/fatpack - Build multi-architecture 'fat' binaries for Windows". GitHub. Archived from the original on 2022-05-26. Retrieved 2022-05-26. https://github.com/sjmulder/fatpack
"Arm64X PE files". learn.microsoft.com. Microsoft. 2022-08-13. Archived from the original on 2023-08-20. Retrieved 2023-03-31. https://learn.microsoft.com/en-us/windows/arm/arm64x-pe
"Build Arm64X binaries". learn.microsoft.com. Microsoft. 2023-03-10. Archived from the original on 2023-08-20. Retrieved 2023-03-31. https://learn.microsoft.com/en-us/windows/arm/arm64x-build
Wang, Perry H.; Collins, Jamison D.; Chinya, Gautham N.; Jiang, Hong; Tian, Xinmin; Girkar, Milind; Yang, Nick Y.; Lueh, Guei-Yuan; Wang, Hong (June 2007). "EXOCHI: architecture and programming environment for a heterogeneous multi-core multithreaded system". ACM SIGPLAN Notices. 42 (6): 156–166. doi:10.1145/1273442.1250753. (11 pages) https://doi.org/10.1145/1273442.1250753
Wang, Perry H.; Collins, Jamison D.; Chinya, Gautham N.; Jiang, Hong; Tian, Xinmin; Girkar, Milind; Pearce, Lisa; Lueh, Guei-Yuan; Yakoushkin, Sergey; Wang, Hong (2007-08-22). "Accelerator Exoskeleton" (PDF). Intel Technology Journal. 11: Tera-scale Computing (3). Intel Corporation: 185–196. doi:10.1535/itj.1103. ISSN 1535-864X. Archived (PDF) from the original on 2022-05-26. Retrieved 2022-05-26. (12 of 1+vii+90+1 pages) https://www.intel.com/content/dam/www/public/us/en/documents/research/2007-vol11-iss-3-intel-technology-journal.pdf
"cudaFatFormat.h / ptxomp.c". 1.13. Nvidia Corporation. 2004-11-15. Archived from the original on 2022-05-26. Retrieved 2022-05-26. https://pixel.ecn.purdue.edu:8443/purpl/WSJ/projects/DirectionalStippling/include/.svn/text-base/__cudaFatFormat.h.svn-base
Harris, Mark J. (2014-05-08) [2013-06-05]. "Technical Walkthrough: CUDA Pro Tip: Understand Fat Binaries and JIT Caching". Nvidia Developer. Nvidia. Archived from the original on 2022-03-23. Retrieved 2022-05-26. /w/index.php?title=Mark_Harris_(programmer)&action=edit&redlink=1
"CUDA Binary Utilities" (PDF) (Application Note). 6.0. Nvidia. February 2014. DA-06762-001_v6.0. Archived (PDF) from the original on 2022-05-25. Retrieved 2022-05-25. http://194.29.175.19/cuda/6.0/doc/pdf/CUDA_Binary_Utilities.pdf
"fatbinary - help". helpmanual.io. 8.0. 2016. Archived from the original on 2022-05-25. Retrieved 2022-05-25. https://helpmanual.io/help/fatbinary/
"CUDA Compiler Driver NVCC - Reference Guide" (PDF). 11.7. Nvidia. May 2022. TRM-06721-001_v11.7. Archived (PDF) from the original on 2022-05-25. Retrieved 2022-05-25. https://docs.nvidia.com/cuda/pdf/CUDA_Compiler_Driver_NVCC.pdf
Braun, Lorenz; Fröning, Holger (2019-11-18). CUDA Flux: A Lightweight Instruction Profiler for CUDA Applications (PDF). IEEE/ACM Performance Modeling, Benchmarking and Simulation of High Performance Computer Systems (PMBS). Denver, Colorado, USA: IEEE. doi:10.1109/PMBS49563.2019.00014. ISBN 978-1-7281-5977-5. Archived (PDF) from the original on 2022-03-21. Retrieved 2022-05-26. 978-1-7281-5977-5
Fung, Wilson W. L.; Sham, Ivan; Yuan, George; Aamodt, Tor M. (2007). "Dynamic Warp Formation and Scheduling for Efficient GPU Control Flow" (PDF). Vancouver, British Columbia, Canada. Archived (PDF) from the original on 2022-05-26. Retrieved 2022-05-26. (12 pages) https://people.ece.ubc.ca/aamodt/papers/wwlfung.micro2007.pdf
Bakhoda, Ali; Yuan, George L.; Fung, Wilson W. L.; Wong, Henry; Aamodt, Tor M. (2009-04-28) [2009-04-26]. Analyzing CUDA Workloads Using a Detailed GPU Simulator (PDF). Proceedings of the IEEE International Symposium on Performance Analysis of Systems and Software (ISPASS). Boston, Massachusetts, USA. pp. 163–174. doi:10.1109/ISPASS.2009.4919648. Archived (PDF) from the original on 2022-05-26. Retrieved 2022-05-06. [19] https://people.ece.ubc.ca/aamodt/papers/gpgpusim.ispass09.pdf
"13.4 The AMD Compiler Wrapper: Fat binaries". The Multi2Sim Simulation Framework - A CPU-GPU Model for Heterogeneous Computing (PDF). v4.2. Multi2Sim. 2013. pp. 173–176 [176]. Archived (PDF) from the original on 2022-05-25. Retrieved 2022-05-25. (4 of 210 pages) http://www.multi2sim.org/downloads/m2s-guide-4.2.pdf
Ubal, Rafael; Jang, Byunghyun; Mistry, Perhaad; Schaa, Dana; Kaeli, David R. (2012-09-23) [2012-09-19]. "Multi2Sim: A Simulation Framework for CPU-GPU Computing" (PDF). 21st International Conference on Parallel Architectures and Compilation Techniques (PACT). Minneapolis, Minnesota, USA: IEEE. ISBN 978-1-4503-1182-3. Archived (PDF) from the original on 2022-05-25. Retrieved 2022-05-25. (10 pages) 978-1-4503-1182-3
"13.4 The AMD Compiler Wrapper: Fat binaries". The Multi2Sim Simulation Framework - A CPU-GPU Model for Heterogeneous Computing (PDF). v4.2. Multi2Sim. 2013. pp. 173–176 [176]. Archived (PDF) from the original on 2022-05-25. Retrieved 2022-05-25. (4 of 210 pages) http://www.multi2sim.org/downloads/m2s-guide-4.2.pdf
"LTO Overview (GNU Compiler Collection (GCC) Internals)". gcc.gnu.org. Archived from the original on 2021-09-12. Retrieved 2021-09-12. https://gcc.gnu.org/onlinedocs/gccint/LTO-Overview.html
Wennborg, Hans (2018). "Attributes in Clang". Clang 7 documentation. Archived from the original on 2022-04-07. Retrieved 2022-05-26. https://releases.llvm.org/7.0.0/tools/clang/docs/AttributeReference.html#target-gnu-target
Bahena, Victor Rodriguez (2018-04-03). "Transparent use of library packages optimized for Intel architecture". Power and Performance. Clear Linux Project. Intel Corporation. Archived from the original on 2022-05-26. Retrieved 2022-05-26. https://clearlinux.org/news-blogs/transparent-use-library-packages-optimized-intel-architecture
Paul, Matthias R.; Frinke, Axel C. (1997-10-13) [1991], FreeKEYB - Enhanced DOS keyboard and console driver (User Manual) (v6.5 ed.) [20] (NB. FreeKEYB is a Unicode-based dynamically configurable successor of K3PLUS supporting most keyboard layouts, code pages, and country codes. Utilizing an off-the-shelf macro assembler as well as a framework of automatic pre- and post-processing analysis tools to generate dependency and code morphing meta data to be embedded into the executable file alongside the binary code and a self-discarding, relaxing and relocating loader, the driver implements byte-level granular dynamic dead code elimination and relocation techniques at load-time as well as self-modifying code and reconfigurability at run-time to minimize its memory footprint downto close the canonical form depending on the underlying hardware, operating system, and driver configuration as well as the selected feature set and locale (about sixty configuration switches with hundreds of options for an almost unlimited number of possible combinations). This complexity and the dynamics are hidden from users, who deal with a single executable file just like they would do with a conventional driver.) https://web.archive.org/web/20190309194320/http://sta.c64.org/dosprg/fk657p1.zip
Paul, Matthias R. (2002-04-06). "[fd-dev] Ctrl+Alt+Del". freedos-dev. Archived from the original on 2019-04-27. Retrieved 2019-04-27. […] FreeKEYB builds the driver's runtime image at initialization time depending on the type of machine it is being loaded on, the type of keyboard, layout, country and code page used, the type of mouse and video adapter(s) installed, the other drivers loaded on that system, the operating system and the load and relocation method(s) used, the individual features included, and the configuration options specified in the command line. Due to the large number of command line switches and options supported […] (around fifty switches […] with multiple possible settings) there is a high number of feature combinations with uncountable dependencies […] resulting in […] endless number of […] different target images. FreeKEYB's Dynamic Dead Code Elimination technique manages to resolve […] these […] dependencies and […] remove dead code and data […] is not restricted to […] include or exclude a somewhat limited number of modules or whole sub-routines and fix up some dispatch tables as in classical TSR programming, but […] works […] at […] byte level […] able to remove […] individual instructions in the middle of larger routines […] distributed all over the code to handle a particular case or support a specific feature […] special tools are used to analyze the code […] and create […] fixup tables […] automated […] using conditional defines […] to declare the various cases […] not only optional at assembly time but at initialization time […] without the […] overhead of having at least some amount of dead code left in the runtime image […] to keep track of all the dependencies between […] these conditionals, dynamically build and relocate the runtime image, fix up all the references between these small, changing, and moving binary parts […] still allowing to use the tiny .COM/.SYS style […] model […] is done at initialization time […] https://marc.info/?l=freedos-dev&m=101807225917568&w=2
Paul, Matthias R. (2001-08-21). "[fd-dev] Changing codepages in FreeDOS". freedos-dev. Archived from the original on 2019-04-19. Retrieved 2019-04-20. […] a […] unique feature […] we call dynamic dead code elimination, so you can at installation time […] specify which components of the driver you want and which you don't. This goes to an extent of dynamic loadable modularization and late linkage I have not seen under DOS so far. If you do not like the screen saver, macros, the calculator, or mouse support, or , you can specify this at the command line, and FreeKEYB, while taking all the dependencies between the routines into account, will completely remove all the code fragments, which deal with that feature and are not necessary to provide the requested functionality, before the driver relocates the image into the target location and makes itself resident. […] https://marc.info/?l=freedos-dev&m=99840256128898&w=2
Paul, Matthias R. (2001-04-10). "[ANN] FreeDOS beta 6 released" (in German). Newsgroup: de.comp.os.msdos. Archived from the original on 2017-09-09. Retrieved 2017-07-02. […] brandneue[s] Feature, der dynamischen Dead-Code-Elimination, die die jeweils notwendigen Bestandteile des Treibers erst zum Installationszeitpunkt zusammenbastelt und reloziert, so daß keine ungenutzten Code- oder Datenbereiche mehr resident bleiben (z.B. wenn jemand ein bestimmtes FreeKEYB-Feature nicht benötigt). […] https://groups.google.com/d/msg/de.comp.os.msdos/qCZs8p6MyPQ/Pksl0Pv6qM8J