forked from PoliEcho-holding-org/kern
MAJOR RESTRUCTURE
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
#ifndef _SCREEN_GFXMODE_H
|
||||
#define _SCREEN_GFXMODE_H
|
||||
|
||||
#include <memory/addresses.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define BG_COLOR 0x00010b17
|
||||
#define FG_COLOR 0x00ebddf4
|
||||
|
||||
typedef struct modeInfoBlock_s {
|
||||
// Required by all VBE revisions
|
||||
uint16_t modeAttr;
|
||||
uint8_t windowAAtrr;
|
||||
uint8_t windowBAttr;
|
||||
uint16_t windowGranularity;
|
||||
uint16_t windowSize;
|
||||
uint16_t windowASegment;
|
||||
uint16_t windowBSegment;
|
||||
uint32_t windowFunctionPtr;
|
||||
uint16_t bytesPerScanline;
|
||||
|
||||
// Required by VBE 1.2+
|
||||
uint16_t xRes;
|
||||
uint16_t yRes;
|
||||
uint8_t xCharSize;
|
||||
uint8_t yCharSize;
|
||||
uint8_t planeCount;
|
||||
uint8_t bpp;
|
||||
uint8_t bankCount;
|
||||
uint8_t memoryModel;
|
||||
uint8_t bankSize;
|
||||
uint8_t imagePageCount;
|
||||
uint8_t reserved1;
|
||||
|
||||
// Direct color fields
|
||||
uint8_t redMaskSize;
|
||||
uint8_t redFieldPos;
|
||||
uint8_t greenMaskSize;
|
||||
uint8_t greenFieldPos;
|
||||
uint8_t blueMaskSize;
|
||||
uint8_t blueFieldPos;
|
||||
uint8_t reservedMaskSize;
|
||||
uint8_t reservedFieldPos;
|
||||
uint8_t directColorModeInfo;
|
||||
|
||||
// Required by VBE 2.0+
|
||||
uint32_t physicalBasePtr;
|
||||
uint32_t reserved2;
|
||||
uint16_t reserved3;
|
||||
|
||||
// Required by VBE 3.0+
|
||||
uint16_t linearBytesPerScanline;
|
||||
uint8_t bankImagePageCount;
|
||||
uint8_t linearImagePageCount;
|
||||
uint8_t linearRedMaskSize;
|
||||
uint8_t linearRedFieldPos;
|
||||
uint8_t linearGreenMaskSize;
|
||||
uint8_t linearGreenFieldPos;
|
||||
uint8_t linearBlueMaskSize;
|
||||
uint8_t linearBlueFieldPos;
|
||||
uint8_t linearReservedMaskSize;
|
||||
uint8_t linearReservedFieldPos;
|
||||
uint32_t maxPixelClock;
|
||||
|
||||
uint8_t reserved4[190];
|
||||
} __attribute__ ((packed)) modeInfoBlock_t;
|
||||
|
||||
extern modeInfoBlock_t* gfxMode;
|
||||
|
||||
uint32_t convertColor(uint32_t color);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef _SCREEN_GRAPHICS_H
|
||||
#define _SCREEN_GRAPHICS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define rgb(_r,_g,_b) ( ((_r) << 16 | (_g) << 8 | (_b)) & 0x00ffffff )
|
||||
|
||||
void drawPixel(int32_t x, int32_t y, uint32_t color);
|
||||
void drawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color);
|
||||
void drawRect(int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color);
|
||||
void drawTriangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, uint32_t color);
|
||||
void drawCircle(int32_t x, int32_t y, uint16_t radius, uint32_t color);
|
||||
void boundaryFill(int32_t x, int32_t y, uint32_t fillColor, uint32_t boundaryColor);
|
||||
void fillRect(int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color);
|
||||
void fillTriangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, uint32_t color);
|
||||
void fillCircle(int32_t x, int32_t y, uint16_t radius, uint32_t color);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef _SCREEN_TEXT_H
|
||||
#define _SCREEN_TEXT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t width;
|
||||
uint8_t height;
|
||||
};
|
||||
uint8_t data[4096];
|
||||
} __attribute__ ((packed)) font_t;
|
||||
|
||||
void drawChar(char c, uint32_t x, uint32_t y, uint32_t fgColor, uint32_t bgColor);
|
||||
void scroll();
|
||||
void clearScreen(uint32_t bgColor);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef _SCREEN_TTY_H
|
||||
#define _SCREEN_TTY_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct console {
|
||||
uint32_t x; // X Position of cursor in characters
|
||||
uint32_t y; // Y Position of cursor in characters
|
||||
uint32_t bg; // Printed character background
|
||||
uint32_t fg; // Printed character foreground
|
||||
uint32_t width; // Width in characters
|
||||
uint32_t height; // Height in characters
|
||||
char cursorChar; // Character to use as a cursor
|
||||
bool hideCursor; // Should we display the cursor
|
||||
}
|
||||
|
||||
extern struct console* console;
|
||||
|
||||
int32_t consoleWrite(const void* buf, uint32_t len);
|
||||
void toggleCursor();
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user