From 9fd38360a5b94c3d9dddf54f088e27f8da2207e6 Mon Sep 17 00:00:00 2001 From: Kyle Cardoza Date: Fri, 29 Mar 2024 01:42:23 -0400 Subject: [PATCH] Begun implementing VERA sprite API --- include/drivers/vera.h | 9 ++ include/drivers/vera_sprites.h | 69 ++++++++++++++ src/drivers/vera_sprites.c | 164 +++++++++++++++++++++++++++++++++ 3 files changed, 242 insertions(+) create mode 100644 include/drivers/vera_sprites.h create mode 100644 src/drivers/vera_sprites.c diff --git a/include/drivers/vera.h b/include/drivers/vera.h index 5c0e1d1..9a24a92 100644 --- a/include/drivers/vera.h +++ b/include/drivers/vera.h @@ -10,6 +10,8 @@ #include #include +#include "config.h" + typedef enum { ADDR_INCREMENT_0 = 0, ADDR_INCREMENT_1 = 1, @@ -29,6 +31,13 @@ typedef enum { ADDR_INCREMENT_640 = 15 } VeraAddressIncrement; +typedef enum { + VERA_DEPTH_1BPP, + VERA_DEPTH_2BPP, + VERA_DEPTH_4BPP, + VERA_DEPTH_8BPP +} VeraBitDepth; + typedef union vera_palette_entry_s { struct { uint8_t blue: 4; diff --git a/include/drivers/vera_sprites.h b/include/drivers/vera_sprites.h new file mode 100644 index 0000000..cd50988 --- /dev/null +++ b/include/drivers/vera_sprites.h @@ -0,0 +1,69 @@ +//***************************************************************************** +// Sentinel 65X Kernel +// +// include/drivers/vera_sprites.h +//***************************************************************************** + +#pragma once + +#include +#include +#include + +#include "config.h" + +#include "drivers/vera.h" + +typedef enum { + SPRITE_ORDER_DISABLE, + SPRITE_ORDER_BOTTOM, + SPRITE_ORDER_MID, + SPRITE_ORDER_TOP +} VeraSpriteZOrder; + +typedef enum { + SPRITE_SIZE_8, + SPRITE_SIZE_16, + SPRITE_SIZE_32, + SPRITE_SIZE_64, +} VeraSpriteSize; + +void vera_sprite_set_bitmap_address(uint8_t index, uint32_t address); + +uint32_t vera_sprite_get_bitmap_address(uint8_t index); + +void vera_sprite_set_bit_depth(uint8_t index, VeraBitDepth depth); + +VeraBitDepth vera_sprite_get_bit_depth(uint8_t index); + +void vera_sprite_set_z_order(uint8_t index, VeraSpriteZOrder order); + +VeraSpriteZOrder vera_sprite_get_z_order(uint8_t index); + +void vera_sprite_set_x_position(uint8_t index, uint16_t position); + +uint16_t vera_sprite_get_x_position(uint8_t index); + +void vera_sprite_set_y_position(uint8_t index, uint16_t position); + +uint16_t vera_sprite_get_y_position(uint8_t index); + +void vera_sprite_set_h_flip(uint8_t index, bool state); + +bool vera_sprite_get_h_flip(uint8_t index); + +void vera_sprite_set_v_flip(uint8_t index, bool state); + +bool vera_sprite_get_v_flip(uint8_t index); + +void vera_sprite_set_width(uint8_t index, VeraSpriteSize size); + +VeraSpriteSize vera_sprite_get_width(uint8_t index); + +void vera_sprite_set_height(uint8_t index, VeraSpriteSize size); + +VeraSpriteSize vera_sprite_get_height(uint8_t index); + +void vera_sprite_set_palette_offset(uint8_t index, uint8_t value); + +uint8_t vera_sprite_get_palette_offset(uint8_t index); diff --git a/src/drivers/vera_sprites.c b/src/drivers/vera_sprites.c new file mode 100644 index 0000000..d6f6b5e --- /dev/null +++ b/src/drivers/vera_sprites.c @@ -0,0 +1,164 @@ +//***************************************************************************** +// Sentinel 65X Kernel +// +// src/drivers/vera_sprites.c +//***************************************************************************** + +#include +#include +#include + +#include "config.h" +#include "drivers/vera.h" +#include "drivers/vera_sprites.h" + + +void +vera_sprite_set_bitmap_address(uint8_t index, uint32_t address) +{ + (void) index; + (void) address; + +} + +uint32_t +vera_sprite_get_bitmap_address(uint8_t index) +{ + (void) index; + return 0; +} + +void +vera_sprite_set_bit_depth(uint8_t index, VeraBitDepth depth) +{ + (void) index; + (void) depth; + +} + +VeraBitDepth +vera_sprite_get_bit_depth(uint8_t index) +{ + (void) index; + return VERA_DEPTH_1BPP; +} + +void +vera_sprite_set_z_order(uint8_t index, VeraSpriteZOrder order) +{ + (void) index; + (void) order; + +} + +VeraSpriteZOrder +vera_sprite_get_z_order(uint8_t index) +{ + (void) index; + return SPRITE_ORDER_BOTTOM; +} + +void +vera_sprite_set_x_position(uint8_t index, uint16_t position) +{ + (void) index; + (void) position; + +} + +uint16_t +vera_sprite_get_x_position(uint8_t index) +{ + (void) index; + return 0; +} + +void +vera_sprite_set_y_position(uint8_t index, uint16_t position) +{ + (void) index; + (void) position; + +} + +uint16_t +vera_sprite_get_y_position(uint8_t index) +{ + (void) index; + return 0; +} + +void +vera_sprite_set_h_flip(uint8_t index, bool state) +{ + (void) index; + (void) state; + +} + +bool +vera_sprite_get_h_flip(uint8_t index) +{ + (void) index; + return false; +} + +void +vera_sprite_set_v_flip(uint8_t index, bool state) +{ + (void) index; + (void) state; + +} + +bool +vera_sprite_get_v_flip(uint8_t index) +{ + (void) index; + return false; +} + +void +vera_sprite_set_width(uint8_t index, VeraSpriteSize size) +{ + (void) index; + (void) size; + +} + +VeraSpriteSize +vera_sprite_get_width(uint8_t index) +{ + (void) index; + return SPRITE_SIZE_8; +} + +void +vera_sprite_set_height(uint8_t index, VeraSpriteSize size) +{ + (void) index; + (void) size; + +} + +VeraSpriteSize +vera_sprite_get_height(uint8_t index) +{ + (void) index; + return SPRITE_SIZE_8; +} + +void +vera_sprite_set_palette_offset(uint8_t index, uint8_t value) +{ + (void) index; + (void) value; + +} + +uint8_t +vera_sprite_get_palette_offset(uint8_t index) +{ + (void) index; + return 0; +}