After C Switch

This commit is contained in:
2024-03-08 19:30:37 +01:00
parent 2f3b4f6e6b
commit 8062dc98af
15 changed files with 180 additions and 1470 deletions
+9
View File
@@ -0,0 +1,9 @@
[bits 32]
[global _start]
[extern main]
_start:
call main
cli
hlt
+6
View File
@@ -0,0 +1,6 @@
#include "screen.h"
void main() {
print("Hello, World!", 0x0f);
}
+21
View File
@@ -0,0 +1,21 @@
#include "screen.h"
unsigned int cursor = 0;
void putc(char c, char attr) {
int mem = VIDMEM + cursor * 2;
*(char*)(mem) = c;
*(char*)(mem+1) = attr;
cursor++;
}
void print(char* s, char attr) {
int i = 0;
char c = *s;
while (c != '\0') {
putc(c, attr);
c = *(s + ++i);
}
}
+9
View File
@@ -0,0 +1,9 @@
#ifndef SCREEN_H
#define SCREEN_H
#define VIDMEM 0xb8000
void putc(char c, char attr);
void print(char* s, char attr);
#endif