New Commit.

git-svn-id: https://spexeah.com:8443/svn/Asuro@4 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron
2015-09-18 17:21:37 +00:00
parent ad4301222a
commit e2d1d14da0
21 changed files with 44 additions and 220 deletions

View File

@ -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.
end.

View File

@ -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;

View File

@ -1,79 +0,0 @@
;/////////////////////////////////////////////////////////
;// //
;// Freepascal barebone OS //
;// stub.asm //
;// //
;/////////////////////////////////////////////////////////
;//
;// By: De Deyn Kim <kimdedeyn@skynet.be>
;// 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