Console Fixes & BIOS Interfacing
- Removed some garbage text from startup - Interface to the BDA added. - Console Cursor updates added. git-svn-id: https://spexeah.com:8443/svn/Asuro@13 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
d0ded03fdd
commit
d6460dcf61
BIN
bin/kernel.bin
BIN
bin/kernel.bin
Binary file not shown.
Binary file not shown.
BIN
lib/bda.ppu
Normal file
BIN
lib/bda.ppu
Normal file
Binary file not shown.
BIN
lib/console.o
BIN
lib/console.o
Binary file not shown.
BIN
lib/console.ppu
BIN
lib/console.ppu
Binary file not shown.
BIN
lib/kernel.o
BIN
lib/kernel.o
Binary file not shown.
BIN
lib/kernel.ppu
BIN
lib/kernel.ppu
Binary file not shown.
Binary file not shown.
BIN
lib/system.ppu
BIN
lib/system.ppu
Binary file not shown.
BIN
lib/util.ppu
BIN
lib/util.ppu
Binary file not shown.
30
src/bda.pas
Normal file
30
src/bda.pas
Normal file
@ -0,0 +1,30 @@
|
||||
unit bda;
|
||||
|
||||
interface
|
||||
|
||||
type
|
||||
TBDA = bitpacked record
|
||||
COM1 : WORD;
|
||||
COM2 : WORD;
|
||||
COM3 : WORD;
|
||||
COM4 : WORD;
|
||||
LPT1 : WORD;
|
||||
LPT2 : WORD;
|
||||
LPT3 : WORD;
|
||||
EBDA : WORD;
|
||||
Hardware_Flags : WORD;
|
||||
Keyboard_Flags : WORD;
|
||||
Keyboard_Buffer : ARRAY[0..31] OF BYTE;
|
||||
Display_Mode : BYTE;
|
||||
BaseIO : WORD;
|
||||
Ticks : WORD;
|
||||
HDD_Count : BYTE;
|
||||
Keyboard_Start : WORD;
|
||||
Keyboard_End : WORD;
|
||||
Keyboard_State : Byte;
|
||||
end;
|
||||
PBDA = ^TBDA;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
@ -2,6 +2,9 @@ unit console;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
util, bda;
|
||||
|
||||
type
|
||||
TColor = ( Black = $0,
|
||||
Blue = $1,
|
||||
@ -243,15 +246,18 @@ begin
|
||||
end;
|
||||
|
||||
procedure _console_update_cursor(); [public, alias: '_console_update_cursor'];
|
||||
var
|
||||
pos : word;
|
||||
b : byte;
|
||||
|
||||
begin
|
||||
{asm
|
||||
MOV AH, $02
|
||||
MOV BH, $00
|
||||
MOV DH, Console_Cursor.Y
|
||||
MOV DL, Console_Cursor.X
|
||||
INT $10
|
||||
end; }
|
||||
|
||||
pos:= (Console_Cursor.Y * 80) + Console_Cursor.X;
|
||||
outb($3D4, $0F);
|
||||
b:= pos and $00FF;
|
||||
outb($3D5, b);
|
||||
outb($3D4, $0E);
|
||||
b:= pos shr 8;
|
||||
outb($3D5, b);
|
||||
end;
|
||||
|
||||
procedure _console_increment_x(); [public, alias: '_console_increment_x'];
|
||||
|
@ -4,14 +4,19 @@ interface
|
||||
|
||||
uses
|
||||
multiboot,
|
||||
console;
|
||||
console,
|
||||
bda;
|
||||
|
||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall;
|
||||
|
||||
implementation
|
||||
|
||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall; [public, alias: 'kmain'];
|
||||
var
|
||||
_bda : PBDA;
|
||||
|
||||
begin
|
||||
_bda:= PBDA($0400);
|
||||
console_init();
|
||||
console_writestringln('Booting Asuro...');
|
||||
if (mbmagic <> MULTIBOOT_BOOTLOADER_MAGIC) then begin
|
||||
@ -23,8 +28,11 @@ begin
|
||||
hlt
|
||||
end;
|
||||
end;
|
||||
console_clear();
|
||||
console_setdefaultattribute(console_combinecolors(Green, Black));
|
||||
console_writestringln('Asuro Booted Correctly!');
|
||||
console_writestringln('');
|
||||
console_setdefaultattribute(console_combinecolors(White, Black));
|
||||
console_writestring('Lower Memory = ');
|
||||
console_writeint(mbinfo^.mem_lower);
|
||||
console_writestringln('KB');
|
||||
@ -34,8 +42,7 @@ begin
|
||||
console_writestring('Total Memory = ');
|
||||
console_writeint(((mbinfo^.mem_upper + 1000) div 1024) +1);
|
||||
console_writestringln('MB');
|
||||
console_setdefaultattribute(console_combinecolors(Red, Black));
|
||||
console_writestringln('Entering Login Queue... You are number #RAN in the Queue.');
|
||||
console_setdefaultattribute(console_combinecolors(lYellow, Black));
|
||||
asm
|
||||
cli
|
||||
hlt
|
||||
|
44
src/util.pas
44
src/util.pas
@ -1,10 +1,15 @@
|
||||
unit util;
|
||||
|
||||
{$ASMMODE intel}
|
||||
|
||||
interface
|
||||
|
||||
function util_hi(b : byte) : byte;
|
||||
function util_lo(b : byte) : byte;
|
||||
function util_switchendian(b : byte) : byte;
|
||||
procedure outb(port : word; val : byte);
|
||||
procedure outw(port : word; val : word);
|
||||
procedure outl(port : word; val : longword);
|
||||
|
||||
implementation
|
||||
|
||||
@ -23,4 +28,43 @@ begin
|
||||
util_switchendian:= (util_lo(b) SHL 4) OR util_hi(b);
|
||||
end;
|
||||
|
||||
procedure outl(port : word; val : longword); [public, alias: 'outl'];
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
MOV DX, port
|
||||
MOV EAX, val
|
||||
OUT DX, EAX
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure outw(port : word; val : word); [public, alias: 'outw'];
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
MOV DX, port
|
||||
MOV AX, val
|
||||
OUT DX, AX
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure outb(port : word; val : byte); [public, alias: 'outb'];
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
MOV DX, port
|
||||
MOV AL, val
|
||||
OUT DX, AL
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
x
Reference in New Issue
Block a user