A update
This commit is contained in:
72
kernel/intro_anim.c
Normal file
72
kernel/intro_anim.c
Normal file
@ -0,0 +1,72 @@
|
||||
#include <string.h>
|
||||
#include <tty.h>
|
||||
#include <stdio.h>
|
||||
#include <port_io.h>
|
||||
|
||||
#include <kernel/intro_anim.h>
|
||||
|
||||
void delay_us(uint32_t microseconds, uint32_t cpu_mhz) {
|
||||
uint32_t count = cpu_mhz * microseconds;
|
||||
while (count--) {
|
||||
asm volatile ("nop" ::: "memory");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int16_t begin_anim(const char* version)
|
||||
{
|
||||
if (strlen(version) < 5)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char* e = "Espresso";
|
||||
const char* v = version;
|
||||
const char* n = "Press any key to continue";
|
||||
|
||||
int32_t pos = 0;
|
||||
int32_t v_pos = 0;
|
||||
int16_t b = 0;
|
||||
int32_t sh_pos = VGA_WIDTH / 2;
|
||||
int32_t sv_pos = VGA_HEIGHT / 2;
|
||||
|
||||
while (true)
|
||||
{
|
||||
terminal_clear();
|
||||
|
||||
for (int32_t i = 0; n[i]; ++i)
|
||||
{
|
||||
terminal_putentryat(n[i], terminal_getcolor(), sh_pos, sv_pos);
|
||||
sh_pos++;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; e[i]; ++i)
|
||||
{
|
||||
terminal_putentryat(e[i], terminal_getcolor(), pos + i, v_pos);
|
||||
}
|
||||
|
||||
if ((v_pos + 1) == VGA_HEIGHT)
|
||||
{
|
||||
v_pos = 0;
|
||||
b = 1;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; v[i]; ++i)
|
||||
{
|
||||
terminal_putentryat(v[i], terminal_getcolor(), pos + i + 3, (b == 0 ? (v_pos + 1) : v_pos));
|
||||
}
|
||||
|
||||
pos += 2;
|
||||
v_pos++;
|
||||
sh_pos = VGA_WIDTH / 2;
|
||||
|
||||
b = 0;
|
||||
|
||||
delay_us(50000, 5000);
|
||||
}
|
||||
|
||||
terminal_clear();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user