2018-07-20 15:41:58 +02:00
|
|
|
#pragma once
|
2018-08-06 21:00:58 +02:00
|
|
|
#include "stdarg.h"
|
2019-04-11 22:32:50 +02:00
|
|
|
#include "stdint.h"
|
2018-07-20 15:41:58 +02:00
|
|
|
|
|
|
|
// https://wiki.osdev.org/Text_UI
|
|
|
|
#define BLACK 0x00
|
|
|
|
#define BLUE 0x01
|
|
|
|
#define GREEN 0x02
|
|
|
|
#define CYAN 0x03
|
|
|
|
#define RED 0x04
|
|
|
|
#define MAGENTA 0x05
|
|
|
|
#define BROWN 0x06
|
|
|
|
#define GREY 0x07
|
|
|
|
#define WHITE 0x0F
|
|
|
|
|
|
|
|
#define VGA_ADDR 0xB8000
|
|
|
|
#define VGA_WIDTH 80
|
|
|
|
#define VGA_HEIGHT 25
|
|
|
|
|
2019-04-11 22:32:50 +02:00
|
|
|
#ifndef pr_fmt
|
|
|
|
#define pr_fmt(fmt) fmt
|
|
|
|
#endif
|
|
|
|
|
2018-08-06 22:28:45 +02:00
|
|
|
void vprintf(const char *format, va_list ap);
|
|
|
|
void printf(const char *format, ...);
|
2018-11-08 22:08:27 +01:00
|
|
|
int VGASetup(uint bgColor, uint color);
|
2018-07-20 15:41:58 +02:00
|
|
|
void clearScreen(uint bgColor);
|
2018-11-16 19:56:38 +01:00
|
|
|
void clearScreenLine(uint bgColor, uint line);
|
2018-07-20 15:41:58 +02:00
|
|
|
void printInt(int integer);
|
|
|
|
void printIntDetails(int integer, uint color, uint bgColor, int startX, int startY);
|
|
|
|
void printCharDetails(char str, uint color, uint bgColor, int startX, int startY);
|
|
|
|
void printStringDetails(const char *str, uint color, uint bgColor, int startX, int startY);
|
|
|
|
void printString(const char *str);
|
|
|
|
void printChar(const char str);
|
|
|
|
void vgaScrollUp(void);
|
2018-11-14 18:03:11 +01:00
|
|
|
void cursorEnable(uint8_t cursor_start, uint8_t cursor_end);
|
|
|
|
void cursorDisable(void);
|
|
|
|
void cursorMove(int x, int y);
|
2019-04-11 22:32:50 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Dummy printk for disabled debugging statements to use whilst maintaining
|
|
|
|
* gcc's format checking.
|
|
|
|
*/
|
|
|
|
#define no_printf(fmt, ...) \
|
|
|
|
({ \
|
|
|
|
if (0) \
|
|
|
|
printf(fmt, ##__VA_ARGS__); \
|
|
|
|
0; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
#define pr_devel(fmt, ...) \
|
|
|
|
printf(pr_fmt(fmt), ##__VA_ARGS__)
|
|
|
|
#else
|
|
|
|
#define pr_devel(fmt, ...) \
|
|
|
|
no_printf(pr_fmt(fmt), ##__VA_ARGS__)
|
|
|
|
#endif
|
2019-04-11 23:08:59 +02:00
|
|
|
|
|
|
|
#define pr_info(fmt, ...) \
|
|
|
|
printf(pr_fmt(fmt), ##__VA_ARGS__)
|