Skip to content
Snippets Groups Projects
Commit 6f9082e7 authored by Hazal2.Veziroglu@live.uwe.ac.uk's avatar Hazal2.Veziroglu@live.uwe.ac.uk
Browse files

Update file README.md

parent 0ddbe3a9
No related branches found
No related tags found
No related merge requests found
...@@ -46,4 +46,95 @@ Key features of this project include: ...@@ -46,4 +46,95 @@ Key features of this project include:
1. Bootloader: 1. Bootloader:
- GRUB is used to load the kernel. - GRUB is used to load the kernel.
- The kernel starts execution at the entry point defined in loader.asm. - The kernel starts execution at the entry point defined in loader.asm.
2. Transition to C:
- The kernel successfully calls and executes functions implemented in kernel.c.
3.Framebuffer Driver:
- Implements the following functions:
-fb_clear(): Clears the screen.
-fb_print(): Prints text at specified row and column.
-fb_move(): Moves the cursor to a specific position.
4.QEMU Testing:
-The OS is tested using QEMU in graphical and curses modes.
---
## **4. Implementation Details**
Bootloader (loader.asm)
The bootloader adheres to the Multiboot specification and transfers control to the kernel:
```asm
global loader
extern kernel_main
section .text
align 4
MAGIC_NUMBER equ 0x1BADB002
FLAGS equ 0x0
CHECKSUM equ -MAGIC_NUMBER
dd MAGIC_NUMBER
dd FLAGS
dd CHECKSUM
loader:
call kernel_main
hlt
```
Kernel (kernel.c)
The kernel initializes the framebuffer and tests its driver:
```c
#include "fb.h"
void kernel_main() {
fb_clear();
fb_print("Sum: 6", 0, 0);
fb_print("Booting Tiny OS", 1, 0);
fb_move(2, 0);
while (1) {}
}
```
Framebuffer Driver (fb.c)
Implements APIs for interacting with the framebuffer:
```c
#include "fb.h"
#include "io.h"
void fb_clear() {
char *fb = (char *)0xB8000;
for (int i = 0; i < 80 * 25; i++) {
fb[i * 2] = ' ';
fb[i * 2 + 1] = 0x07;
}
}
void fb_print(const char *str, unsigned short row, unsigned short col) {
char *fb = (char *)0xB8000;
unsigned short pos = (row * 80 + col) * 2;
for (int i = 0; str[i] != '\0'; i++) {
fb[pos + i * 2] = str[i];
fb[pos + i * 2 + 1] = 0x07;
}
}
void fb_move(unsigned short row, unsigned short col) {
unsigned short pos = row * 80 + col;
outb(0x3D4, 0x0F);
outb(0x3D5, (unsigned char)(pos & 0xFF));
outb(0x3D4, 0x0E);
outb(0x3D5, (unsigned char)((pos >> 8) & 0xFF));
}
```
---
## **5. Build and Run Instructions**
1. Clean the Build Directory
```bash
make clean
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment