objexe.asm 529 B

12345678910111213141516171819202122232425262728293031
  1. ; Demonstration of how to write an entire .EXE format program as a .OBJ
  2. ; file to be linked. Tested with the VAL free linker.
  3. ; To build:
  4. ; nasm -fobj objexe.asm
  5. ; val objexe.obj,objexe.exe;
  6. ; To test:
  7. ; objexe
  8. ; (should print `hello, world')
  9. segment code
  10. ..start: mov ax,data
  11. mov ds,ax
  12. mov ax,stack
  13. mov ss,ax
  14. mov sp,stacktop
  15. mov dx,hello
  16. mov ah,9
  17. int 0x21
  18. mov ax,0x4c00
  19. int 0x21
  20. segment data
  21. hello: db 'hello, world', 13, 10, '$'
  22. segment stack stack
  23. resb 64
  24. stacktop: