Skip to content

Commit

Permalink
Welcome to RatiOS 0.2, updated screen to have kernel print and logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Namonay committed Jul 19, 2024
1 parent eecc613 commit d94eb60
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion sources/drivers/index.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn initDrivers() void
kernel.logs.klogln("[Drivers Manager] loading drivers...");
kernel.logs.beginSection();
kb.init();
vga.init("RatiOS 0.2", vga.computeColor(vga.Color.BLACK, vga.Color.LIGHT_GREY), vga.computeColor(vga.Color.WHITE, vga.Color.DARK_GREY), vga.computeColor(vga.Color.RED, vga.Color.DARK_GREY));
vga.init("RatiOS 0.2", vga.computeColor(vga.Color.BLACK, vga.Color.LIGHT_GREY), vga.computeColor(vga.Color.WHITE, vga.Color.DARK_GREY), vga.computeColor(vga.Color.LIGHT_BLUE, vga.Color.DARK_GREY));
power.init();
kernel.logs.endSection();
kernel.logs.klogln("[Drivers Manager] loaded drivers");
Expand Down
36 changes: 21 additions & 15 deletions sources/drivers/vga/vga.zig
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,24 @@ pub fn changeScreen(targetScreen: u8) void
fn updateNavbar() void
{
vga.color = vga.nav_color;
for(63..80) |i|
const values = [_]u8{'1','2','3','4','5','6','S','L'};
var i : u32 = 63;
for(values) |c|
{
if(i % 2 == 1)
putCharAt(' ', i, 0);
if(i % 2 == 0)
putCharAt(17 + @as(u8, @truncate(i / 2)), i, 0);
if(@as(u8, @truncate((i - 63) / 2)) == vga.currentScreen and i % 2 == 0)
putCharAt(' ', i, 0);
i += 1;
if(@as(u8, @truncate((i - 63) / 2)) == vga.currentScreen)
{
vga.color = vga.nav_triggered_color;
putCharAt(17 + @as(u8, @truncate(i / 2)), i, 0);
putCharAt(c, i, 0);
vga.color = vga.nav_color;
}
else
putCharAt(c, i, 0);
i += 1;
}
vga.color = computeColor(vga.curr_fg, vga.curr_bg);
putCharAt(' ', i, 0);
vga.color = computeColor(vga.curr_fg, vga.curr_bg);
}

pub fn init(title : []const u8, title_color : u8, navbar_color : u8, triggered_color : u8) void
Expand All @@ -144,13 +148,15 @@ pub fn init(title : []const u8, title_color : u8, navbar_color : u8, triggered_c
vga.color = navbar_color;
vga.nav_color = navbar_color;
vga.nav_triggered_color = triggered_color;
for(63..80) |i|
{
if(i % 2 == 1)
putCharAt(' ', i, 0);
if(i % 2 == 0)
putCharAt(17 + @as(u8, @truncate(i / 2)), i, 0);
}
// const values = [_]u8{'1','2','3','4','5','6','S','L'};
// var i : u32 = 63;
// for (values) |c|
// {
// putCharAt(' ', i, 0);
// i += 1;
// putCharAt(c, i, 0);
// i += 1;
// }
vga.color = computeColor(vga.curr_fg, vga.curr_bg);
vga.column = 1;
updateCursor();
Expand Down

0 comments on commit d94eb60

Please sign in to comment.