diff --git a/Asuro.iso b/Asuro.iso index 589a89ad..0fc9498f 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/bin/kernel.bin b/bin/kernel.bin index aafe79cd..3a0af316 100755 Binary files a/bin/kernel.bin and b/bin/kernel.bin differ diff --git a/compile.sh b/compile.sh index ea303033..15e696ee 100755 --- a/compile.sh +++ b/compile.sh @@ -19,9 +19,18 @@ fi echo " " echo "=======================" echo " " -echo "Compiling FPC Sources..." -echo " " -fpc -Aelf -n -va -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -Rintel -Pi386 -Tlinux -FElib/ src/kernel.pas + +if [ "$1" = "-d" ] +then + echo "Compiling Debug FPC Sources..." + echo " " + fpc -Aelf -gw -n -va -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -Rintel -Pi386 -Tlinux -FElib/ src/kernel.pas +else + echo "Compiling FPC Sources..." + echo " " + fpc -Aelf -gw -n -va -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -Rintel -Pi386 -Tlinux -FElib/ src/kernel.pas +fi + if [ $? -ne 0 ] then echo "Failed to compile FPC Sources!" diff --git a/compile_and_run.sh b/compile_and_run.sh index 05bc209f..85f39b2c 100755 --- a/compile_and_run.sh +++ b/compile_and_run.sh @@ -3,5 +3,10 @@ ERRCOUNT=0 echo "=======================" echo "== ASURO ==" echo "=======================" -./compile.sh +if [ "%1" == "-d"] +then + ./compile.sh -d +else + ./compile.sh +fi ./run.sh diff --git a/compile_and_run_debug.sh b/compile_and_run_debug.sh new file mode 100644 index 00000000..e3fcb79a --- /dev/null +++ b/compile_and_run_debug.sh @@ -0,0 +1,2 @@ +#!/bin/sh +./compile_and_run.sh -d diff --git a/compile_debug.sh b/compile_debug.sh new file mode 100644 index 00000000..50efa9bc --- /dev/null +++ b/compile_debug.sh @@ -0,0 +1,2 @@ +#!/bin/sh +./compile.sh -d diff --git a/iso/boot/asuro.bin b/iso/boot/asuro.bin index aafe79cd..3a0af316 100755 Binary files a/iso/boot/asuro.bin and b/iso/boot/asuro.bin differ diff --git a/lib/gdt.ppu b/lib/gdt.ppu new file mode 100644 index 00000000..77e41a14 Binary files /dev/null and b/lib/gdt.ppu differ diff --git a/lib/kernel.o b/lib/kernel.o index 68e6d160..fed4abe7 100644 Binary files a/lib/kernel.o and b/lib/kernel.o differ diff --git a/lib/kernel.ppu b/lib/kernel.ppu index d2131c51..2e973649 100644 Binary files a/lib/kernel.ppu and b/lib/kernel.ppu differ diff --git a/lib/libpkernel.a b/lib/libpkernel.a index 7912fb2d..78214f12 100644 Binary files a/lib/libpkernel.a and b/lib/libpkernel.a differ diff --git a/lib/types.ppu b/lib/types.ppu new file mode 100644 index 00000000..a279f6b8 Binary files /dev/null and b/lib/types.ppu differ diff --git a/src/gdt.pas b/src/gdt.pas index d9084cc6..35cfdde2 100644 --- a/src/gdt.pas +++ b/src/gdt.pas @@ -4,7 +4,8 @@ interface uses util, - types; + types, + console; procedure create(base : dword; limit : dword; flags : byte); procedure init(); @@ -22,7 +23,7 @@ type implementation var - GDTarr : array [0..5] of TSegmentDescriptor; + GDTarr : array [0..2] of TSegmentDescriptor; GDTptr : PSegmentDescriptor; GDT_length : integer = 0; @@ -38,19 +39,19 @@ begin descriptor_ptr:= @descriptor[0]; s_descriptor_ptr:= @s_descriptor; if limit <= 65536 then begin - descriptor[6] := $40 //1 <-- Will be overwritten by 2. + descriptor[6] := $40; end else begin if (limit and $FFF) <> $FFF then begin limit := (limit SHR 12) - 1; end else begin limit := limit SHR 12; end; - descriptor[6] := $C0; //2 <-- Will be overwritten by 3; + descriptor[6] := $C0; end; descriptor[0] := limit and $FF; descriptor[1] := (limit shr 8) and $FF; - descriptor[6] := descriptor[6] or ((limit shr 16) and $F); //3 <-- has now overwritten both $C0 and $40 is now equal to limit or'd with limit shifted right 16 bits and constant $0F + descriptor[6] := descriptor[6] or ((limit shr 16) and $F); descriptor[2] := base and $FF; descriptor[3] := (base shr 8) and $FF; diff --git a/src/kernel.pas b/src/kernel.pas index 03d6b745..ae2ad09a 100644 --- a/src/kernel.pas +++ b/src/kernel.pas @@ -19,11 +19,12 @@ var c : byte; mbi : Pmultiboot_info_t; mbm : DWORD; + dds : DWORD; begin mbi:= mbinfo; mbm:= mbmagic; - gdt.init(); + //gdt.init(); console.init(); console.writestringln('Booting Asuro...'); if (mbm <> MULTIBOOT_BOOTLOADER_MAGIC) then begin @@ -33,6 +34,11 @@ begin util.halt_and_catch_fire; end; console.clear(); + asm + MOV dds, DS + end; + console.writehexln(dds); + util.halt_and_catch_fire; console.setdefaultattribute(console.combinecolors(Green, Black)); console.writestringln('Asuro Booted Correctly!'); console.writestringln('');