1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-30 20:08:06 +11:00
collapseos/emul/z80/tms9918.h
Virgil Dupras d1718a90c7 sms: add support for VDP's text mode
Because that mode behaves exactly like in a regular TMS9918, a new
driver for TMS9918 has been added in blkfs and SMS' VDP now uses it.

Also, fix broken 5x7 font.
2020-11-13 12:18:00 -05:00

27 lines
632 B
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#define TMS_VRAM_SIZE 0x4000
// Offset of the name table
#define TMS_NTABLE_OFFSET 0x3800
typedef struct {
uint8_t vram[TMS_VRAM_SIZE];
uint8_t regs[0x10];
uint8_t cmdlsb;
bool has_cmdlsb;
uint16_t curaddr;
uint16_t width; // in pixels
uint16_t height; // in pixels
} TMS9918;
void tms_init(TMS9918 *tms);
uint8_t tms_cmd_rd(TMS9918 *tms);
void tms_cmd_wr(TMS9918 *tms, uint8_t val);
uint8_t tms_data_rd(TMS9918 *tms);
void tms_data_wr(TMS9918 *tms, uint8_t val);
// result is a RGB value
uint8_t tms_pixel(TMS9918 *tms, uint16_t x, uint16_t y);