|
pico9918-core 1.3.0
TMS9918A / F18A video display processor emulation in C99
|
pico9918-core - utility / helper functions More...
Include dependency graph for pico9918_util.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Macros | |
| #define | TMS_DEFAULT_VRAM_NAME_ADDRESS 0x3800 |
| the VRAM table layout pico9918_initialise_gfx_i() and GfxII() program | |
| #define | TMS_DEFAULT_VRAM_COLOR_ADDRESS 0x0000 |
| colour table (R3) | |
| #define | TMS_DEFAULT_VRAM_PATT_ADDRESS 0x2000 |
| pattern table (R4) | |
| #define | TMS_DEFAULT_VRAM_SPRITE_ATTR_ADDRESS 0x3B00 |
| sprite attribute table (R5) | |
| #define | TMS_DEFAULT_VRAM_SPRITE_PATT_ADDRESS 0x1800 |
| sprite pattern table (R6) | |
Functions | |
| 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 | |
| static void | pico9918_set_address_read (pico9918_t *tms9918, uint16_t addr) |
point the VRAM address register at addr for reading | |
| 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_write_bytes (pico9918_t *tms9918, const uint8_t *bytes, size_t numBytes) |
| write a block of bytes to VRAM from the current address | |
| 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_string (pico9918_t *tms9918, const char *str) |
| write a string to VRAM, its terminator excluded | |
| static void | pico9918_write_string_offset (pico9918_t *tms9918, const char *str, uint8_t offset) |
write a string to VRAM with offset added to each character's pattern index | |
| static uint8_t | pico9918_fg_bg_color (pico9918_color_t fg, pico9918_color_t bg) |
pack fg into the high nibble and bg into the low nibble of one colour byte | |
| 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_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_pattern_table_addr (pico9918_t *tms9918, uint16_t addr) |
| set the pattern table address, which register 4 holds in 2KB 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 | |
| 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_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 | |
| void | pico9918_initialise_gfx_i (pico9918_t *tms9918) |
| set up Graphics I with the default table addresses and a cleared VRAM | |
| void | pico9918_initialise_gfx_ii (pico9918_t *tms9918) |
| set up Graphics II with the default table addresses and a cleared VRAM | |
Variables | |
| uint32_t | pico9918_palette [] |
| the sixteen TMS9918 colours, each packed as 0xrrggbbaa | |
pico9918-core - utility / helper functions
Copyright (c) 2022 Troy Schrapel
This code is licensed under the MIT license
https://github.com/visrealm/pico9918-core
Definition in file pico9918_util.h.
| #define TMS_DEFAULT_VRAM_NAME_ADDRESS 0x3800 |
the VRAM table layout pico9918_initialise_gfx_i() and GfxII() program
name table (R2)
Definition at line 21 of file pico9918_util.h.
| #define TMS_DEFAULT_VRAM_COLOR_ADDRESS 0x0000 |
colour table (R3)
Definition at line 22 of file pico9918_util.h.
| #define TMS_DEFAULT_VRAM_PATT_ADDRESS 0x2000 |
pattern table (R4)
Definition at line 23 of file pico9918_util.h.
| #define TMS_DEFAULT_VRAM_SPRITE_ATTR_ADDRESS 0x3B00 |
sprite attribute table (R5)
Definition at line 24 of file pico9918_util.h.
| #define TMS_DEFAULT_VRAM_SPRITE_PATT_ADDRESS 0x1800 |
sprite pattern table (R6)
Definition at line 25 of file pico9918_util.h.
|
inlinestatic |
write a VDP register as a host would, value byte first
Definition at line 31 of file pico9918_util.h.
References PICO9918_INST, and pico9918_write_addr().
Referenced by pico9918_initialise_gfx_i(), pico9918_initialise_gfx_ii(), pico9918_set_color_table_addr(), pico9918_set_fg_bg_color(), pico9918_set_name_table_addr(), pico9918_set_pattern_table_addr(), pico9918_set_sprite_attr_table_addr(), and pico9918_set_sprite_patt_table_addr().
|
inlinestatic |
point the VRAM address register at addr for reading
Definition at line 38 of file pico9918_util.h.
References PICO9918_INST, and pico9918_write_addr().
Referenced by pico9918_set_address_write().
|
inlinestatic |
point the VRAM address register at addr for writing, ie.
with bit 14 set
Definition at line 45 of file pico9918_util.h.
References PICO9918_INST, and pico9918_set_address_read().
Referenced by clearTmsRam(), and pico9918_initialise_gfx_ii().
|
inlinestatic |
write a block of bytes to VRAM from the current address
Definition at line 51 of file pico9918_util.h.
References PICO9918_INST, and pico9918_write_data().
|
inlinestatic |
write byte to VRAM rpt times from the current address
Definition at line 60 of file pico9918_util.h.
References PICO9918_INST, and pico9918_write_data().
Referenced by clearTmsRam().
|
inlinestatic |
write a string to VRAM, its terminator excluded
Definition at line 70 of file pico9918_util.h.
References PICO9918_INST, and pico9918_write_data().
|
inlinestatic |
write a string to VRAM with offset added to each character's pattern index
Definition at line 80 of file pico9918_util.h.
References PICO9918_INST, and pico9918_write_data().
|
inlinestatic |
pack fg into the high nibble and bg into the low nibble of one colour byte
Definition at line 90 of file pico9918_util.h.
Referenced by pico9918_set_fg_bg_color().
|
inlinestatic |
set the name table address, which register 2 holds in 1KB units
Definition at line 96 of file pico9918_util.h.
References PICO9918_INST, and pico9918_write_register_value().
Referenced by pico9918_initialise_gfx_i(), and pico9918_initialise_gfx_ii().
|
inlinestatic |
set the colour table address, which register 3 holds in 64-byte units
Definition at line 102 of file pico9918_util.h.
References PICO9918_INST, and pico9918_write_register_value().
Referenced by pico9918_initialise_gfx_i().
|
inlinestatic |
set the pattern table address, which register 4 holds in 2KB units
Definition at line 108 of file pico9918_util.h.
References PICO9918_INST, and pico9918_write_register_value().
Referenced by pico9918_initialise_gfx_i().
|
inlinestatic |
set the sprite attribute table address, which register 5 holds in 128-byte units
Definition at line 114 of file pico9918_util.h.
References PICO9918_INST, and pico9918_write_register_value().
Referenced by pico9918_initialise_gfx_i(), and pico9918_initialise_gfx_ii().
|
inlinestatic |
set the sprite pattern table address, which register 6 holds in 2KB units
Definition at line 120 of file pico9918_util.h.
References PICO9918_INST, and pico9918_write_register_value().
Referenced by pico9918_initialise_gfx_i(), and pico9918_initialise_gfx_ii().
|
inlinestatic |
set register 7, the text-mode foreground colour and the backdrop
Definition at line 126 of file pico9918_util.h.
References pico9918_fg_bg_color(), PICO9918_INST, and pico9918_write_register_value().
Referenced by pico9918_initialise_gfx_i(), and pico9918_initialise_gfx_ii().
| void pico9918_initialise_gfx_i | ( | pico9918_t * | tms9918 | ) |
set up Graphics I with the default table addresses and a cleared VRAM
set up Graphics I with the default table addresses and a cleared VRAM
Definition at line 64 of file pico9918_util.c.
References clearTmsRam(), PICO9918_INST, PICO9918_INST_ONLY, pico9918_set_color_table_addr(), pico9918_set_fg_bg_color(), pico9918_set_name_table_addr(), pico9918_set_pattern_table_addr(), pico9918_set_sprite_attr_table_addr(), pico9918_set_sprite_patt_table_addr(), pico9918_write_register_value(), TMS_DEFAULT_VRAM_COLOR_ADDRESS, TMS_DEFAULT_VRAM_NAME_ADDRESS, TMS_DEFAULT_VRAM_PATT_ADDRESS, TMS_DEFAULT_VRAM_SPRITE_ATTR_ADDRESS, TMS_DEFAULT_VRAM_SPRITE_PATT_ADDRESS, TMS_R0_EXT_VDP_DISABLE, TMS_R0_MODE_GRAPHICS_I, TMS_R1_DISP_ACTIVE, TMS_R1_INT_ENABLE, TMS_R1_MODE_GRAPHICS_I, and TMS_R1_RAM_16K.
| void pico9918_initialise_gfx_ii | ( | pico9918_t * | tms9918 | ) |
set up Graphics II with the default table addresses and a cleared VRAM
set up Graphics II with the default table addresses and a cleared VRAM
Definition at line 84 of file pico9918_util.c.
References clearTmsRam(), PICO9918_INST, PICO9918_INST_ONLY, pico9918_set_address_write(), pico9918_set_fg_bg_color(), pico9918_set_name_table_addr(), pico9918_set_sprite_attr_table_addr(), pico9918_set_sprite_patt_table_addr(), pico9918_write_data(), pico9918_write_register_value(), TMS_DEFAULT_VRAM_NAME_ADDRESS, TMS_DEFAULT_VRAM_SPRITE_ATTR_ADDRESS, TMS_DEFAULT_VRAM_SPRITE_PATT_ADDRESS, TMS_R0_EXT_VDP_DISABLE, TMS_R0_MODE_GRAPHICS_II, TMS_R1_DISP_ACTIVE, TMS_R1_INT_ENABLE, TMS_R1_MODE_GRAPHICS_II, and TMS_R1_RAM_16K.
| uint32_t pico9918_palette[] |
the sixteen TMS9918 colours, each packed as 0xrrggbbaa
Definition at line 28 of file pico9918_util.h.