libmsx
C library for MSX
Loading...
Searching...
No Matches
tty.h
Go to the documentation of this file.
1// -*- coding: utf-8-unix -*-
2/*
3 * Copyright (c) 2021-2025 Daishi Mori (mori0091)
4 *
5 * This software is released under the MIT License.\n
6 * See https://github.com/mori0091/libmsx/blob/main/LICENSE
7 *
8 * GitHub libmsx project\n
9 * https://github.com/mori0091/libmsx
10 */
30#pragma once
31
32#ifndef TTY_H_
33#define TTY_H_
34
35#include <stdint.h>
36
47struct TTY_Device {
49 uint8_t columns;
51 uint8_t lines;
53 void (* clear_screen)(void);
55 void (* render_char)(uint8_t c);
57 void (* set_text_color)(uint8_t fg, uint8_t bg);
59 void (* set_border_color)(uint8_t border);
60};
61
62extern const struct TTY_Device * TTY_device;
63
69void TTY_locate(uint8_t x, uint8_t y);
70
74void TTY_linefeed(void);
75
79void TTY_cls(void);
80
85void TTY_put(uint8_t c);
86
91void TTY_set_fg_color(uint8_t fg);
92
97void TTY_set_bg_color(uint8_t bg);
98
103void TTY_set_border_color(uint8_t border);
104
110void TTY_set_text_color(uint8_t fg, uint8_t bg);
111
118void TTY_set_color(uint8_t fg, uint8_t bg, uint8_t border);
119
122#endif // TTY_H_
void(* set_text_color)(uint8_t fg, uint8_t bg)
Set foreground and background color of text.
Definition tty.h:57
void(* clear_screen)(void)
Clear the text screen.
Definition tty.h:53
void(* render_char)(uint8_t c)
Render a character at the cursor position.
Definition tty.h:55
uint8_t lines
Lines of the text screen.
Definition tty.h:51
uint8_t columns
Columns of the text screen.
Definition tty.h:49
void(* set_border_color)(uint8_t border)
Set border color of the screen.
Definition tty.h:59
void TTY_linefeed(void)
MSX Line feed.
void TTY_set_border_color(uint8_t border)
MSX Set border color of the screen.
void TTY_locate(uint8_t x, uint8_t y)
MSX Set cursor position.
void TTY_set_bg_color(uint8_t bg)
MSX Set background color.
void TTY_set_text_color(uint8_t fg, uint8_t bg)
MSX Set foreground and background color.
void TTY_set_fg_color(uint8_t fg)
MSX Set foreground color.
void TTY_cls(void)
MSX Clear the screen and move the cursor to the top left corner.
const struct TTY_Device * TTY_device
void TTY_set_color(uint8_t fg, uint8_t bg, uint8_t border)
MSX Set foreground, background, and border color.
void TTY_put(uint8_t c)
MSX Send a byte to the TTY device.
Teletype/console device interface for hardware / screen mode abstraction.
Definition tty.h:47