Structure:

renamed .asm files to .s extension

Makefile:
	Building .s first over

Bochs conf:
	changed display server to x instead of sdl

Changed function defs to not have the parameter names for less confusion
This commit is contained in:
shockrah 2019-09-14 23:42:49 -07:00
parent b3ef53ccab
commit c8851baea6
7 changed files with 18 additions and 21 deletions

View File

@ -1,5 +1,5 @@
megs: 32
display_library: sdl
display_library: x
romimage: file=/usr/share/bochs/BIOS-bochs-latest
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest
ata0-master: type=cdrom, path=os.iso, status=inserted

View File

@ -6,7 +6,7 @@
// | 15-8 | 7-4 | 0-3
// | Asci | FG | BG
#include "framebuffer.h"
#include "io.h"
//#include "io.h"
static char* Frame_Buffer = (char*)FRAME_BUFFER_ADDR;
//static char* Frame_Buffer_End = (char*)(FRAME_BUFFER_ADDR + AREA);
@ -21,7 +21,7 @@ void write_cell_fb(unsigned cell, char c, char fg, char bg) {
}
void clear_fb() {
void clear_fb(void) {
for(unsigned cell=0;cell<AREA; cell+=2) {
write_cell_fb(cell, ' ', 0x00, 0x00);
}
@ -33,14 +33,12 @@ void fb_move_cursor(unsigned short position) {
out_buffer(FB_CMD, FB_LOW_CMD);
out_buffer(FB_DATA, position & 0x00ff);
}
/* generic test func for this module */
void test_fb() {
void test_fb(void) {
clear_fb();
write_cell_fb(FRAME_CELL(0), 'a', Green, White);
write_cell_fb(FRAME_CELL(1), 'b', Green, White);
write_cell_fb(FRAME_CELL(2), 'c', Green, White);
write_cell_fb(FRAME_CELL(3), 'c', Green, White);
write_cell_fb(FRAME_CELL(4), 'c', Green, White);
write_cell_fb(FRAME_CELL(5), 'c', Green, White);
fb_move_cursor(5);
}

View File

@ -1,4 +1,3 @@
#include "stl/string.h"
#include "io.h"
#define COLUMNS 80
@ -12,8 +11,6 @@
#define FB_HIGH_CMD 14
#define FB_LOW_CMD 15
void fb_move_cursor(unsigned short position);
// address of our frame buffer
#define FRAME_BUFFER_ADDR 0x000B8000
@ -38,11 +35,13 @@ void fb_move_cursor(unsigned short position);
#define LightBrown 0x0e
#define White 0x0f
void write_cell_fb(unsigned cell, char c , char fg, char bg);
void write_cell_fb(unsigned, char, char, char);
void print_fb(char* str, unsigned position);
void print_fb(char*, unsigned);
void clear_fb();
void clear_fb(void);
void fb_move_cursor(unsigned short);
/* Testing function because yote squad in here yeye */
void test_fb();
void test_fb(void);

4
io.h
View File

@ -1,6 +1,6 @@
#ifndef INCLUDE_IO_H
#define INCLUDE_IO_H
void out_buffer(unsigned short port, unsigned char data);
void out_buffer(unsigned short, unsigned char);
#endif
#endif /* INCLUDE_IO_H */

View File

View File

@ -3,7 +3,7 @@ ASM=nasm
LINK=ld
ISO=genisoimage
OBJECTS=loader.o framebuffer.o
OBJECTS=loader.o framebuffer.o io.o
AFLAGS=-f elf32
CFLAGS=-m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles \
-nodefaultlibs -Wall -Wextra -Werror -c
@ -28,14 +28,14 @@ os.iso: kernel.elf
-o os.iso \
iso
# Builind asm objects
%.o: %.s
$(ASM) $(AFLAGS) $< -o $@
# Building C objecets
%.o: %.c
$(CC) $(CFLAGS) $< -o $@
# Builind asm objects
%.o: %.asm
$(ASM) $(AFLAGS) $< -o $@
# Running (no recipes called)
run: os.iso
bochs -f bochsrc.conf -q