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