This commit is contained in:
Eggert Jung
2025-04-17 21:13:10 +02:00
parent 5a2e32aaeb
commit 798103454e
3 changed files with 30 additions and 8 deletions

View File

@@ -18,6 +18,15 @@ namespace CGA {
constexpr unsigned ROWS = 25; ///< Visible rows in text mode
constexpr unsigned COLUMNS = 80; ///< Visible columns in text mode
enum RegisterIndex {
CURSOR_START = 10,
CURSOR_END = 11,
START_ADDRESS_HIGH = 12,
START_ADDRESS_LOW = 13,
CURSOR_HIGH = 14,
CURSOR_LOW = 15
};
/*! \brief CGA color palette
*
* Colors for the attribute byte.
@@ -62,7 +71,9 @@ enum Color {
*/
union Attribute {
struct {
uint8_t todo : 8;
uint8_t foreground : 4;
uint8_t background : 3;
uint8_t blink : 1;
} __attribute__((packed));
uint8_t value; ///< combined value
@@ -75,11 +86,7 @@ union Attribute {
* \param blink Blink if `true` (default: no blinking)
*/
explicit Attribute(Color foreground = LIGHT_GREY, Color background = BLACK,
bool blink = false) { // NOLINT
(void)foreground;
(void)background;
(void)blink;
}
bool blink = false) : foreground(foreground), background(background), blink(blink) {}
} __attribute__((packed)); // prevent padding by the compiler
/*! \brief Set the keyboard hardware cursor to absolute screen position