Hi,
I'm creating a compiler and I've successfully gotten it to create a .com file using nasm. I've also gotten it to create an .exe file but the output of the produced executable is gibberish, so I guess it's reading the wrong part of memory? I'm getting no errors from nasm or alink at the moment.
Test.asm:
global main
segment stack stack
st resb 100
[section .text]
main:
mov ax, stack
mov ss, ax
mov sp, 100
mov esi, CD0
call putstr
mov esi, CD1
call putstr
mov ax, 0x4c00
int 0x21
putc:
mov ah, 0x0e
int 0x10
ret
putstr:
lodsb
cmp al, 0x00
je .end
call putc
jmp putstr
.end
ret
CD0 DB "test", 0
CD1 DB 13, 10, 0
and the commands I'm executing for this code are:
nasm -fobj %1 -o test.obj ; %1 being the name of the file.
alink -oEXE -entry main test.obj -o test.exe
If anyone could help me out with this problem, I'd be really grateful,
Dominick