Moved types to system.pas

Added first ISR (ISR0).

git-svn-id: https://spexeah.com:8443/svn/Asuro@37 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron
2017-05-17 11:19:16 +00:00
parent cbd4685407
commit 220d6d8071
31 changed files with 96 additions and 68 deletions

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/idt.ppu Normal file

Binary file not shown.

BIN
lib/isr.ppu Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

12
src/.vscode/launch.json vendored Normal file

@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "gdb",
"request": "launch",
"target": "./bin/executable",
"cwd": "${workspaceRoot}"
}
]
}

@ -2,9 +2,6 @@ unit bios_data_area;
interface
uses
types;
type
TBDA = bitpacked record
COM1 : uint16;

@ -2,9 +2,6 @@ unit gdt;
interface
uses
types;
type
TGDT_Entry = bitpacked record
limit_low : uint16;

@ -3,7 +3,6 @@ unit idt;
interface
uses
types,
util;
type
@ -27,6 +26,7 @@ var
IDT_Pointer : TIDT_Pointer;
procedure init();
procedure set_gate(Number : uint8; Base : uint32; Selector : uint16; Flags : uint8);
implementation

31
src/isr.pas Normal file

@ -0,0 +1,31 @@
unit isr;
interface
uses
idt,
console,
util;
procedure init();
implementation
procedure CLI(); assembler; nostackframe;
asm
CLI
end;
procedure isr0(); interrupt;
begin
CLI;
console.writestringln('Divide by Zero Exception.');
util.halt_and_catch_fire;
end;
procedure init();
begin
idt.set_gate(0, uint32(@isr0), $08, $8E);
end;
end.

@ -3,11 +3,11 @@ unit kernel;
interface
uses
types,
multiboot,
util,
gdt,
idt,
isr,
console,
bios_data_area,
keyboard;
@ -21,6 +21,7 @@ var
c : uint8;
mbi : Pmultiboot_info_t;
mbm : uint32;
z : uint32;
dds : uint32;
begin
@ -28,6 +29,7 @@ begin
mbm:= mbmagic;
gdt.init();
idt.init();
isr.init();
console.init();
console.writestringln('Booting Asuro...');
if (mbm <> MULTIBOOT_BOOTLOADER_MAGIC) then begin
@ -41,6 +43,7 @@ begin
asm
MOV dds, CS
end;
z:=0;
console.setdefaultattribute(console.combinecolors(Red, Black));
if dds = $08 then console.setdefaultattribute(console.combinecolors(Green, Black));
console.writehexln(dds);
@ -58,6 +61,8 @@ begin
console.writeint(((mbinfo^.mem_upper + 1000) div 1024) +1);
console.writestringln('MB');
console.setdefaultattribute(console.combinecolors(lYellow, Black));
mbm := mbm div z;
util.halt_and_catch_fire;
{while true do begin
c:= keyboard.get_scancode;
console.writehexln(c);

@ -5,7 +5,6 @@ unit keyboard;
interface
uses
types,
util;
function get_scancode() : uint8;

@ -1,9 +1,6 @@
unit multiboot;
interface
uses
types;
const
KERNEL_STACKSIZE = $4000;

@ -1,15 +1,46 @@
unit system;
interface
type
cardinal = 0..$FFFFFFFF;
hresult = cardinal;
dword = cardinal;
integer = longint;
pchar = ^char;
implementation
end.
unit system;
interface
type
//internal types
cardinal = 0..$FFFFFFFF;
hresult = cardinal;
dword = cardinal;
integer = longint;
pchar = ^char;
//Standard Types
uInt8 = BYTE;
uInt16 = WORD;
uInt32 = DWORD;
uInt64 = QWORD;
sInt8 = shortint;
sInt16 = smallint;
sInt32 = integer;
sInt64 = longint;
Float = Single;
//Pointer Types
PuByte = ^Byte;
PuInt8 = PuByte;
PuInt16 = ^uInt16;
PuInt32 = ^uInt32;
PuInt64 = ^uInt64;
PsInt8 = ^sInt8;
PsInt16 = ^sInt16;
PsInt32 = ^sInt32;
PsInt64 = ^sInt64;
PFloat = ^Float;
PDouble = ^Double;
Void = ^uInt32;
implementation
end.

@ -1,38 +0,0 @@
unit types;
interface
type
//Standard Types
uInt8 = BYTE;
uInt16 = WORD;
uInt32 = DWORD;
uInt64 = QWORD;
sInt8 = shortint;
sInt16 = smallint;
sInt32 = integer;
sInt64 = longint;
Float = Single;
//Pointer Types
PuByte = ^Byte;
PuInt8 = PuByte;
PuInt16 = ^uInt16;
PuInt32 = ^uInt32;
PuInt64 = ^uInt64;
PsInt8 = ^sInt8;
PsInt16 = ^sInt16;
PsInt32 = ^sInt32;
PsInt64 = ^sInt64;
PFloat = ^Float;
PDouble = ^Double;
Void = ^uInt32;
implementation
end.

@ -4,9 +4,6 @@ unit util;
interface
uses
types;
function hi(b : uint8) : uint8;
function lo(b : uint8) : uint8;
function switchendian(b : uint8) : uint8;