diff --git a/Asuro.iso b/Asuro.iso index 6ff1c824..077a3923 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/bin/kernel.bin b/bin/kernel.bin index 5ac127e5..7eb6ab49 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 5ac127e5..7eb6ab49 100755 Binary files a/iso/boot/asuro.bin and b/iso/boot/asuro.bin differ diff --git a/lib/RTC.ppu b/lib/RTC.ppu new file mode 100644 index 00000000..beb95f5a Binary files /dev/null and b/lib/RTC.ppu differ diff --git a/lib/kernel.ppu b/lib/kernel.ppu index f989a41d..c2f0f176 100644 Binary files a/lib/kernel.ppu and b/lib/kernel.ppu differ diff --git a/lib/libpconsole.a b/lib/libpconsole.a index 417d4a13..cacf436a 100644 Binary files a/lib/libpconsole.a and b/lib/libpconsole.a differ diff --git a/lib/libpmultiboot.a b/lib/libpmultiboot.a index 7d661d6e..8356ded6 100644 Binary files a/lib/libpmultiboot.a and b/lib/libpmultiboot.a differ diff --git a/lib/libpsystem.a b/lib/libpsystem.a index 5525f923..8a6cbf07 100644 Binary files a/lib/libpsystem.a and b/lib/libpsystem.a differ diff --git a/lib/terminal.ppu b/lib/terminal.ppu index cc406b73..721fe605 100644 Binary files a/lib/terminal.ppu and b/lib/terminal.ppu differ diff --git a/src/driver/timers/RTC.pas b/src/driver/timers/RTC.pas new file mode 100644 index 00000000..bfb25987 --- /dev/null +++ b/src/driver/timers/RTC.pas @@ -0,0 +1,108 @@ +unit RTC; + +interface + +uses + console, isrmanager, util; + +type + TDateTime = record + Seconds : uint8; + Minutes : uint8; + Hours : uint8; + Weekday : uint8; + Day : uint8; + Month : uint8; + Year : uint8; + Century : uint8; + end; + +var + DateTime : TDateTime; + +procedure init; + +implementation + +function is_update_in_progress : boolean; +var + bin : uint8; + +begin + outb($70, $0A); + io_wait(); + bin:= inb($71); + is_update_in_progress:= (bin AND ($1 SHL 7)) <> 0; +end; + +procedure update(); +begin + outb($70, $0C); // select register C + io_wait(); + inb($71); + console.writestringln('RTC Update'); + while not is_update_in_progress do begin + end; + while is_update_in_progress do begin + end; + outb($70, $00); + io_wait(); + DateTime.Seconds:= inb($71); + io_wait(); + outb($70, $02); + io_wait(); + DateTime.Minutes:= inb($71); + io_wait(); + outb($70, $04); + io_wait(); + DateTime.Hours:= inb($71); + io_wait(); + outb($70, $06); + io_wait(); + DateTime.Weekday:= inb($71); + io_wait(); + outb($70, $07); + io_wait(); + DateTime.Day:= inb($71); + io_wait(); + outb($70, $08); + io_wait(); + DateTime.Month:= inb($71); + io_wait(); + outb($70, $09); + io_wait(); + DateTime.Year:= inb($71); + io_wait(); + outb($70, $32); + io_wait(); + DateTime.Century:= inb($71); + io_wait(); +end; + +procedure init; +var + prev : uint8; + +begin + CLI; + //setup RTC + outb($70, $8A); + io_wait(); + outb($71, $20); + io_wait(); + + //enable ints + outb($70, $8B); + io_wait(); + prev:= inb($71); + io_wait(); + outb($70, $8B); + io_wait(); + outb($71, prev OR $40); + STI; + outb($70, $00); + isrmanager.registerISR(32 + 8, @update); + //TMR_0_ISR.hook(uint32(@update)); +end; + +end. \ No newline at end of file diff --git a/src/kernel.pas b/src/kernel.pas index 09261fac..816688eb 100644 --- a/src/kernel.pas +++ b/src/kernel.pas @@ -43,7 +43,8 @@ uses fat32, isrmanager, faults, - fonts; + fonts, + RTC; procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; @@ -230,6 +231,8 @@ begin storagemanagement.init(); tracer.pop_trace; + //RTC.init(); + { Hook Timer for Ticks } tracer.push_trace('kmain.TMR'); STI; @@ -274,6 +277,10 @@ begin console.writestringln('Press any key to boot in to Asuro Terminal...'); tracer.pop_trace; + writeint(DateTime.Hours); + writestring(':'); + writeintln(DateTime.Minutes); + tracer.push_trace('kmain.KEYHOOK'); keyboard.hook(@temphook); tracer.pop_trace; diff --git a/src/stub/stub.asm b/src/stub/stub.asm index 32e991aa..4c695127 100644 --- a/src/stub/stub.asm +++ b/src/stub/stub.asm @@ -36,8 +36,8 @@ MULTIBOOT_HEADER_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEA ; Kernel stack size ; KERNEL_STACKSIZE equ 0x4000 -KERNEL_VIRTUAL_BASE equ 0xC0000000 -KERNEL_PAGE_NUMBER equ (KERNEL_VIRTUAL_BASE >> 22) +KERNEL_VIRTUAL_BASE equ 0xC0000000 +KERNEL_PAGE_NUMBER equ (KERNEL_VIRTUAL_BASE >> 22) section .data align 0x1000 @@ -90,7 +90,7 @@ _loader: jmp ecx kstart: - mov dword [BootPageDirectory], 0 + mov dword [BootPageDirectory], 0 invlpg [0] mov esp, KERNEL_STACK+KERNEL_STACKSIZE ;Create kernel stack push eax ;Multiboot magic number