diff --git a/Asuro.iso b/Asuro.iso index 3f2d51a6..5725f340 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/Compile.bat b/Compile.bat deleted file mode 100644 index 9530db2b..00000000 --- a/Compile.bat +++ /dev/null @@ -1,52 +0,0 @@ -@echo off -set /a ERRCOUNT=0 -echo ======================= -echo == ASURO COMPILATION == -echo ======================= -echo. -echo Compiling ASM Stub... -echo. -nasm -f elf src\stub.asm -o lib\stub.o -if %ERRORLEVEL% GEQ 1 ( - echo Failed to compile stub! - set /a ERRCOUNT=%ERRCOUNT%+1 -) ELSE ( - echo Success. -) -echo. -echo ======================= -echo. -echo Compiling FPC Sources... -echo. -fpc -Aelf -n -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -Rintel -Tlinux -FElib\ src\kernel.pas -if %ERRORLEVEL% GEQ 1 ( - echo Failed to compile FPC Sources! - set /a ERRCOUNT=%ERRCOUNT%+1 -) ELSE ( - echo Success. -) -echo. -echo ======================= -echo. -echo Linking... -echo. -ld -A elf32-i386 --gc-sections -s -Tlinker.script -o bin\kernel.obj lib\stub.o lib\kernel.o lib\multiboot.o lib\system.o lib\console.o -if %ERRORLEVEL% GEQ 1 ( - echo Failed linking! - set /a ERRCOUNT=%ERRCOUNT%+1 -) ELSE ( - echo Success. -) -echo. -echo ======================= -echo. -if %ERRCOUNT% GEQ 1 ( - echo %ERRCOUNT% Errors Occurred, please review. -) ELSE ( - echo No errors. -) -echo. -echo ======================= -echo. -echo Press any key to exit... -pause > nul \ No newline at end of file diff --git a/bin/kernel.obj b/bin/kernel.obj deleted file mode 100644 index 25ce963a..00000000 Binary files a/bin/kernel.obj and /dev/null differ diff --git a/compile.sh b/compile.sh index ae8c60a6..4b7e5ab4 100755 --- a/compile.sh +++ b/compile.sh @@ -7,7 +7,7 @@ echo "=======================" echo " " echo "Compiling ASM Stub..." echo " " -nasm -f elf src/stub.asm -o lib/stub.o +nasm -f elf src/stub/stub.asm -o lib/stub.o if [ $? -ne 0 ] then echo "Failed to compile stub!" @@ -21,7 +21,7 @@ echo "=======================" echo " " echo "Compiling FPC Sources..." echo " " -fpc -Aelf -n -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -Rintel -Tlinux -FElib/ src/kernel.pas +fpc -Aelf -n -va -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -Rintel -Tlinux -FElib/ src/kernel.pas if [ $? -ne 0 ] then echo "Failed to compile FPC Sources!" @@ -35,7 +35,13 @@ echo "=======================" echo " " echo "Linking..." echo " " -ld -m elf_i386 -s --gc-sections -Tlinker.script -o bin/kernel.bin lib/stub.o lib/kernel.o lib/multiboot.o lib/system.o lib/console.o +objstring=""; +for object in `find lib/ -name "*.o"`; do + objstring=$objstring$object" "; +done; +echo "Object Files: "$objstring +echo " " +ld -m elf_i386 -s --gc-sections -Tlinker.script -o bin/kernel.bin $objstring if [ $? -ne 0 ] then echo "Failed linking!" diff --git a/compile.sh~ b/compile.sh~ deleted file mode 100755 index 79518c4c..00000000 --- a/compile.sh~ +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh -ERRCOUNT=0 -echo "=======================" -echo "== ASURO COMPILATION ==" -echo "=======================" -echo " " -echo "Compiling ASM Stub..." -echo " " -nasm -f elf src/stub.asm -o lib/stub.o -if [ $? -ne 0 ] -then - echo "Failed to compile stub!" - ERRCOUNT=$((ERRCOUNT+1)) -else - echo "Success." -fi - -echo " " -echo "=======================" -echo " " -echo "Compiling FPC Sources..." -echo " " -fpc -Aelf -n -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -Rintel -Tlinux -FElib/ src/kernel.pas -if [ $? -ne 0 ] -then - echo "Failed to compile FPC Sources!" - ERRCOUNT=$((ERRCOUNT+1)) -else - echo "Success." -fi - -echo " " -echo "=======================" -echo " " -echo "Linking..." -echo " " -ld -m elf_i386 -s --gc-sections -Tlinker.script -o bin/kernel.bin lib/stub.o lib/kernel.o lib/multiboot.o lib/system.o lib/console.o -if [ $? -ne 0 ] -then - echo "Failed linking!" - ERRCOUNT=$((ERRCOUNT+1)) -else - echo "Success." -fi - -echo " " -echo "=======================" -echo " " -echo "Creating ISO..." -echo " " -cp bin/kernel.bin iso/boot/asuro.bin -grub-mkrescue -o Asuro.iso iso -if [ $? -ne 0 ] -then - echo "Failed to create ISO!" - ERRCOUNT=$((ERRCOUNT+1)) -else - echo "Success." -fi - -echo " " -echo "=======================" -echo " " -if [ "$ERRCOUNT" -ne "0" ] -then - echo "$ERRCOUNT Errors Occurred, please review." -else - echo "No errors." -fi -echo " " -echo "=======================" -echo " " diff --git a/compile_and_run.sh~ b/compile_and_run.sh~ deleted file mode 100755 index c2c23705..00000000 --- a/compile_and_run.sh~ +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -ERRCOUNT=0 -echo "=======================" -echo "== ASURO ==" -echo "=======================" -./compile -./run diff --git a/iso/boot/asuro.bin b/iso/boot/asuro.bin index 21422323..6fef80cb 100755 Binary files a/iso/boot/asuro.bin and b/iso/boot/asuro.bin differ diff --git a/lib/console.o b/lib/console.o index 696fc280..9b008b57 100644 Binary files a/lib/console.o and b/lib/console.o differ diff --git a/lib/console.ppu b/lib/console.ppu index 3a57db83..ac9d4465 100644 Binary files a/lib/console.ppu and b/lib/console.ppu differ diff --git a/lib/kernel.o b/lib/kernel.o index df1b4921..e99c613d 100644 Binary files a/lib/kernel.o and b/lib/kernel.o differ diff --git a/lib/kernel.ppu b/lib/kernel.ppu index b78059b6..20a974c0 100644 Binary files a/lib/kernel.ppu and b/lib/kernel.ppu differ diff --git a/lib/libpconsole.a b/lib/libpconsole.a index bf2d5d7b..25e4ce2d 100644 Binary files a/lib/libpconsole.a and b/lib/libpconsole.a differ diff --git a/lib/libpkernel.a b/lib/libpkernel.a index 0fb48ced..d0b5227a 100644 Binary files a/lib/libpkernel.a and b/lib/libpkernel.a differ diff --git a/lib/libpmultiboot.a b/lib/libpmultiboot.a index f2cf7f15..22edd913 100644 Binary files a/lib/libpmultiboot.a and b/lib/libpmultiboot.a differ diff --git a/lib/libpsystem.a b/lib/libpsystem.a index f6f9a67d..aca90cb6 100644 Binary files a/lib/libpsystem.a and b/lib/libpsystem.a differ diff --git a/lib/multiboot.ppu b/lib/multiboot.ppu index 295c68fd..920604b8 100644 Binary files a/lib/multiboot.ppu and b/lib/multiboot.ppu differ diff --git a/lib/stub.o b/lib/stub.o index e012b2b5..d0c5e39e 100644 Binary files a/lib/stub.o and b/lib/stub.o differ diff --git a/lib/system.ppu b/lib/system.ppu index 9abd8d91..94b122af 100644 Binary files a/lib/system.ppu and b/lib/system.ppu differ diff --git a/src/console.pas b/src/console.pas index 184ec35c..ce86c43a 100644 --- a/src/console.pas +++ b/src/console.pas @@ -12,13 +12,14 @@ } unit console; - + interface - + var xpos: Integer = 0; ypos: Integer = 0; - + +procedure ktest(); procedure kclearscreen(); procedure kwritechr(c: Char); procedure kwritestr(s: PChar); @@ -26,10 +27,36 @@ procedure kwriteint(i: Integer); procedure kwritedword(i: DWORD); implementation - + +type + TCharacter = bitpacked record + Character : Char; + Attributes : Char; + end; + PCharacter = ^TCharacter; + + TVideoMemory = Array[0..1999] of TCharacter; + PVideoMemory = ^TVideoMemory; + + T2DVideoMemory = Array[0..24] of Array[0..79] of TCharacter; + P2DVideoMemory = ^T2DVideoMemory; + + var - vidmem: PChar = PChar($b8000); - + vidmem : PChar = PChar($b8000); + memory : PVideoMemory = PVideoMemory($b8000); + mem2d : P2DVideoMemory = P2DVideoMemory($b8000); + +procedure ktest(); [public, alias: 'ktest']; +begin + memory^[0].Attributes:= #7; + memory^[0].Character:= 'T'; + mem2d^[1][0].Attributes:=#7; + mem2d^[1][0].Character:='E'; + while true do begin + end; +end; + procedure kclearscreen(); [public, alias: 'kclearscreen']; var i: Integer; @@ -144,4 +171,4 @@ begin kwritestr(@Buffer[0]); end; -end. \ No newline at end of file +end. diff --git a/src/kernel.pas b/src/kernel.pas index eb43e43d..492cc6ba 100644 --- a/src/kernel.pas +++ b/src/kernel.pas @@ -26,6 +26,7 @@ implementation procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall; [public, alias: 'kmain']; begin kclearscreen(); + ktest(); kwritestr('FUCK YOU!'); kwritestr('Freepascal barebone OS booted!'); xpos := 0; diff --git a/src/stub.asm b/src/stub.asm deleted file mode 100644 index b361513e..00000000 --- a/src/stub.asm +++ /dev/null @@ -1,79 +0,0 @@ -;///////////////////////////////////////////////////////// -;// // -;// Freepascal barebone OS // -;// stub.asm // -;// // -;///////////////////////////////////////////////////////// -;// -;// By: De Deyn Kim -;// License: Public domain -;// - -; -; Kernel stub -; - -; -; We are in 32bits protected mode -; -[bits 32] - -; -; Export entrypoint -; -[global kstart] - -; -; Import kernel entrypoint -; -[extern kmain] - -; -; Posible multiboot header flags -; -MULTIBOOT_MODULE_ALIGN equ 1<<0 -MULTIBOOT_MEMORY_MAP equ 1<<1 -MULTIBOOT_GRAPHICS_FIELDS equ 1<<2 -MULTIBOOT_ADDRESS_FIELDS equ 1<<16 - -; -; Multiboot header defines -; -MULTIBOOT_HEADER_MAGIC equ 0x1BADB002 -MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_MODULE_ALIGN | MULTIBOOT_MEMORY_MAP -MULTIBOOT_HEADER_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) - -; -; Kernel stack size -; -KERNEL_STACKSIZE equ 0x4000 - -section .text - -; -; Multiboot header -; -align 4 -dd MULTIBOOT_HEADER_MAGIC -dd MULTIBOOT_HEADER_FLAGS -dd MULTIBOOT_HEADER_CHECKSUM - -; -; Entrypoint -; -kstart: - mov esp, KERNEL_STACK+KERNEL_STACKSIZE ;Create kernel stack - push eax ;Multiboot magic number - push ebx ;Multiboot info - call kmain ;Call kernel entrypoint - cli ;Clear interrupts - hlt ;Halt machine - -section .bss - -; -; Kernel stack location -; -align 32 -KERNEL_STACK: - resb KERNEL_STACKSIZE \ No newline at end of file