| 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 |
|
| 10 |
segment code |
| 11 |
|
| 12 |
..start: mov ax,data |
| 13 |
mov ds,ax |
| 14 |
mov ax,stack |
| 15 |
mov ss,ax |
| 16 |
mov sp,stacktop |
| 17 |
|
| 18 |
mov dx,hello |
| 19 |
mov ah,9 |
| 20 |
int 0x21 |
| 21 |
|
| 22 |
mov ax,0x4c00 |
| 23 |
int 0x21 |
| 24 |
|
| 25 |
segment data |
| 26 |
hello: db 'hello, world', 13, 10, '$' |
| 27 |
|
| 28 |
segment stack stack |
| 29 |
resb 64 |
| 30 |
stacktop: |