| 1 |
;Testname=unoptimized; Arguments=-O0 -fbin -obinexe.exe -i../misc/; Files=stdout stderr binexe.exe |
| 2 |
;Testname=optimized; Arguments=-Ox -fbin -obinexe.exe -i../misc/; Files=stdout stderr binexe.exe |
| 3 |
|
| 4 |
; Demonstration of how to write an entire .EXE format program by using |
| 5 |
; the `exebin.mac' macro package. |
| 6 |
; To build: |
| 7 |
; nasm -fbin binexe.asm -o binexe.exe -ipath |
| 8 |
; (where `path' is such as to allow the %include directive to find |
| 9 |
; exebin.mac) |
| 10 |
; To test: |
| 11 |
; binexe |
| 12 |
; (should print `hello, world') |
| 13 |
|
| 14 |
%include "exebin.mac" |
| 15 |
|
| 16 |
EXE_begin |
| 17 |
EXE_stack 64 ; demonstrates overriding the 0x800 default |
| 18 |
|
| 19 |
section .text |
| 20 |
|
| 21 |
mov ax,cs |
| 22 |
mov ds,ax |
| 23 |
|
| 24 |
mov dx,hello |
| 25 |
mov ah,9 |
| 26 |
int 0x21 |
| 27 |
|
| 28 |
mov ax,0x4c00 |
| 29 |
int 0x21 |
| 30 |
|
| 31 |
section .data |
| 32 |
|
| 33 |
hello: db 'hello, world', 13, 10, '$' |
| 34 |
|
| 35 |
EXE_end |