Skip to content

Commit

Permalink
added basic scroll without buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Namonay committed Jun 17, 2024
1 parent bf85b7e commit aac16e6
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion sources/drivers/vga/vga.zig
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ fn putEntry(c: u8, color: u8, x: usize, y: usize) void
vga.buffer[y * vga.width + x] = getVal(c, color);
}

pub fn scroll() void
{
for (1..vga.height) |x|
{
for (0..vga.width) |y|
{
vga.buffer[(x - 1) * vga.width + y] = vga.buffer[x * vga.width + y];
}
}
for (0..vga.width) |y|
{
vga.buffer[vga.height * vga.width + y] = 0;
}
}

pub fn putChar(c: u8) void
{
if(c == 0)
Expand All @@ -64,7 +79,7 @@ pub fn putChar(c: u8) void
vga.row = 0;
vga.column += 1;
if(vga.column == vga.height)
vga.column = 0;
scroll();
}
}

Expand Down

0 comments on commit aac16e6

Please sign in to comment.