it display's 'This is sector 2!' on the screen but it some how doesn't call the c function sound?
It just seems to skip it and go directly to the endless loop jmp condition at the end?
Code: Select all
global main
BITS 16
jmp main
hello db 'This is sector 2!',13d,10d,'$' ;Put any data here!
main:
mov ax , 0
mov ds , ax
mov es , ax
mov ax , 0x6000
mov ss , ax
mov ax , 0x4000
mov sp , ax
mov ax , 600h ; clear screen scroll up function
mov bh , 7h ; white on black background
mov ch , 0h ;upper line (top)
mov cl , 0h ;left col (far left)
mov dh , 18h ;bottom
mov dl , 4Fh ;far right
int 10h ;do the clearing
; display the string This is sector 2 on the screen
mov ah , 13h
mov al , 01h
mov bh , 0h
mov bl , 0Fh
mov dh , 5h
mov dl , 3h
mov cx , hello
mov bp , cx
mov cx , 16d
int 10h
extern _sound
call _sound [color=#FF0000] ; this is what is not working ????[/color]
endsss:
jmp endsss
Code: Select all
.....
void sound()
{
puts( "Welcome to the kernel sound !" ) ;
int i = 1 ;
while( i == 1 )
{
beep() ;
}
}
....
I don't think the computer is triple faulting I don't see it reseting or anything
When I get rid of the sound function call and put some other int 13 display code their it displays that perfectly as well.... so it must be the c funtion call that is screwed up.
The only thing I can think of is bits 16 to probably c functions bits 32 duno?
And I placed the ss amd sp at 0x6000 and 0x4000
Any help would be great since I don't know how to debug this one.
this is what I compile and linked it as so their is nostdinc , fno-builtin ,....etc
Code: Select all
C:\KERNEL~1>gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -c sound.c -I..\djgpp\include
C:\KERNEL~1>ld -T link.ld load2.o sound.o -o kernel.bin
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(main)
phys = 0x00008000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
load2.o (.text);
sound.o (.text);
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
is sp , ss to (stack stuff maybe the bss is not correctly put where the sp , ss is is that it)
bits 16 or 32 if I use 32 then then my boot program doesn't jump to the above file correctly and the code is not executed.
Or maybe align is not correctly set ?
Those are the 3 things I don't fully get yet.
Thanks for any help