diff --git a/Asuro.iso b/Asuro.iso index 4c963284..b25b3ee6 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/bin/kernel.bin b/bin/kernel.bin index 240bd712..4c1678fc 100755 Binary files a/bin/kernel.bin and b/bin/kernel.bin differ diff --git a/iso/boot/asuro.bin b/iso/boot/asuro.bin index 240bd712..4c1678fc 100755 Binary files a/iso/boot/asuro.bin and b/iso/boot/asuro.bin differ diff --git a/lib/bda.ppu b/lib/bda.ppu new file mode 100644 index 00000000..bef3d522 Binary files /dev/null and b/lib/bda.ppu differ diff --git a/lib/console.o b/lib/console.o index ead5d998..37ff6869 100644 Binary files a/lib/console.o and b/lib/console.o differ diff --git a/lib/console.ppu b/lib/console.ppu index 08a27da2..3a17f7a5 100644 Binary files a/lib/console.ppu and b/lib/console.ppu differ diff --git a/lib/kernel.o b/lib/kernel.o index 2d8666db..1facbaa3 100644 Binary files a/lib/kernel.o and b/lib/kernel.o differ diff --git a/lib/kernel.ppu b/lib/kernel.ppu index b3fab2f1..8e3985f5 100644 Binary files a/lib/kernel.ppu and b/lib/kernel.ppu differ diff --git a/lib/multiboot.ppu b/lib/multiboot.ppu index 032ebdde..5927559a 100644 Binary files a/lib/multiboot.ppu and b/lib/multiboot.ppu differ diff --git a/lib/system.ppu b/lib/system.ppu index a773f113..74c0967d 100644 Binary files a/lib/system.ppu and b/lib/system.ppu differ diff --git a/lib/util.ppu b/lib/util.ppu index f01b5578..b20dd8ed 100644 Binary files a/lib/util.ppu and b/lib/util.ppu differ diff --git a/src/bda.pas b/src/bda.pas new file mode 100644 index 00000000..bb406ec9 --- /dev/null +++ b/src/bda.pas @@ -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. diff --git a/src/console.pas b/src/console.pas index 6b734a71..730965e0 100644 --- a/src/console.pas +++ b/src/console.pas @@ -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']; diff --git a/src/kernel.pas b/src/kernel.pas index 93bdac64..5924d188 100644 --- a/src/kernel.pas +++ b/src/kernel.pas @@ -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 diff --git a/src/util.pas b/src/util.pas index efe850d1..298a8a92 100644 --- a/src/util.pas +++ b/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.