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:
parent
b3ef53ccab
commit
c8851baea6
@ -1,5 +1,5 @@
|
|||||||
megs: 32
|
megs: 32
|
||||||
display_library: sdl
|
display_library: x
|
||||||
romimage: file=/usr/share/bochs/BIOS-bochs-latest
|
romimage: file=/usr/share/bochs/BIOS-bochs-latest
|
||||||
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest
|
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest
|
||||||
ata0-master: type=cdrom, path=os.iso, status=inserted
|
ata0-master: type=cdrom, path=os.iso, status=inserted
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// | 15-8 | 7-4 | 0-3
|
// | 15-8 | 7-4 | 0-3
|
||||||
// | Asci | FG | BG
|
// | Asci | FG | BG
|
||||||
#include "framebuffer.h"
|
#include "framebuffer.h"
|
||||||
#include "io.h"
|
//#include "io.h"
|
||||||
|
|
||||||
static char* Frame_Buffer = (char*)FRAME_BUFFER_ADDR;
|
static char* Frame_Buffer = (char*)FRAME_BUFFER_ADDR;
|
||||||
//static char* Frame_Buffer_End = (char*)(FRAME_BUFFER_ADDR + AREA);
|
//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) {
|
for(unsigned cell=0;cell<AREA; cell+=2) {
|
||||||
write_cell_fb(cell, ' ', 0x00, 0x00);
|
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_CMD, FB_LOW_CMD);
|
||||||
out_buffer(FB_DATA, position & 0x00ff);
|
out_buffer(FB_DATA, position & 0x00ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* generic test func for this module */
|
/* generic test func for this module */
|
||||||
void test_fb() {
|
void test_fb(void) {
|
||||||
clear_fb();
|
clear_fb();
|
||||||
write_cell_fb(FRAME_CELL(0), 'a', Green, White);
|
write_cell_fb(FRAME_CELL(0), 'a', Green, White);
|
||||||
write_cell_fb(FRAME_CELL(1), 'b', 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(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);
|
fb_move_cursor(5);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#include "stl/string.h"
|
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
#define COLUMNS 80
|
#define COLUMNS 80
|
||||||
@ -12,8 +11,6 @@
|
|||||||
#define FB_HIGH_CMD 14
|
#define FB_HIGH_CMD 14
|
||||||
#define FB_LOW_CMD 15
|
#define FB_LOW_CMD 15
|
||||||
|
|
||||||
void fb_move_cursor(unsigned short position);
|
|
||||||
|
|
||||||
// address of our frame buffer
|
// address of our frame buffer
|
||||||
#define FRAME_BUFFER_ADDR 0x000B8000
|
#define FRAME_BUFFER_ADDR 0x000B8000
|
||||||
|
|
||||||
@ -38,11 +35,13 @@ void fb_move_cursor(unsigned short position);
|
|||||||
#define LightBrown 0x0e
|
#define LightBrown 0x0e
|
||||||
#define White 0x0f
|
#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 */
|
/* Testing function because yote squad in here yeye */
|
||||||
void test_fb();
|
void test_fb(void);
|
||||||
|
4
io.h
4
io.h
@ -1,6 +1,6 @@
|
|||||||
#ifndef INCLUDE_IO_H
|
#ifndef INCLUDE_IO_H
|
||||||
#define 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 */
|
||||||
|
10
makefile
10
makefile
@ -3,7 +3,7 @@ ASM=nasm
|
|||||||
LINK=ld
|
LINK=ld
|
||||||
ISO=genisoimage
|
ISO=genisoimage
|
||||||
|
|
||||||
OBJECTS=loader.o framebuffer.o
|
OBJECTS=loader.o framebuffer.o io.o
|
||||||
AFLAGS=-f elf32
|
AFLAGS=-f elf32
|
||||||
CFLAGS=-m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles \
|
CFLAGS=-m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles \
|
||||||
-nodefaultlibs -Wall -Wextra -Werror -c
|
-nodefaultlibs -Wall -Wextra -Werror -c
|
||||||
@ -28,14 +28,14 @@ os.iso: kernel.elf
|
|||||||
-o os.iso \
|
-o os.iso \
|
||||||
iso
|
iso
|
||||||
|
|
||||||
|
# Builind asm objects
|
||||||
|
%.o: %.s
|
||||||
|
$(ASM) $(AFLAGS) $< -o $@
|
||||||
|
|
||||||
# Building C objecets
|
# Building C objecets
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
# Builind asm objects
|
|
||||||
%.o: %.asm
|
|
||||||
$(ASM) $(AFLAGS) $< -o $@
|
|
||||||
|
|
||||||
# Running (no recipes called)
|
# Running (no recipes called)
|
||||||
run: os.iso
|
run: os.iso
|
||||||
bochs -f bochsrc.conf -q
|
bochs -f bochsrc.conf -q
|
||||||
|
Loading…
Reference in New Issue
Block a user