mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-27 04:50:28 +00:00
Bare metal VGA: minor improvements (#608)
This commit is contained in:
parent
155b378a39
commit
bae7367774
3 changed files with 79 additions and 101 deletions
|
@ -58,15 +58,23 @@ ssize_t sys_writev_vga(struct Fd *fd, const struct iovec *iov, int iovlen) {
|
|||
|
||||
__attribute__((__constructor__)) static textstartup void _vga_init(void) {
|
||||
void * const vid_buf = (void *)(BANE + 0xb8000ull);
|
||||
/* Get the initial cursor position from the BIOS data area. */
|
||||
/*
|
||||
* Get the initial cursor position from the BIOS data area. Also get
|
||||
* the height (in scan lines) of each character; this is used to set the
|
||||
* cursor shape.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char col, row;
|
||||
} bios_curs_pos_t;
|
||||
bios_curs_pos_t pos = *(bios_curs_pos_t *)(BANE + 0x0450ull);
|
||||
uint8_t chr_ht = *(uint8_t *)(BANE + 0x0485ull),
|
||||
chr_ht_hi = *(uint8_t *)(BANE + 0x0486ull);
|
||||
if (chr_ht_hi != 0 || chr_ht > 32)
|
||||
chr_ht = 32;
|
||||
/*
|
||||
* Initialize our tty structure from the current screen contents & current
|
||||
* cursor position.
|
||||
* Initialize our tty structure from the current screen contents, current
|
||||
* cursor position, & character height.
|
||||
*/
|
||||
_StartTty(&vga_tty, VGA_TTY_HEIGHT, VGA_TTY_WIDTH, pos.row, pos.col,
|
||||
vid_buf, vga_wcs);
|
||||
chr_ht, vid_buf, vga_wcs);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue