Pascal: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
mNo edit summary
No edit summary
Line 78: Line 78:


=== stub.asm ===
=== stub.asm ===
Assemble with:

nasm -f elf stub.asm -o stub.o

<pre>
<pre>
;/////////////////////////////////////////////////////////
;/////////////////////////////////////////////////////////
Line 165: Line 161:


=== kernel.pas ===
=== kernel.pas ===
Compile with:
ppc32 -a -Aas -n -O3 -Op3 -Si -Sc -Sg -Xd -Tlinux -Rintel kernel.pas

or:
fpc -Aelf -n -O3 -Op3 -Si -Sc -Sg -Xd -Rintel -Tlinux kernel.pas

<pre>
<pre>
{
{
Line 509: Line 499:
</pre>
</pre>


=== Linking ===
=== Compiling and Linking the modules ===
Link the whole thing with:
Assemble stub.asm with:
nasm -f elf stub.asm -o stub.o

The Pascal modules with:
fpc -Aelf -n -O3 -Op3 -Si -Sc -Sg -Xd -Rintel -Tlinux kernel.pas

* -Aelf - instructs the internal fpc assembler to output an ELF object.;
* -n - ignores fpc.cfg;
* -O3 - perform level 3 optimizations;
* -Op3 - tune code for PentiumPro / P-II / Cyrix 6x86 / K6 (TM);
* -Si - enable C++ style INLINE keyword;
* -Sc - enable C style operators;
* -Sg - enable support for labels;
* -Xd - tells the compiler to forget the standard library path;
* -Rintel - sets the inline assembly syntax to intel style;
* -Tlinux - specifies that the target operating system is Linux. (Don't even ask!)

ppc32 -a -Aas -n -O3 -Op3 -Si -Sc -Sg -Xd -Tlinux -Rintel kernel.pas

Then link the whole thing with:
ld -Tlinker.script -o kernel.obj stub.o kernel.o multiboot.o system.o console.o
ld -Tlinker.script -o kernel.obj stub.o kernel.o multiboot.o system.o console.o