From 6f9082e7413719e46c6a477e1b0208053437cafb Mon Sep 17 00:00:00 2001
From: "Hazal2.Veziroglu@live.uwe.ac.uk" <hazal2.veziroglu@live.uwe.ac.uk>
Date: Sat, 7 Dec 2024 00:10:15 +0000
Subject: [PATCH] Update file README.md

---
 tiny-os/README.md | 93 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 92 insertions(+), 1 deletion(-)

diff --git a/tiny-os/README.md b/tiny-os/README.md
index 623a23c..dafdf35 100644
--- a/tiny-os/README.md
+++ b/tiny-os/README.md
@@ -39,11 +39,102 @@ tiny-os/
 
 ---
 
-## **3. Features**
+## **3.Features**
 
 Key features of this project include:
 
 1. Bootloader:
 - GRUB is used to load the kernel.
 - 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
+```
+
 
-- 
GitLab