|
|
@@ -1,26 +1,12 @@
|
|
|
-/* Terminal: prompt, busy indicator, blinking cursor, echo loop. */
|
|
|
+/* Terminal: prompt, blinking cursor, echo loop. */
|
|
|
|
|
|
#include "io.h"
|
|
|
#include "terminal.h"
|
|
|
#include "timer.h"
|
|
|
|
|
|
-static unsigned int busy_idx;
|
|
|
-static unsigned int last_busy_tick;
|
|
|
-static const unsigned char busy_chars[4] = { 0x2D, 0x5C, 0x7C, 0x2F };
|
|
|
-
|
|
|
static int cursor_visible;
|
|
|
static unsigned int last_cursor_tick;
|
|
|
|
|
|
-static void update_busy(void)
|
|
|
-{
|
|
|
- unsigned int t = get_ticks_ms();
|
|
|
- if (t - last_busy_tick >= BUSY_MS) {
|
|
|
- last_busy_tick = t;
|
|
|
- busy_idx = (busy_idx + 1) % 4;
|
|
|
- }
|
|
|
- io_vga_write(IO_BUSY_POS, (unsigned short)((0x0A << 8) | busy_chars[busy_idx]));
|
|
|
-}
|
|
|
-
|
|
|
static void update_cursor_blink(void)
|
|
|
{
|
|
|
unsigned int t = get_ticks_ms();
|
|
|
@@ -40,15 +26,12 @@ static const char prompt[] __attribute__((section(".text"))) = "\n> ";
|
|
|
void terminal_run(void)
|
|
|
{
|
|
|
last_cursor_tick = get_ticks_ms();
|
|
|
- last_busy_tick = get_ticks_ms();
|
|
|
cursor_visible = 1;
|
|
|
- busy_idx = 0;
|
|
|
|
|
|
io_putstr(msg);
|
|
|
io_putstr(prompt);
|
|
|
|
|
|
for (;;) {
|
|
|
- update_busy();
|
|
|
update_cursor_blink();
|
|
|
{
|
|
|
char c = io_poll_key();
|