15#undef PICO9918_DLLEXPORT
16#define PICO9918_DLLEXPORT
19#undef PICO9918_DLLEXPORT_CONST
20#define PICO9918_DLLEXPORT_CONST
24#define LAST_SPRITE_YPOS 0xD0
53 for (
int i = 0; i < 32; ++i)
102 for (
int i = 0; i < 768; ++i)
void pico9918_write_data(pico9918_t *tms9918, uint8_t data)
write data (mode = 0) to the tms9918
#define TMS_R1_MODE_GRAPHICS_I
Graphics I - no bit of its own in R1.
#define TMS_R1_RAM_16K
register 1 bits: VRAM size, blanking, interrupt, mode and sprite size
#define PICO9918_INST_ONLY
pass the instance as the only argument
#define TMS_R0_MODE_GRAPHICS_I
register 0 bits: mode selection and the external VDP input.
#define TMS_R1_DISP_ACTIVE
render the active display
#define TMS_R0_MODE_GRAPHICS_II
Graphics II - the only mode R0 selects.
#define TMS_R0_EXT_VDP_DISABLE
ignore the external VDP input
#define PICO9918_INST_ONLY_ARG
declare the instance as the only parameter
#define TMS_R1_INT_ENABLE
assert /INT at end of frame
#define TMS_R1_MODE_GRAPHICS_II
Graphics II - selected in R0.
#define PICO9918_INST
pass the instance ahead of other arguments
#define PICO9918_DLLEXPORT
the linkage every public entry point carries - see LINKAGE MODES above
PICO9918_DLLEXPORT void pico9918_initialise_gfx_ii(pico9918_t *tms9918)
as pico9918_initialise_gfx_i(), but for Graphics II and with the name table filled with a rising patt...
PICO9918_DLLEXPORT_CONST uint32_t pico9918_palette[]
the sixteen TMS9918 colours, each packed as 0xrrggbbaa
static void clearTmsRam(pico9918_t *tms9918)
zero the 16KB of VRAM, then park all 32 sprites past the end of the list
#define LAST_SPRITE_YPOS
the sprite Y value that terminates the sprite list
PICO9918_DLLEXPORT void pico9918_initialise_gfx_i(pico9918_t *tms9918)
program Graphics I, the default table addresses and black on cyan, then clear VRAM
pico9918-core - utility / helper functions
#define TMS_DEFAULT_VRAM_PATT_ADDRESS
pattern table (R4)
#define TMS_DEFAULT_VRAM_COLOR_ADDRESS
colour table (R3)
static void pico9918_set_address_write(pico9918_t *tms9918, uint16_t addr)
point the VRAM address register at addr for writing, ie.
static void pico9918_set_fg_bg_color(pico9918_t *tms9918, pico9918_color_t fg, pico9918_color_t bg)
set register 7, the text-mode foreground colour and the backdrop
static void pico9918_set_color_table_addr(pico9918_t *tms9918, uint16_t addr)
set the colour table address, which register 3 holds in 64-byte units
static void pico9918_set_sprite_patt_table_addr(pico9918_t *tms9918, uint16_t addr)
set the sprite pattern table address, which register 6 holds in 2KB units
static void pico9918_set_name_table_addr(pico9918_t *tms9918, uint16_t addr)
set the name table address, which register 2 holds in 1KB units
static void pico9918_set_sprite_attr_table_addr(pico9918_t *tms9918, uint16_t addr)
set the sprite attribute table address, which register 5 holds in 128-byte units
#define TMS_DEFAULT_VRAM_SPRITE_PATT_ADDRESS
sprite pattern table (R6)
static void pico9918_write_byte_rpt(pico9918_t *tms9918, uint8_t byte, size_t rpt)
write byte to VRAM rpt times from the current address
static void pico9918_write_register_value(pico9918_t *tms9918, pico9918_register_t reg, uint8_t value)
write a VDP register as a host would, value byte first
#define TMS_DEFAULT_VRAM_NAME_ADDRESS
the VRAM table layout pico9918_initialise_gfx_i() and GfxII() program
#define TMS_DEFAULT_VRAM_SPRITE_ATTR_ADDRESS
sprite attribute table (R5)
static void pico9918_set_pattern_table_addr(pico9918_t *tms9918, uint16_t addr)
set the pattern table address, which register 4 holds in 2KB units