Skip to content

Commit

Permalink
Merge pull request #9 from jwt2706/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jwt2706 authored Aug 24, 2024
2 parents 28806af + a3d6599 commit 5c1e94c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# BabOSco
# BaboscOS

[![Build](https://github.com/jwt2706/BaboscOS/actions/workflows/build.yml/badge.svg)](https://github.com/jwt2706/BaboscOS/actions/workflows/build.yml)

<i>Basic</i> (x86) <i>Architecture</i> (with) <i>Built-in Open Source Components OS</i> (insane naming)
BaboscOS: <i>Bare And Basic Open Source Console-based Operating System</i> (insane naming, i know)

okay im staring with [this](https://github.com/limine-bootloader/limine-c-template) and ill see where this goes
eventually ill work over the parts i used as a base
Super bare and basic 64bit operating system featuring a limine protocol compliant (higher half) kernel.

featureing a 64-bit higher half Limine protocol-compliant kernel
I wanted to build an os one day, and so now im finally attempting that. I decided to start off with this [limine template](https://github.com/limine-bootloader/limine-c-template) after reading the osdev wiki for so dang long. I figured it was a better place to start than to write my own bootloader lol (but i do plan on doing that one day).

I got some cool ideas for this project, but we're taking things one at a time. idk if im going to write seperate docs on this or just really take the time to just write out my thought process in comments but yeah
2 changes: 2 additions & 0 deletions kernel/include/terminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

struct terminal {
struct limine_framebuffer *framebuffer;
int start_x;
int start_y;
int cursor_x;
int cursor_y;
uint32_t color;
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void _start(void) {
struct terminal term;
terminal_init(&term, framebuffer, COLOR_WHITE, 2);

terminal_write(&term, "BaboscOS booted up successfully!BaboscOS booted up successfully!BaboscOS booted up successfully!BaboscOS booted up successfully!BaboscOS booted up successfully!");
terminal_write(&term, "BaboscOS booted up successfully!BaboscOS booted up successfully!BaboscOS booted up successfully!");
terminal_edit(&term, COLOR_RED, 3);
terminal_write(&term, "red color and scalesadasdasdsads 3");

Expand Down
10 changes: 5 additions & 5 deletions kernel/src/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

void terminal_init(struct terminal *term, struct limine_framebuffer *framebuffer, uint32_t color, int scale) {
term->framebuffer = framebuffer;
term->cursor_x = 4;
term->cursor_y = 4;
term->start_x = 4;
term->start_y = 4;
term->cursor_x = term->start_x;
term->cursor_y = term->start_y;
term->color = color;
term->scale = scale;
}
Expand All @@ -19,20 +21,18 @@ void terminal_edit(struct terminal *term, uint32_t color, int scale) {
but take into account, special things like '\n' for new lines.
*/
void terminal_write(struct terminal *term, const char *str) {
int start_x = term->cursor_x;
int max_x = term->framebuffer->width - 8 * term->scale; // maximum x position before wrapping
while (*str) {
if (*str == '\n' || term->cursor_x > max_x) { // if the character is a newline or cursor exceeds max_x..
term->cursor_y += 8 * term->scale; // ..offset y
term->cursor_x = start_x; // ..and reset x
term->cursor_x = term->start_x; // ..and reset x
}
if (*str != '\n') {
terminal_write_char(term, *str);
term->cursor_x += 8 * term->scale; // offset x for each new character so they don't just print on top of each other
}
str++;
}
term->cursor_x = start_x;
}

/*
Expand Down

0 comments on commit 5c1e94c

Please sign in to comment.