Added dependency generation in Makefiles.

This commit is contained in:
Kyle Cardoza 2024-03-28 00:34:39 -04:00
parent 3994a78ce5
commit 01759c3d99
6 changed files with 714 additions and 202 deletions

781
build.lst

File diff suppressed because it is too large Load Diff

View File

@ -57,14 +57,6 @@ endif
LIBS := build/libc.a
%.o: %.c
@echo "Compiling $@..."
@$(CC) -c $(CFLAGS) -o $@ $<
%.o: %.s
@echo "Assembling $@)..."
@$(AS) $(ASFLAGS) -o $@ $<
KERNEL_SRC_C := $(wildcard src/*.c) \
$(wildcard src/*/*.c) \
$(wildcard src/*/*/*.c) \
@ -77,3 +69,4 @@ KERNEL_SRC_S := $(wildcard src/*.s) \
$(wildcard src/*/*/*/*/*.s)
KERNEL_OBJ := $(KERNEL_SRC_C:.c=.o) \
$(KERNEL_SRC_S:.s=.o)
KERNEL_DEP := $(KERNEL_SRC_C:.c=.d)

View File

@ -12,9 +12,25 @@ clean:
\) -delete
@find src -type f \( \
-name '*.o' -o \
-name '*.d' -o \
-name '$(TARGET)' \
\) -delete
%.o: %.c
@echo "Compiling $@..."
@$(CC) -c $(CFLAGS) -o $@ $<
%.o: %.s
@echo "Assembling $@)..."
@$(AS) $(ASFLAGS) -o $@ $<
%.d: %.c
@echo "Generating dependencies for $<"
@printf '%s' "$(dir $@)" > $@
@$(CC) $(CFLAGS) --dependencies $< >> $@
build/kernel.bin: $(KERNEL_OBJ)
@echo "Linking $@..."
@$(LD) -o $@ $(LDFLAGS) $^
-include $(KERNEL_DEP)

21
include/drivers/vera.h Normal file
View File

@ -0,0 +1,21 @@
//*****************************************************************************
// Sentinel 65X Kernel
//
// include/drivers/vera.h
//*****************************************************************************
#pragma once
#include <stdint.h>
far void vera_init(void);
far uint8_t vera_peek(uint32_t addr);
far void vera_poke(uint32_t addr, uint8_t value);
far void vera_poke16(uint32_t addr, uint16_t value);
far void _vera_set_bgcolor(uint8_t color);
#define vera_set_bgcolor(X) _vera_set_bgcolor((X))
#define vera_set_bgcolour(X) _vera_set_bgcolor((X))

85
src/drivers/vera.c Normal file
View File

@ -0,0 +1,85 @@
//*****************************************************************************
// Sentinel 65X Kernel
//
// src/drivers/vera.c
//*****************************************************************************
#include <stdint.h>
#include "config.h"
#include "drivers/vera.h"
typedef struct vera_s *VERA;
struct vera_s {
uint8_t addr_x_l;
uint8_t addr_x_m;
uint8_t addr_x_h;
union {
uint8_t data[2];
uint16_t data16;
};
uint8_t ctrl;
uint8_t ien;
uint8_t isr;
union {
uint8_t irq_line_l;
uint8_t const scanline_l;
};
};
VERA vera = (VERA)(0x00df00);
far void
vera_init(void)
{
}
far uint8_t
vera_peek(uint32_t addr)
{
(void) addr;
// Set addrsel to 0
uint8_t asel = vera->ctrl;
vera->ctrl = asel & 0b11111110;
// Set address
vera->addr_x_l = addr & 0x000000FF;
vera->addr_x_m = (addr & 0x0000FF00) >> 8;
vera->addr_x_h = vera->addr_x_h & 0b11111110;
vera->addr_x_h = vera->addr_x_h | (addr & ((uint32_t)(1) << 16));
return vera->data[0];
}
far void
vera_poke(uint32_t addr, uint8_t value)
{
(void) addr;
// Set addrsel to 0
uint8_t asel = vera->ctrl;
vera->ctrl = asel & 0b11111110;
// Set address
vera->addr_x_l = addr & 0x000000FF;
vera->addr_x_m = (addr & 0x0000FF00) >> 8;
vera->addr_x_h = vera->addr_x_h & 0b11111110;
vera->addr_x_h = vera->addr_x_h | (addr & ((uint32_t)(1) << 16));
vera->data[0] = value;
return;
}
far void
_vera_set_bgcolor(uint8_t color)
{
(void) color;
return;
}

View File

@ -6,8 +6,12 @@
#include "config.h"
#include "drivers/vera.h"
void
main(void)
{
vera_init();
for (;;) {}
}