diff --git a/src/userland/vga/Makefile b/src/userland/vga/Makefile index c09b032..4fd29b8 100644 --- a/src/userland/vga/Makefile +++ b/src/userland/vga/Makefile @@ -7,7 +7,7 @@ BUILD_FOLDER = build -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) +SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) ../../../initrd/vga: $(OBJS) ../../../build/hlib.o diff --git a/src/userland/vga/Makefile b/src/userland/vga/Makefile index c09b032..4fd29b8 100644 --- a/src/userland/vga/Makefile +++ b/src/userland/vga/Makefile @@ -7,7 +7,7 @@ BUILD_FOLDER = build -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) +SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) ../../../initrd/vga: $(OBJS) ../../../build/hlib.o diff --git a/src/userland/vga/cursor.c b/src/userland/vga/cursor.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/userland/vga/cursor.c diff --git a/src/userland/vga/Makefile b/src/userland/vga/Makefile index c09b032..4fd29b8 100644 --- a/src/userland/vga/Makefile +++ b/src/userland/vga/Makefile @@ -7,7 +7,7 @@ BUILD_FOLDER = build -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) +SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) ../../../initrd/vga: $(OBJS) ../../../build/hlib.o diff --git a/src/userland/vga/cursor.c b/src/userland/vga/cursor.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/userland/vga/cursor.c diff --git a/src/userland/vga/include/color.h b/src/userland/vga/include/color.h new file mode 100644 index 0000000..7b29690 --- /dev/null +++ b/src/userland/vga/include/color.h @@ -0,0 +1,25 @@ +#ifndef COLOR_H +#define COLOR_H + +#define COLOR(foreground, background) (foreground | background << 4) + +enum { + black = 0, + blue = 1, + green = 2, + cyan = 3, + red = 4, + magenta = 5, + brown = 6, + lightGray = 7, + darkGray = 8, + lightBlue = 9, + lightGreen = 10, + lightCyan = 11, + lightRed = 12, + lightMagenta = 13, + yellow = 14, + white = 15, +} color; + +#endif diff --git a/src/userland/vga/Makefile b/src/userland/vga/Makefile index c09b032..4fd29b8 100644 --- a/src/userland/vga/Makefile +++ b/src/userland/vga/Makefile @@ -7,7 +7,7 @@ BUILD_FOLDER = build -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) +SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) ../../../initrd/vga: $(OBJS) ../../../build/hlib.o diff --git a/src/userland/vga/cursor.c b/src/userland/vga/cursor.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/userland/vga/cursor.c diff --git a/src/userland/vga/include/color.h b/src/userland/vga/include/color.h new file mode 100644 index 0000000..7b29690 --- /dev/null +++ b/src/userland/vga/include/color.h @@ -0,0 +1,25 @@ +#ifndef COLOR_H +#define COLOR_H + +#define COLOR(foreground, background) (foreground | background << 4) + +enum { + black = 0, + blue = 1, + green = 2, + cyan = 3, + red = 4, + magenta = 5, + brown = 6, + lightGray = 7, + darkGray = 8, + lightBlue = 9, + lightGreen = 10, + lightCyan = 11, + lightRed = 12, + lightMagenta = 13, + yellow = 14, + white = 15, +} color; + +#endif diff --git a/src/userland/vga/include/cursor.h b/src/userland/vga/include/cursor.h new file mode 100644 index 0000000..9f43270 --- /dev/null +++ b/src/userland/vga/include/cursor.h @@ -0,0 +1,4 @@ +#ifndef CURSOR_H +#define CURSOR_H + +#endif diff --git a/src/userland/vga/Makefile b/src/userland/vga/Makefile index c09b032..4fd29b8 100644 --- a/src/userland/vga/Makefile +++ b/src/userland/vga/Makefile @@ -7,7 +7,7 @@ BUILD_FOLDER = build -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) +SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) ../../../initrd/vga: $(OBJS) ../../../build/hlib.o diff --git a/src/userland/vga/cursor.c b/src/userland/vga/cursor.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/userland/vga/cursor.c diff --git a/src/userland/vga/include/color.h b/src/userland/vga/include/color.h new file mode 100644 index 0000000..7b29690 --- /dev/null +++ b/src/userland/vga/include/color.h @@ -0,0 +1,25 @@ +#ifndef COLOR_H +#define COLOR_H + +#define COLOR(foreground, background) (foreground | background << 4) + +enum { + black = 0, + blue = 1, + green = 2, + cyan = 3, + red = 4, + magenta = 5, + brown = 6, + lightGray = 7, + darkGray = 8, + lightBlue = 9, + lightGreen = 10, + lightCyan = 11, + lightRed = 12, + lightMagenta = 13, + yellow = 14, + white = 15, +} color; + +#endif diff --git a/src/userland/vga/include/cursor.h b/src/userland/vga/include/cursor.h new file mode 100644 index 0000000..9f43270 --- /dev/null +++ b/src/userland/vga/include/cursor.h @@ -0,0 +1,4 @@ +#ifndef CURSOR_H +#define CURSOR_H + +#endif diff --git a/src/userland/vga/main.c b/src/userland/vga/main.c index 007e2f4..e64dc91 100644 --- a/src/userland/vga/main.c +++ b/src/userland/vga/main.c @@ -1,9 +1,20 @@ +#include #include #include #include +char *string = "test"; +uint16_t *videoSource; + +void writeChar(char character, char colorCode) { + *videoSource = ((uint16_t)colorCode << 8) | character; + videoSource++; +} + int32_t main() { - uint32_t *videoSource = requestMemory(1, NULL, PTR(0xB8000)); - *videoSource = 0x07690748; + videoSource = requestMemory(1, NULL, PTR(0xB8000)); + for (uint32_t i = 0; string[i]; i++) { + writeChar(string[i], COLOR(white, black)); + } return 0; }