First working VERA driver

This commit is contained in:
Kyle J Cardoza 2024-07-16 00:29:37 -04:00
parent b28dad5bf1
commit 9568958f90
2 changed files with 17 additions and 20 deletions

View File

@ -352,9 +352,23 @@ void vera_init(void);
void vera_reset(void); void vera_reset(void);
void vera_address_select(uint8_t value); static inline void vera_address_select(uint8_t value) {
uint8_t ctrl = vera_ctrl_read();
void vera_address_set(uint32_t address); if (value == 0) {
ctrl &= 0b11111110;
} else {
ctrl |= 0b00000001;
}
vera_ctrl_write(ctrl);
}
static inline void vera_address_set(uint32_t address) {
vera_addr_l_write(address & 0x0000FF);
vera_addr_m_write((address >> 8) & 0x0000FF);
vera_addr_h_write((address >> 16) & 0x0000FF);
}
void vera_mem_write(uint32_t dest, void *src, size_t length); void vera_mem_write(uint32_t dest, void *src, size_t length);

View File

@ -14,24 +14,6 @@ extern uint16_t *vera_palette;
extern uint8_t *vera_font_0; extern uint8_t *vera_font_0;
void vera_address_select(uint8_t value) {
uint8_t ctrl = vera_ctrl_read();
if (value == 0) {
ctrl &= 0b11111110;
} else {
ctrl |= 0b00000001;
}
vera_ctrl_write(ctrl);
}
void vera_address_set(uint32_t address) {
vera_addr_l_write(address & 0x000000FF);
vera_addr_m_write((address >> 8) & 0x000000FF);
vera_addr_h_write((address >> 16) & 0x000000FF);
}
void vera_mem_read(void *dest, uint32_t src, size_t length) { void vera_mem_read(void *dest, uint32_t src, size_t length) {
uint8_t *destination = dest; uint8_t *destination = dest;
@ -78,6 +60,7 @@ void vera_reset(void) {
} }
void vera_init(void) { void vera_init(void) {
vera_mem_write(VERA_PALETTE_BASE, &vera_palette, 0x200); vera_mem_write(VERA_PALETTE_BASE, &vera_palette, 0x200);
vera_mem_write(TEXT_CONSOLE_TILES, &vera_font_0, 0x1000); vera_mem_write(TEXT_CONSOLE_TILES, &vera_font_0, 0x1000);
vera_mem_set(TEXT_CONSOLE0_VRAM, 0x00, 0x4000); vera_mem_set(TEXT_CONSOLE0_VRAM, 0x00, 0x4000);