3 ; NASM macro file to allow the `bin' output format to generate
5 ; simple .EXE files by constructing the EXE header by hand.
7 ; Adapted from a contribution by Yann Guidon <whygee_corp@hol.fr>
11 %define EXE_stack_size EXE_realstacksize
25 db 4Dh,5Ah ; EXE file signature
27 dw EXE_allocsize % 512
29 dw (EXE_allocsize + 511) / 512
31 dw 0 ; relocation information: none
33 dw (header_end-header_start)/16 ; header size in paragraphs
35 dw (EXE_absssize + EXE_realstacksize) / 16 ; min extra mem
37 dw (EXE_absssize + EXE_realstacksize) / 16 ; max extra mem
39 dw -10h ; Initial SS (before fixup)
41 dw EXE_endbss + EXE_realstacksize ; Initial SP (1K DPMI+1K STACK)
45 dw 100h ; Initial IP - start just after the header
47 dw -10h ; Initial CS (before fixup)
49 dw 0 ; file offset to relocation table: none
75 EXE_realstacksize equ %1
77 %define EXE_stack_size EXE_bogusstacksize ; defeat EQU in EXE_end
101 EXE_acodesize equ (EXE_endcode-EXE_startcode+3) & (~3)
103 EXE_datasize equ EXE_enddata-EXE_startdata
105 EXE_absssize equ (EXE_endbss-EXE_startbss+3) & (~3)
107 EXE_allocsize equ EXE_acodesize + EXE_datasize
111 EXE_stack_size equ 0x800 ; default if nothing else was used