Why this dosn't work ???
Posted: Sat Aug 25, 2007 7:45 am
Hello, i have a project for developping an operating system, i have create all source files and i compeled them but it dosn't work, why?? please help me .
I use DJGPP compiler and LD linker.
boot.asm:
[BITS 16]
[global start]
[extern _main]
jmp 07c0h:start
msg db "Welcom hateM",0
start:
mov ax, cs
mov ds, ax
mov es, ax
mov ah,02h
mov al,'H'
int 10h
mov ah,02h
mov al,'H'
int 10h
mov ah,02h
mov al,'H'
int 10h
mov ah,02h
mov al,'H'
int 10h
mov si, msg
call printt
xor ax,ax
mov ax,09c0h
mov es,ax
mov bx,0
mov ah,02h
mov al,5
mov ch,0
mov cl,2
mov dh,0
mov dl,0
int 13h
call _main
printt:
lodsb
cmp al,0
je donee
mov ah,0eh
int 10h
jmp printt
donee:
ret
times 510-($-$$) db 0
dw 0xAA55
system.c (kernel):
#include <dos.h>
#define WHITE 0x07;
unsigned int putchh(char x);
int main(void){
int i;
char *str="Je suis Hatem in My OS .";
for(i=0;i<15;i++){
putchh(str);
}
for (;;);
return 0;
}
unsigned int putchh(char x){
union REGS regs;
regs.h.ah=0x2;
regs.h.al=x;
__asm__(
"int $0x10\n"
);
return 1;
}
compile.bat:
nasm -f aout boot.asm -o boot.o
gcc -c system.c -o system.o
ld.exe -Ttext 0x07c0 link.ld -o kernel.bin --oformat binary boot.o system.o
Where is the probleme, why it compiled but don't work?
I use DJGPP compiler and LD linker.
boot.asm:
[BITS 16]
[global start]
[extern _main]
jmp 07c0h:start
msg db "Welcom hateM",0
start:
mov ax, cs
mov ds, ax
mov es, ax
mov ah,02h
mov al,'H'
int 10h
mov ah,02h
mov al,'H'
int 10h
mov ah,02h
mov al,'H'
int 10h
mov ah,02h
mov al,'H'
int 10h
mov si, msg
call printt
xor ax,ax
mov ax,09c0h
mov es,ax
mov bx,0
mov ah,02h
mov al,5
mov ch,0
mov cl,2
mov dh,0
mov dl,0
int 13h
call _main
printt:
lodsb
cmp al,0
je donee
mov ah,0eh
int 10h
jmp printt
donee:
ret
times 510-($-$$) db 0
dw 0xAA55
system.c (kernel):
#include <dos.h>
#define WHITE 0x07;
unsigned int putchh(char x);
int main(void){
int i;
char *str="Je suis Hatem in My OS .";
for(i=0;i<15;i++){
putchh(str);
}
for (;;);
return 0;
}
unsigned int putchh(char x){
union REGS regs;
regs.h.ah=0x2;
regs.h.al=x;
__asm__(
"int $0x10\n"
);
return 1;
}
compile.bat:
nasm -f aout boot.asm -o boot.o
gcc -c system.c -o system.o
ld.exe -Ttext 0x07c0 link.ld -o kernel.bin --oformat binary boot.o system.o
Where is the probleme, why it compiled but don't work?