Code: Select all
@echo off
echo Cleaning Up...
cd build
del *.o
del *.out
del *.bin
cd ..\source
del *.o
del *.out
del *.bin
cd ..
echo Entering Source...
cd source
echo Compiling Files...
set copt=-ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions
nasm -f aout start.asm -o start.o
nasm -f aout misccode.asm -o misccode.o
nasm -f aout interrupts.asm -o interrupts.o
gxx -c %copt% *.cpp
move *.o ..\build
set copt=
echo Linking Objects
cd ..\build
ld -T kernel.ld -o kernel.bin *.o
echo Copying Kernel!
copy kernel.bin ..\..\Image
cd ..
Originally instead of the wildcards I had each file named out... however the line that executes LD become longer than dos could support and as such linking became impossible. So I am now using wildcards... will this matter if the start procedure isn't at the head of the file? Or should I name the file with the start code 00start.o ?? This way it would technically be the first file?
Problem 2:
I am mixing C and Assembler code and having a nightmare... Inside C, calling an asm function is fine... however in asm calling an existing c function is nothing put troubles... gxx compiles fine and gives no errors... but linking goes crazy saying :
Code: Select all
interrupts.o(.text+0x12): undefined reference to `_int_00'
(1 error for each of my interrupt functions )
panic.o(.text+0xc):panic.cpp: undefined reference to `__Z5int00v'
(1 error for each of my interrupt functions )
Heres a sample from interrupts.asm
Code: Select all
[extern _int_00]
[global _int00]
_int00:
pusha
push ds
push es
push fs
push gs
mov eax,0x10 ; Data segment
mov ds,eax
mov es,eax
cld
call _int_00 ; Divide by Zero #DE
pop gs
pop fs
pop es
pop ds
popa
iret
Code: Select all
void int_00(void)
{
printf("Divide By Zero Error");
}
The CPP Code includess a header file which help refrence all of the assembler code:
Code: Select all
extern void int00(void);
Rich P.
P.S. If anyone had any good examples or TUTs for making makefiles compatible with djgpp please let me know. Thanks again.