Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# BaseOS Makefile

AS = nasm
CC = /opt/homebrew/opt/x86_64-elf-gcc/bin/x86_64-elf-gcc
LD = /opt/homebrew/opt/x86_64-elf-binutils/bin/x86_64-elf-ld
OBJCOPY = /opt/homebrew/opt/x86_64-elf-binutils/bin/x86_64-elf-objcopy
CC = x86_64-elf-gcc
LD = x86_64-elf-ld
OBJCOPY = x86_64-elf-objcopy

CFLAGS = -std=gnu99 -ffreestanding -O0 -g -Wall -Wextra -m32 -nostdlib -I.
ASFLAGS = -f elf
Expand Down Expand Up @@ -33,7 +33,7 @@ baseos.img: boot.bin kernel.bin
rm baseos.img.tmp

run: baseos.img
qemu-system-i386 -drive file=baseos.img,format=raw,index=0,if=floppy -serial file:serial.out -no-reboot -display cocoa -d int,cpu_reset,guest_errors -D qemu_log.txt
qemu-system-i386 -drive file=baseos.img,format=raw,index=0,if=floppy -serial file:serial.out -no-reboot -d int,cpu_reset,guest_errors -D qemu_log.txt

clean:
rm -f boot.bin kernel.o kernel_entry.o kernel.elf kernel.bin baseos.img baseos.img.tmp *.o serial.out qemu_log.txt
Expand Down
42 changes: 41 additions & 1 deletion font.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

#include <stdint.h>

// 5x7 Bitmap Font
// 5x7 Bitmap Font (column-encoded, LSB = top row)

// A-Z
const uint8_t font_alpha[26][5] = {
{0x7E, 0x09, 0x09, 0x09, 0x7E}, // A
Expand Down Expand Up @@ -78,4 +79,43 @@ const uint8_t font_lower[26][5] = {
{0x44, 0x64, 0x54, 0x4C, 0x44} // z
};

// Symbols - indexed by struct lookup
struct FontSymbol {
char c;
uint8_t glyph[5];
};

const struct FontSymbol font_symbols[] = {
{'!', {0x00, 0x00, 0x5F, 0x00, 0x00}},
{'"', {0x00, 0x07, 0x00, 0x07, 0x00}},
{'#', {0x14, 0x7F, 0x14, 0x7F, 0x14}},
{'\'', {0x00, 0x05, 0x03, 0x00, 0x00}},
{'(', {0x00, 0x1C, 0x22, 0x41, 0x00}},
{')', {0x00, 0x41, 0x22, 0x1C, 0x00}},
{'*', {0x14, 0x08, 0x3E, 0x08, 0x14}},
{'+', {0x08, 0x08, 0x3E, 0x08, 0x08}},
{',', {0x00, 0x50, 0x30, 0x00, 0x00}},
{'-', {0x08, 0x08, 0x08, 0x08, 0x08}},
{'.', {0x00, 0x60, 0x60, 0x00, 0x00}},
{'/', {0x20, 0x10, 0x08, 0x04, 0x02}},
{':', {0x00, 0x36, 0x36, 0x00, 0x00}},
{';', {0x00, 0x56, 0x36, 0x00, 0x00}},
{'<', {0x08, 0x14, 0x22, 0x41, 0x00}},
{'=', {0x14, 0x14, 0x14, 0x14, 0x14}},
{'>', {0x00, 0x41, 0x22, 0x14, 0x08}},
{'?', {0x02, 0x01, 0x51, 0x09, 0x06}},
{'@', {0x32, 0x49, 0x79, 0x41, 0x3E}},
{'[', {0x00, 0x7F, 0x41, 0x41, 0x00}},
{'\\', {0x02, 0x04, 0x08, 0x10, 0x20}},
{']', {0x00, 0x41, 0x41, 0x7F, 0x00}},
{'^', {0x04, 0x02, 0x01, 0x02, 0x04}},
{'_', {0x40, 0x40, 0x40, 0x40, 0x40}},
{'{', {0x00, 0x08, 0x36, 0x41, 0x00}},
{'|', {0x00, 0x00, 0x7F, 0x00, 0x00}},
{'}', {0x00, 0x41, 0x36, 0x08, 0x00}},
{'~', {0x04, 0x02, 0x04, 0x08, 0x04}},
};

#define FONT_SYMBOL_COUNT (sizeof(font_symbols) / sizeof(font_symbols[0]))

#endif
Loading