code fixed and stiupid build

This commit is contained in:
Agnosto Dvonik 2024-02-17 19:16:13 -05:00
parent 97e88b2fe3
commit d9553eebe3
9 changed files with 39 additions and 12 deletions

11
Makescript Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env sh
INCLUDE="-Isys/drv/vga/include -Isys/include"
CFLAGS="-g -m32 -ffreestanding -Wall -Wextra -pedantic -nostdlib $INCLUDE"
ASFLAGS="-felf32"
LDFLAGS="-m elf_i386"
cc $CFLAGS -c sys/drv/vga/video.c -o obj/vga.o
cc $CFLAGS -c sys/sysinit.c -o obj/sysinit.o
nasm $ASFLAGS boot/boot.s -o obj/boot.o
ld $LDFLAGS -T boot/link.ld -o omos obj/boot.o obj/vga.o obj/sysinit.o

5
boot/Makefile Normal file
View File

@ -0,0 +1,5 @@
AS=nasm
FLAGS=-felf32
boot.o:
$(AS) $(FLAGS) boot.s -o boot.o

View File

@ -1,15 +1,12 @@
; only support mb1 ; only support mb1
align equ 1 << 0
info equ 1 << 1 bits 32
flags equ align | info
magic equ 0x1BADB002
chksum equ - (magic + flags)
section .multiboot section .multiboot
align 4 align 4
dd magic dd 0x1badb002
dd flags dd 0x00
dd chksum dd - (0x1badb002 + 0x00)
global _start global _start
extern sysinit extern sysinit

9
link.ld Normal file
View File

@ -0,0 +1,9 @@
OUTPUT_FORMAT(elf32-i386)
ENTRY(_start)
SECTIONS
{
. = 0x100000;
.text : {*(.text)}
.data : {*(.data)}
.bss : {*(.bss)}
}

BIN
omos Executable file

Binary file not shown.

View File

@ -1,4 +1,5 @@
include sys/drv/vga/Makefile include sys/drv/vga/Makefile
CC=cc CC=cc
FLAGS=-Wall -c -g -Wextra -ffreestanding -m32 -nostdlib FLAGS=-Wall -c -g -Wextra -ffreestanding -m32 -nostdlib
SRCS=$(wildcard sys/*.c) SRCS=$(wildcard sys/*.c)

View File

@ -8,6 +8,6 @@
s8 *vga_vidmem = (s8 *)0xb8000; s8 *vga_vidmem = (s8 *)0xb8000;
void vga_write(s8 *, s8); void vga_write(s8 *, s8);
void vga_clearscreen(); void vga_clearscreen(void);
#endif #endif

View File

@ -15,7 +15,9 @@ vga_write(s8 *sequence, s8 flags)
} }
} }
void vga_clearscreen() { void
vga_clearscreen(void)
{
for (int i = 0; i <= SIZE; i++) { for (int i = 0; i <= SIZE; i++) {
vga_vidmem[i] = 0; vga_vidmem[i] = 0;
} }

View File

@ -1,4 +1,6 @@
void void
sysinit() { sysinit(void)
write("Om Smart.", 0x0F, 10); {
vga_clearscreen();
vga_write("Om Smart.", 0x0F);
} }