binexe.asm 785 B

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