forked from PoliEcho-holding-org/kern
OS now allocs memory for called files. Slightly improved screen.h
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
#define rgb(r,g,b) ( ((r) << 16 | (g) << 8 | (b)) & 0x00ffffff )
|
||||
|
||||
void drawPixel(int32_t x, int32_t y, uint32_t color) {
|
||||
uint32_t* vidmem = *(uint32_t**)(MODE_INFO_BLOCK + 40);
|
||||
|
||||
uint32_t offset = (y * WIDTH) + x;
|
||||
vidmem[offset] = color;
|
||||
}
|
||||
@@ -94,6 +96,8 @@ void drawCircle(int32_t x, int32_t y, uint16_t radius, uint32_t color) {
|
||||
|
||||
// Recursive (may need large stack)
|
||||
void boundaryFill(int32_t x, int32_t y, uint32_t fillColor, uint32_t boundaryColor) {
|
||||
uint32_t* vidmem = *(uint32_t**)(MODE_INFO_BLOCK + 40);
|
||||
|
||||
uint32_t offset = y * WIDTH + x;
|
||||
|
||||
if (vidmem[offset] != fillColor && vidmem[offset] != boundaryColor) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define PHYSICAL_MEM_MANAGER_H
|
||||
|
||||
#include "string.h"
|
||||
#include "stdint.h"
|
||||
|
||||
#define BLOCK_SIZE 4096 // 4kB
|
||||
#define BLOCKS_PER_BYTE 8
|
||||
|
||||
+4
-12
@@ -14,19 +14,13 @@ struct cursor_s {
|
||||
uint32_t y;
|
||||
};
|
||||
|
||||
static char* font;
|
||||
uint32_t* vidmem;
|
||||
uint16_t bytesPerScanline;
|
||||
static char* font = (char*)0x6000;
|
||||
|
||||
static struct cursor_s cursor = { 0, 0 };
|
||||
|
||||
void setupScreen() {
|
||||
vidmem = *(uint32_t**)(MODE_INFO_BLOCK + 40); // Vidmem pointer location
|
||||
bytesPerScanline = *(uint16_t*)(MODE_INFO_BLOCK + 16); // Bytes per scanline location
|
||||
}
|
||||
|
||||
// TODO: Probably make the font bigger in a better way, but this works for now
|
||||
void putcAt(unsigned char c, uint32_t x, uint32_t y) {
|
||||
uint32_t* vidmem = *(uint32_t**)(MODE_INFO_BLOCK + 40);
|
||||
uint32_t offset = (WIDTH * y * 16 + x * 8) * 2;
|
||||
|
||||
char* bitmap = &font[((c % 128) - 1) * 16];
|
||||
@@ -73,6 +67,8 @@ void print(const char* str) {
|
||||
}
|
||||
|
||||
void clear() {
|
||||
uint32_t* vidmem = *(uint32_t**)(MODE_INFO_BLOCK + 40);
|
||||
|
||||
size_t i = 0;
|
||||
while (i < WIDTH*HEIGHT) {
|
||||
vidmem[i] = BG_COLOR; // #1f2937
|
||||
@@ -83,8 +79,4 @@ void clear() {
|
||||
cursor.y = 0;
|
||||
}
|
||||
|
||||
void loadFont(char* address) {
|
||||
font = address;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user