/* Copyright (C) 2021 Rain */
/* This file is part of XNIX. */
/*
XNIX is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) and later version.
*/
/*
XNIX is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
/*
You should have received a copy of the GNU General Public License
along with XNIX. If not, see .
*/
#ifndef INCLUDED_GRAPHIC_H
#define INCLUDED_GRAPHIC_H
#include
void putblock(__uint8_t, int, int, int, int);
void putc(char, __uint8_t, __uint8_t);
void print(__uint8_t, __uint8_t, char *);
/*
* we supports PSF format in XNIX.
* in linux, PSF fonts are in /usr/share/kbd/consolefonts, and they are always compressed.
* */
#define PSF_MAGIC 0x864ab572
struct psf_header {
__uint32_t magic;
/* zero */
__uint32_t version;
__uint32_t header_size;
/* zero if there's no unicode table */
__uint32_t flags;
/* in psf, a font calls glyph */
__uint32_t glyphs_count;
/* size of a glyph */
__uint32_t glyph_size;
__uint32_t height;
__uint32_t width;
};
/* '__uint64_t * ' can change to other types */
/* because they are all just lables with an address */
extern __uint8_t *font_start;
extern __uint8_t *font_end;
/* but 'font_size' must be __uint64_t because it's a value */
extern __uint64_t font_size;
#define FB_ADDR ((char *) 0xa0000)
/* x and y in this vga mode */
#define VGA_X 320
#define VGA_Y 200
/* this is default value */
#define CHAR_HEIGHT 8
#define CHAR_WIDTH 16
#define X_CHARS (VGA_X / CHAR_WIDTH)
#define Y_LINES (VGA_Y / CHAR_HEIGHT)
#endif