11 #define DEFAULT_STYLE_DARK (G_DEFAULT | G_DARK) 12 #define DEFAULT_STYLE (G_DEFAULT) 22 uint16_t written_data =
ch | (
style << 8);
27 :
"c"(written_data),
"D"(offset)
28 :
"cc",
"ax",
"memory" 35 uint8_t crow = cursor >> 8;
36 uint8_t ccol = cursor & 0b11111111;
39 }
else if (
ch ==
'\n') {
45 }
else if (
ch ==
'\b') {
48 else if (
ch ==
'\t') {
71 static inline int16_t
padding(int16_t num) {
72 for (int16_t i = 0; i < num; ++i) {
91 while (*s && *s >=
'0' && *s <=
'9') {
92 ret = ret * 10 + (*s -
'0');
104 static inline int16_t
draw_str(
char const* str,
int row,
int col) {
105 int pos = (
row * 80 + col) * 2;
107 while (*str !=
'\0') {
121 int pos = (
row * 80 + col) * 2;
123 while (*str !=
'\0') {
132 int pos = (
row * 80 + col) * 2;
146 static inline int16_t
puts(
char const* str) {
149 static inline int16_t
putln(
char const* str) {
159 static inline int16_t
puti(int32_t num) {
171 _buffer[index++] = num % 10 +
'0';
174 for (
int i = index-1; i >= 0; --i) {
190 static inline int printf(
const char* format, ...) {
195 while (format[index]) {
196 if (format[index] ==
'%') narg++;
200 va_start(valist, narg);
203 while (format[index]) {
206 int16_t digitLength = 0;
207 if (format[index] ==
'%') {
208 if ((format[index+1] >=
'0' && format[index+1] <=
'9') | format[index+1] ==
'-') {
213 if (format[index + digitLength + 1] ==
'd') {
214 int data = va_arg(valist,
int);
216 }
else if (format[index+ digitLength + 1] ==
'c') {
217 int c = va_arg(valist,
int);
219 }
else if (format[index + digitLength + 1] ==
's') {
220 char* str = va_arg(valist,
char*);
222 }
else if (format[index + digitLength + 1] ==
'%'){
225 if (delta < putSize) {
229 index += 2 + digitLength;
231 }
else if (format[index] ==
'\n' || format[index] ==
'\r') {
235 pcnt +=
putch(format[index]);
245 static inline int16_t
putn(
const char* s, uint16_t size) {
246 for (
int i = 0; i < size; ++i) {
static int16_t putch_style(char ch, uint8_t style)
static int16_t __uts_read_int(const char *s, int16_t *readNum)
most importantly low level function used in kernel
static int16_t padding(int16_t num)
static int16_t draw_str(char const *str, int row, int col)
static int16_t draw_char_style(char ch, int row, int col, uint8_t style)
static int16_t putch(char ch)
static int16_t puti(int32_t num)
static int16_t putn(const char *s, uint16_t size)
static int16_t putiln(int num)
static void scroll_up_one_line()
static uint16_t get_cursor()
static int16_t puts_style(char const *str, uint8_t style)
static void set_cursor(uint8_t row, uint8_t col)
static int printf(const char *format,...)
static int16_t putln(char const *str)
static int16_t draw_str_style(char const *str, int row, int col, uint8_t style)
#define DEFAULT_STYLE_DARK
static int16_t _draw_char(char ch, int offset, uint8_t style)
static int16_t puts(char const *str)