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