2 ; NASM macro file to allow the `bin' output format to generate
3 ; simple .EXE files by constructing the EXE header by hand.
4 ; Adapted from a contribution by Yann Guidon <whygee_corp@hol.fr>
6 %define EXE_stack_size EXE_realstacksize
13 db 4Dh,5Ah ; EXE file signature
14 dw EXE_allocsize % 512
15 dw (EXE_allocsize + 511) / 512
16 dw 0 ; relocation information: none
17 dw (header_end-header_start)/16 ; header size in paragraphs
18 dw (EXE_absssize + EXE_realstacksize) / 16 ; min extra mem
19 dw (EXE_absssize + EXE_realstacksize) / 16 ; max extra mem
20 dw -10h ; Initial SS (before fixup)
21 dw EXE_endbss + EXE_realstacksize ; Initial SP (1K DPMI+1K STACK)
23 dw 100h ; Initial IP - start just after the header
24 dw -10h ; Initial CS (before fixup)
25 dw 0 ; file offset to relocation table: none
38 EXE_realstacksize equ %1
39 %define EXE_stack_size EXE_bogusstacksize ; defeat EQU in EXE_end
51 EXE_acodesize equ (EXE_endcode-EXE_startcode+3) & (~3)
52 EXE_datasize equ EXE_enddata-EXE_startdata
53 EXE_absssize equ (EXE_endbss-EXE_startbss+3) & (~3)
54 EXE_allocsize equ EXE_acodesize + EXE_datasize
56 EXE_stack_size equ 0x800 ; default if nothing else was used