|
miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
|
ANSI/VT100 escape sequence parser and VGA-backed terminal renderer. More...
Functions | |
| void | vt_init (void) |
| Clears the VGA framebuffer, resets cursor position to (0,0), sets default attribute (light gray on black), and initialises the ANSI escape parser state machine. Called once during kernel boot before any console output. | |
| void | vt_clear (void) |
| Fills all 80x25 VGA cells with space characters using the current default attribute, resets the cursor position to row 0 column 0, and updates the hardware cursor via VGA CRT registers. | |
| void | vt_write_byte (char c) |
If inside an ANSI escape sequence, feeds to the CSI parser and applies the completed command (cursor movement, erase, SGR color). Otherwise: | |
| void | vt_write (const char *buf, size_t len) |
| Calls vt_write_byte() for each byte in [buf, buf+len). Efficient for bulk output from tty_write() or printk(). | |
| void | vt_set_cursor_visible (bool visible) |
| Writes to VGA CRT registers VGA_CUR_START_REG (index 0x0A): sets VGA_CUR_DISABLE bit to hide, clears it and sets scanline range to show. | |
| void | vt_get_winsize (uint16_t *rows, uint16_t *cols) |
| Used by tty_ioctl TIOCGWINSZ to fill struct minios_winsize.ws_row/ws_col. | |
| uint8_t | vt_current_attr (void) |
| The attribute byte encodes foreground color (bits 3:0), background color (bits 6:4), and blink (bit 7) as set by the most recent SGR sequence. | |
ANSI/VT100 escape sequence parser and VGA-backed terminal renderer.
The VT core parses ANSI escape sequences (CSI cursor movement, SGR color, erase commands) and renders output to the VGA 80x25 text-mode framebuffer. It implements a software cursor, 256-color SGR mapped to the nearest VGA 16-color palette entry, and hardware cursor sync via the VGA CRT registers.
| void vt_clear | ( | void | ) |
Fills all 80x25 VGA cells with space characters using the current default attribute, resets the cursor position to row 0 column 0, and updates the hardware cursor via VGA CRT registers.
vt_clear() - Clear the terminal screen and reset cursor to (0,0).


| uint8_t vt_current_attr | ( | void | ) |
The attribute byte encodes foreground color (bits 3:0), background color (bits 6:4), and blink (bit 7) as set by the most recent SGR sequence.
vt_current_attr() - Return the current VGA text attribute byte.

Used by tty_ioctl TIOCGWINSZ to fill struct minios_winsize.ws_row/ws_col.
vt_get_winsize() - Query the terminal dimensions.
| rows | Output; set to SCREEN_ROWS (25). |
| cols | Output; set to SCREEN_COLS (80). |

| void vt_init | ( | void | ) |
Clears the VGA framebuffer, resets cursor position to (0,0), sets default attribute (light gray on black), and initialises the ANSI escape parser state machine. Called once during kernel boot before any console output.
vt_init() - Initialise the VT terminal state.


| void vt_set_cursor_visible | ( | bool | visible | ) |
Writes to VGA CRT registers VGA_CUR_START_REG (index 0x0A): sets VGA_CUR_DISABLE bit to hide, clears it and sets scanline range to show.
vt_set_cursor_visible() - Show or hide the hardware VGA text cursor.
| visible | true to enable the underline hardware cursor, false to hide it. |


| void vt_write | ( | const char * | buf, |
| size_t | len ) |
Calls vt_write_byte() for each byte in [buf, buf+len). Efficient for bulk output from tty_write() or printk().
vt_write() - Write a buffer of bytes through the VT state machine.
| buf | Pointer to the bytes to write. |
| len | Number of bytes in @buf. |

| void vt_write_byte | ( | char | c | ) |
If inside an ANSI escape sequence, feeds to the CSI parser and applies the completed command (cursor movement, erase, SGR color). Otherwise:
vt_write_byte() - Process one output byte through the VT state machine.
| c | Byte to process. |

