Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Kernel.c:
- /*
- * kernel.c
- */
- #include <stdio.h>
- #include <stdlib.h>
- void kmain(void)
- {
- FILE * pFile;
- char c;
- const char *str = "DoorsOS v0.3";
- printf("Hello World!\n");
- char *vidptr = (char*)0xb8000; //video mem begins here.
- unsigned int i = 0;
- unsigned int j = 0;
- /* this loops clears the screen
- * there are 25 lines each of 80 columns; each element takes 2 bytes */
- while(j < 80 * 25 * 2) {
- /* blank character */
- vidptr[j] = ' ';
- /* attribute-byte - light grey on black screen */
- vidptr[j+1] = 0x07;
- j = j + 2;
- }
- j = 0;
- /* this loop writes the string to video memory */
- while(str[j] != '\0') {
- /* the character's ascii */
- vidptr[i] = str[j];
- /* attribute-byte: give character black bg and light grey fg */
- vidptr[i+1] = 0x07;
- ++j;
- i = i + 2;
- }
- return;
- }
- linker.ld:
- /*
- * link.ld
- */
- OUTPUT_FORMAT(elf32-i386)
- ENTRY(start)
- SECTIONS
- {
- . = 0x100000;
- .text : { *(.text) }
- .data : { *(.data) }
- .bss : { *(.bss) }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement