diff --git a/bootdef.inc b/bootdef.inc index 274136b..fc8d6b2 100644 --- a/bootdef.inc +++ b/bootdef.inc @@ -6,7 +6,7 @@ %define BOOT_KERNEL_SEG 0x0AC0 ;right after ROOT_DIR %define BOOT_STAGE2_SEG 0x0B00 ;right after KERNEL_SEG %define BOOT_STAGE2_ADD 0xB000 ;address of stage2 to jump to, org at -%define BOOT_KERNEL_ADD 0x100000 ;final pmode kernel destination - physical +%define BOOT_KERNEL_ADD 0x104000 ;final pmode kernel destination - physical %define BOOT_RD_ADD 0x200000 ;2mb for ram disk %define BOOT_DATA_SEG 0x9000 ;data gathered by stage2 loader goes here diff --git a/k.bin b/k.bin new file mode 100644 index 0000000..ae472d1 Binary files /dev/null and b/k.bin differ diff --git a/kernel.asm b/kernel.asm index f75b4fe..0ad7697 100644 --- a/kernel.asm +++ b/kernel.asm @@ -4,8 +4,8 @@ %include "bootdef.inc" -%define GDT 0x140000 -%define IDT 0x150000 +%define GDT 0x100000 +%define IDT 0x102000 [global start] [extern _isr] @@ -65,4 +65,3 @@ haltit: %include "idt.inc" - diff --git a/kernel.c b/kernel.c index 58c631e..15cc7ac 100644 --- a/kernel.c +++ b/kernel.c @@ -56,6 +56,22 @@ void k_init() enable_ints(); kbd_resetLEDs(); //after enabling interrupts!! + char *bmpptr = (char *)0x108000+54; + int a = 0; + int x = 0; + int y = 479; + for (a=0; a < 640*480; a++) + { + video_pset(x, y, *(dword *)bmpptr); + bmpptr += 3; + x++; + if (x == 640) + { + x = 0; + y--; + } + } + printf("HOS 0.12 - Kernel Size: %d kb\n", kernel_size()/1024); printf("Memory available to OS: %d MB (Bytes: %d)\n", mm_totalmem/0x100000, mm_totalmem); printf("Free memory: %d bytes\n", mm_freemem()); @@ -64,7 +80,7 @@ void k_init() for (;;) { key = kbdWaitKey(); -// if (((key & 0xFF00) >> 8) != 2) //key is not a control key + if ((key & 0xFF) > 2) //key is not a control key putc(key); } } diff --git a/keyboard.c b/keyboard.c index fd3e6e0..5412870 100644 --- a/keyboard.c +++ b/keyboard.c @@ -171,6 +171,7 @@ void isr_keyboard() } //====do something with key:: +// printf("kbdScan == %d\nkbdAscii == %d\nkbdFlags == %d\n", kbdScan, kbdAscii, kbdFlags); if ((kbdScan == 83) && (kbdFlags & KBD_CTRL) && (kbdFlags & KBD_ALT)) { printf("Initiating reboot."); diff --git a/link.ld b/link.ld index eddc4fb..310c93e 100644 --- a/link.ld +++ b/link.ld @@ -2,7 +2,7 @@ OUTPUT_FORMAT("binary") ENTRY(start) SECTIONS { - .text 0x100000 : { + .text 0x104000 : { code = .; _code = .; __code = .; *(.text) . = ALIGN(4096); diff --git a/rivercity.bmp b/rivercity.bmp new file mode 100644 index 0000000..1fbc411 Binary files /dev/null and b/rivercity.bmp differ diff --git a/vmm.c b/vmm.c index 1fdd9b9..649cb68 100644 --- a/vmm.c +++ b/vmm.c @@ -29,7 +29,7 @@ void vmm_init() //we also need to map in the video framebuffer memory: if (video_mode.PhysBasePtr > 0 && video_mode.BitsPerPixel > 0) { - if (vmm_mapn(video_mode.PhysBasePtr, video_mode.PhysBasePtr, 0x03, (video_mode.BitsPerPixel/8 * video_mode.XResolution * video_mode.YResolution)/4096+1)) + if (vmm_mapn(video_mode.PhysBasePtr, video_mode.PhysBasePtr, 0x03, ((video_mode.BitsPerPixel>>3) * video_mode.XResolution * video_mode.YResolution)/4096+1)) { printf("Could not page in video memory at 0x%x!\n", video_mode.PhysBasePtr); halt(); @@ -92,10 +92,10 @@ int vmm_mapn(dword virtual, dword physical, dword flags, dword n) int vmm_unmap1(dword virtual) { - int pde = (virtual & 0xFFC00000) >> 22; - int pte = (virtual & 0x003FF000) >> 12; if (virtual & 0x00000FFF) return 1; // ERROR 1: address not page-aligned + int pde = (virtual & 0xFFC00000) >> 22; + int pte = (virtual & 0x003FF000) >> 12; if (!(vmm_PDBR->pageTables[pde] & 0x01)) return 2; // ERROR 2: page table not present PageTable *ptp = (PageTable *)(vmm_PDBR->pageTables[pde] & 0xFFFFF000);