other changes

This commit is contained in:
spikey 2024-02-17 21:53:36 -05:00
parent 1841db88b1
commit 6dc29e41ee
4 changed files with 23 additions and 7 deletions

View File

@ -1,5 +1,7 @@
#!/usr/bin/env sh
mkdir -p obj/
INCLUDE="-Isys/drv/vga/include -Isys/include"
CFLAGS="-g -m32 -ffreestanding -Wall -Wextra -pedantic -nostdlib $INCLUDE"
ASFLAGS="-felf32"

View File

@ -10,7 +10,7 @@ s32 unused = 0;
s8 *vga_vidmem = (s8 *)0xb8000;
s8 vga_unused = 0;
void vga_write(s8 *, s32, s8);
void vga_write(s8 *, s16, s8);
void vga_clearscreen(void);
#endif

View File

@ -2,12 +2,12 @@
#include <video.h>
void
vga_write(s8 *sequence, s32 size, s8 flags)
vga_write(s8 *sequence, s16 size, s8 flags)
{
if (size > VGA_TEXT_SIZE) {
s32 using_size = size - VGA_SIZE;
s16 using_size = size - VGA_TEXT_SIZE;
for (s32 i = 0; i <= VGA_SIZE; i++) {
for (s16 i = 0; i <= VGA_SIZE; i++) {
vga_vidmem[i] = sequence[using_size + i];
vga_vidmem[++i] = flags;
}
@ -16,6 +16,15 @@ vga_write(s8 *sequence, s32 size, s8 flags)
return;
}
s16 needed_space = size + unused - VGA_TEXT_SIZE;
if (needed_space >= 0) {
for (s16 i = 0; i <= VGA_SIZE - needed_space; i++) {
vga_vidmem[i] = vga_vidmem[i + needed_space];
}
unused = VGA_SIZE - needed_space;
}
while (*sequence != '\0') {
vga_vidmem[unused++] = *sequence;
*sequence++;
@ -26,7 +35,7 @@ vga_write(s8 *sequence, s32 size, s8 flags)
void
vga_clearscreen(void)
{
for (int i = 0; i <= VGA_SIZE; i++) {
for (s16 i = 0; i <= VGA_SIZE; i++) {
vga_vidmem[i] = 0;
}
}

View File

@ -1,7 +1,12 @@
#include <types.h>
void
sysinit(void)
{
vga_clearscreen();
vga_write("Om Smart.", 9, 0x0F);
vga_write("Om Smarter.", 11, 0x0F);
vga_write("fish stick.", 10, 0x0F);
for (s16 i = 0; i <= 2000; i += 20) {
vga_write("Om Smart!", 9, 0x0F);
vga_write("Om Smarter!", 11, 0x0F);
}
}