|
pico9918-core 1.3.0
TMS9918A / F18A video display processor emulation in C99
|
pico9918-core - Core interface More...
#include "impl/pico9918_priv.h"#include "impl/pico9918_gpu_priv.h"#include "overlay/splash.h"#include <string.h>#include <stdlib.h>
Include dependency graph for pico9918.c:Go to the source code of this file.
Data Structures | |
| struct | TileRowAddr |
| struct | TileLayerConfig |
| struct | TextScroll |
Macros | |
| #define | EMITTER_NOINLINE PICO9918_NOINLINE |
| #define | INTERRUPT_CB tms9918->interrupt |
| #define | MASK_NEXT_PIXEL 0x80000000u |
| #define | TEXT_SCROLL_CELL(s) ((s) & 0xffffu) |
| #define | TEXT_SCROLL_OFFSET(s) ((s) >> 16) |
| #define | TEXT80_COLOR_WORD(n) ((uint32_t)((n) * 0x111111u)) |
| #define | TEXT80_MASK_WORD(bits) |
| #define | TEXT80_MASK_WORD4(bits) TEXT80_MASK_WORD(bits), TEXT80_MASK_WORD(bits), TEXT80_MASK_WORD(bits), TEXT80_MASK_WORD(bits) |
| #define | TEXT40_NEXT_CELL() |
| #define | TEXT40_CELL(wrapping) |
| #define | TEXT40_ECM_CELL() |
| #define | TEXT_ROW_PARAMS |
| #define | TEXT_ROW_CLONE(name, cols, t2, e) |
| #define | TEXT80_NEXT_CELL() |
| #define | TEXT80_OPAQUE_CELL() |
| #define | TEXT80_OVERLAY_CELL() |
| #define | TEXT80_OVERLAY_STORE(shift) |
| #define | TEXT80_ROW_CLONE(name, cells, scroll) |
| #define | LOCKED_ROW_CLONE(name, g, m) |
| #define | TILE_ROW_PARAMS |
| #define | TILE_ROW_ARGS |
| #define | TILE_ROW_CLONE(name, t2, e, g, m) |
| #define | TILE_ROW_GM2 4 |
| #define | TILE_ROW_MCM 5 |
| #define | UNDER_PIXEL(n) |
| #define | MIXED_PIXEL(n) |
Typedefs | |
| typedef uint32_t | BitMask[9] |
| typedef uint32_t | TileMask[SCANLINE_MASK_WORDS] |
Functions | |
| PICO9918_COPY_STATE () PICO9918_SECTION_SCRATCH_Y(buffer) static uint32_t bg | |
| static | PICO9918_SECTION_SCRATCH_X (buffer) |
| create a new TMS9918 | |
| size_t | pico9918_instance_size (void) |
| see the header. | |
| bool | pico9918_unlocked (pico9918_t *tms9918) |
| see the header. | |
| void | pico9918_set_interrupt_callback (pico9918_t *tms9918, pico9918_interrupt_fn cb, void *userdata) |
| register the host's /INT hook, so a host need not poll | |
| void | pico9918_interrupt_dispatch (pico9918_t *tms9918, bool active) |
| see impl. | |
| PICO9918_STATIC_ASSERT (offsetof(pico9918_mem_map_t, pram)==PICO9918_MAP_PRAM, "PICO9918_MAP_PRAM does not match the memory map") | |
| PICO9918_STATIC_ASSERT (offsetof(pico9918_mem_map_t, registers)==PICO9918_MAP_REGISTERS, "PICO9918_MAP_REGISTERS does not match the memory map") | |
| PICO9918_STATIC_ASSERT (offsetof(pico9918_mem_map_t, scanline)==PICO9918_MAP_SCANLINE, "PICO9918_MAP_SCANLINE does not match the memory map") | |
| PICO9918_STATIC_ASSERT (offsetof(pico9918_mem_map_t, status)==PICO9918_MAP_STATUS, "PICO9918_MAP_STATUS does not match the memory map") | |
| static pico9918_mode_t | tmsMode (pico9918_t *tms9918) |
| static uint8_t | tmsSpriteSize (pico9918_t *tms9918) |
| sprite size (8 or 16) | |
| static bool | tmsSpriteMag (pico9918_t *tms9918) |
| sprite size (0 = 1x, 1 = 2x) | |
| static uint16_t | tmsNameTableAddr (pico9918_t *tms9918) |
| name table base address | |
| static uint16_t | tmsNameTable2Addr (pico9918_t *tms9918) |
| name table base address | |
| static uint16_t | tmsColorTableAddr (pico9918_t *tms9918) |
| color table base address | |
| static uint16_t | tmsColorTable2Addr (pico9918_t *tms9918) |
| color table base address | |
| static uint16_t | tmsPatternTableAddr (pico9918_t *tms9918) |
| pattern table base address | |
| static uint16_t | tmsSpriteAttrTableAddr (pico9918_t *tms9918) |
| sprite attribute table base address | |
| static uint16_t | tmsSpritePatternTableAddr (pico9918_t *tms9918) |
| sprite pattern table base address | |
| static pico9918_color_t | tmsMainBgColor (pico9918_t *tms9918) |
| background color | |
| static pico9918_color_t | tmsMainFgColor (pico9918_t *tms9918) |
| foreground color | |
| static pico9918_color_t | tmsFgColor (pico9918_t *tms9918, uint8_t colorByte) |
| foreground color | |
| static pico9918_color_t | tmsBgColor (pico9918_t *tms9918, uint8_t colorByte) |
| background color | |
| static PICO9918_NOINLINE void | vdpRegisterReset (pico9918_t *tms9918) |
| static uint8_t | chipFeatures (pico9918_chip_t chip) |
| the feature bits a personality answers to - the ladder, in one place | |
| void | pico9918_set_chip (pico9918_t *tms9918, pico9918_chip_t chip) |
| select which chip this instance answers as | |
| pico9918_chip_t | pico9918_chip (pico9918_t *tms9918) |
| which chip this instance answers as | |
| void | pico9918_reset (pico9918_t *tms9918) |
| reset the new TMS9918 | |
| void | pico9918_destroy (pico9918_t *tms9918) |
| destroy a TMS9918 | |
| void | pico9918_write_addr (pico9918_t *tms9918, uint8_t data) |
| write an address (mode = 1) to the tms9918 | |
| uint8_t | pico9918_read_status (pico9918_t *tms9918) |
| read from the status register | |
| uint8_t | pico9918_peek_status (pico9918_t *tms9918) |
| read from the status register without resetting it | |
| void | pico9918_write_data (pico9918_t *tms9918, uint8_t data) |
| write data (mode = 0) to the tms9918 | |
| uint8_t | pico9918_read_data (pico9918_t *tms9918) |
| read data (mode = 0) from the tms9918 | |
| uint8_t | pico9918_read_data_no_inc (pico9918_t *tms9918) |
| read data (mode = 0) from the tms9918 | |
| bool | pico9918_interrupt_status (pico9918_t *tms9918) |
| return true if both INT status and INT control set | |
| void | pico9918_interrupt_set (pico9918_t *tms9918) |
| raise the INT status flag | |
| void | pico9918_set_status (pico9918_t *tms9918, uint8_t status) |
| set status flag | |
| static | PICO9918_SECTION_SCRATCH_X (lookup) |
| static uint32_t | tmsTestCollisionMask (const uint32_t xPos, const uint32_t spritePixels, const uint32_t spriteWidth) |
| Test and update the sprite collision mask. | |
| static void | tmsSetTransparentSpriteMask (const uint32_t xPos, const uint32_t spritePixels, const uint32_t spriteWidth) |
| set the transparent sprite mask. | |
| static void | tmsClearRowBitsMask (const uint32_t xPos, const uint32_t tilePixels, const uint32_t tileWidth, BitMask rowBitsMask) |
| Clear the row pixels bit mask. | |
| static void | tmsUpdateRowBitsMaskAligned (const uint32_t xPos, const uint32_t tilePixels, BitMask rowBitsMask) |
| Update the row pixels bit mask (aligned - no word boundary crossing). | |
| static uint32_t | tmsTestRowBitsMaskAligned (const uint32_t xPos, const uint32_t tilePixels, const BitMask rowBitsMask) |
| Test against the row pixels bit mask (aligned - no word boundary crossing). | |
| static PICO9918_NOINLINE void | tmsCopyAlignMask (TileMask dstMask, const TileMask srcMask, int pixelShift) |
| static PICO9918_NOINLINE void | tmsRestoreAlignMask (TileMask dstMask, const TileMask srcMask, int pixelShift, int otherShift) |
| static uint32_t | tmsTestRowBitsMask (const uint32_t xPos, const uint32_t tilePixels, const uint32_t tileWidth, const bool update, const bool test, const bool testColl) |
| Test and update the row pixels bit mask. | |
| static uint32_t | PICO9918_UNINITIALIZED (ecmLookup)[16 *16 *16] |
| static uint8_t | ecmByte (bool h, bool m, bool l) |
| static void | ecmLookupInit (void) |
| static uint32_t | repeatedPalette (const uint32_t index) |
| void | initLookups (void) |
| static uint32_t | ecmSplitQuads (const uint32_t patt) |
| static uint32_t | calculateEcmIndex (const uint32_t ecm, const uint32_t sb0, const uint32_t sb1, const uint32_t sb2) |
| static void | loadSpriteData (const uint8_t *vram, uint32_t *spriteBits, uint32_t pattOffset, uint32_t *pattMask, const uint32_t ecm, const uint32_t ecmOffset, const bool flipX, const bool sprite16) |
| static uint32_t | spriteEcm (pico9918_t *tms9918) |
| the sprite ECM level, zero on a locked device - the one term a clone can pin | |
| static uint8_t | renderSprites (pico9918_t *tms9918, const uint32_t spriteCount, const bool spriteMag, const bool wide, const bool ecm0, uint8_t pixels[TMS9918_PIXELS_X]) |
| Output Sprites to a scanline. | |
| static uint8_t | pico9918_output_sprites (pico9918_t *tms9918, uint16_t y, uint8_t pixels[TMS9918_PIXELS_X]) |
| static void | tileRowAddr (pico9918_t *tms9918, const uint16_t y, const uint16_t rawY, const uint8_t colorReg, const bool gm2, const bool mcm, TileRowAddr *addr, uint16_t *colorTableAddr) |
| the per-mode half of a tile row's addressing, once per layer per scanline. | |
| static uint32_t | textScrollCell (const uint32_t hscrollPixels) |
| static uint32_t | textScrollSplit (const uint32_t hscroll, const bool wide) |
| static uint32_t | textPixelOffset (const uint32_t hscroll, const bool wide) |
| static int | scrollOffset (const uint32_t hscroll, const bool text, const bool wide) |
| static TextScroll | textScroll80 (pico9918_t *tms9918, const TileLayerConfig *config) |
| static void | tileLayerAddr (pico9918_t *tms9918, const uint16_t rawY, const TileLayerConfig *config, const uint8_t numCols, const uint8_t nameAddrMask, const bool textMode, const bool gm2, const bool mcm, const bool attrPerPos, TileRowAddr *addr, uint16_t *namesAddr, uint16_t *colorAddr) |
| where one layer reads this scanline from: the vertical scroll and its page swap, the name and colour rows, and the mode's pattern table. | |
| PICO9918_INLINE_HOT void | renderTextRow (pico9918_t *tms9918, const uint8_t *__restrict rowNames, const TileRowAddr *__restrict addr, const uint8_t *__restrict rowColors, const uint32_t colorStride, uint32_t pal, uint8_t *__restrict dest, const uint32_t scroll, const bool alwaysOnTop, const uint32_t numCols, const bool isTile2, const uint32_t ecm, const bool blend) |
| one 40- or 80-column text row, six pixels a cell at one byte each | |
| static void | text80RowT2Blend (pico9918_t *tms9918, const uint8_t *rowNames, const TileRowAddr *addr, const uint8_t *rowColors, const uint32_t colorStride, const uint32_t pal, uint8_t *dest, const uint32_t scroll, const bool alwaysOnTop) |
| PICO9918_INLINE_HOT void | renderText80Row (pico9918_t *tms9918, const uint8_t *__restrict rowNames, const uint8_t *__restrict patternTable, const uint8_t *__restrict rowColors, const bool opaq, uint8_t *__restrict pixels, const uint32_t startCol, const uint32_t numCells, const bool scrolled) |
| one 80-column text row, six pixels a cell at half a byte each. | |
| static void | renderText80Layer (pico9918_t *tms9918, const uint8_t *rowNames, const uint8_t *patternTable, const uint8_t *rowColors, const bool opaq, uint8_t *pixels, const uint32_t startCol, const uint32_t numCells, const bool scrolled) |
| static uint8_t * | text80TwoTone (const uint8_t *__restrict names, const uint8_t *__restrict patternTable, const uint32_t bgWord, const uint32_t diffWord, uint8_t *__restrict pixels, uint32_t cells) |
| static void | text_scan_line (pico9918_t *tms9918, uint16_t y, uint8_t pixels[TMS9918_PIXELS_X]) |
| generate a 40- or 80-column text mode scanline. | |
| static void | writeToAlignedBuffer (uint8_t *buffer, uint32_t xPos, const uint32_t left, const uint32_t right) |
| Write full tile to aligned buffer - 8 pixels at once. | |
| static void | renderEcm0Tile (pico9918_t *tms9918, uint8_t *buffer, const uint32_t xPos, const uint8_t pattIdx, const uint8_t patternTable[], const uint32_t colorTableAddr, const uint32_t pal, const bool isTile2, const bool gm2Color, const bool mcm) |
| render an ECM0 (enhanced color mode) graphics I tile. | |
| static void | renderEcmTileToAlignedBuffer (pico9918_t *tms9918, uint8_t *buffer, const uint32_t xPos, const uint32_t pixelOffset, const uint8_t pattIdx, const uint8_t patternTable[], const uint32_t colorTableAddr, const uint32_t ecm, const uint32_t ecmOffset, const uint32_t ecmColorMask, const uint32_t ecmColorOffset, const uint32_t pal, const bool attrPerPos, const int32_t flipY, const uint32_t tileIndex, uint32_t *lastEmpty, const bool isTile2, const bool alwaysOnTop) |
| render one ECM tile into the layer buffer | |
| static void | lockedFgBg (pico9918_t *tms9918, uint32_t fgbg[2], const uint8_t pal, const uint32_t colorByte) |
| PICO9918_INLINE_HOT void | renderTileRowLocked (pico9918_t *tms9918, uint16_t rowNamesAddr, uint16_t colorTableAddr, uint8_t tileIndex, uint8_t pal, uint8_t pixels[TMS9918_PIXELS_X], const TileRowAddr *addr, const bool gm2, const bool mcm) |
| generate a locked (plain TMS9918) tile row, straight into the scanline | |
| PICO9918_INLINE_HOT void | renderTileRow (pico9918_t *tms9918, const bool hpSize, uint16_t rowNamesAddr, uint16_t colorTableAddr, uint8_t tileIndex, uint8_t startPattBit, const bool attrPerPos, uint8_t pal, const bool alwaysOnTop, const TileRowAddr *addr, const bool isTile2, const uint32_t ecm, const bool gm2, const bool mcm) |
| PICO9918_INLINE_HOT void | f18a_tile_layer_scan_line (pico9918_t *tms9918, uint16_t y, const TileLayerConfig *config, const bool blend) |
| generate a tile mode scanline for either T1 or T2 layer | |
| static void | f18a_tile1_scan_line (pico9918_t *tms9918, uint16_t y) |
| generate a Graphics I mode scanline for the T1 layer | |
| static void | f18a_tile2_scan_line (pico9918_t *tms9918, uint16_t y, const bool blend) |
| generate a Graphics I mode scanline for the T2 layer | |
| PICO9918_INLINE_HOT bool | renderBitmapLayerBody (pico9918_t *tms9918, uint16_t y, bool opaque, const uint8_t width, const uint16_t addr, const uint8_t bmlCtl, uint8_t pixels[TMS9918_PIXELS_X], const bool wide, const bool intoTile1) |
| generate an F18A bitmap layer scanline | |
| static bool | renderBitmapLayer80 (pico9918_t *tms9918, uint16_t y, bool opaque, const uint8_t width, const uint16_t addr, const uint8_t bmlCtl, uint8_t pixels[TMS9918_PIXELS_X], const bool intoTile1) |
| static bool | renderBitmapLayer40 (pico9918_t *tms9918, uint16_t y, bool opaque, const uint8_t width, const uint16_t addr, const uint8_t bmlCtl, uint8_t pixels[TMS9918_PIXELS_X]) |
| static bool | bitmap_layer_scan_line (pico9918_t *tms9918, uint16_t y, uint8_t pixels[TMS9918_PIXELS_X], const bool intoTile1) |
| generate an F18A bitmap layer scanline | |
| static void | compositeChunkWide (uint32_t *__restrict pix32, const uint32_t *__restrict l1, const uint32_t *__restrict l2, uint32_t sel, uint32_t open, const bool hasSprites) |
| static void | compositeChunkUnder (uint8_t *__restrict pixels, const uint8_t *__restrict layer1, const uint8_t *__restrict layer2, uint32_t mask, uint32_t spriteMask, const bool hasSprites) |
| static void | compositeChunkBytes (uint8_t *__restrict pixels, const uint8_t *__restrict layer1, const uint8_t *__restrict layer2, uint32_t mask, uint32_t spriteMask, const bool hasSprites) |
| static uint32_t | spriteGridWord (const uint32_t maskWord, const BitMask mask, const bool wide) |
| static void | overlaySpritesOnTile1 (uint32_t *__restrict dst, const uint32_t *__restrict src, const bool wide) |
| PICO9918_INLINE_HOT void | compositeAlignedBody (pico9918_t *tms9918, uint8_t pixels[TMS9918_PIXELS_X], const int t1Scroll, const int t2Scroll, const bool wide) |
| static void | compositeAligned40 (pico9918_t *tms9918, uint8_t pixels[TMS9918_PIXELS_X], const int t1Scroll, const int t2Scroll) |
| static void | compositeAligned80 (pico9918_t *tms9918, uint8_t pixels[TMS9918_PIXELS_X], const int t1Scroll, const int t2Scroll) |
| static void | compositeAlignedTileBuffers (pico9918_t *tms9918, uint8_t pixels[TMS9918_PIXELS_X], const int t1Scroll, const int t2Scroll, const bool wide) |
| static PICO9918_NOINLINE void | compositeTile2OnlyBuffer (pico9918_t *tms9918, uint8_t pixels[TMS9918_PIXELS_X], const int t2Scroll, const bool wide) |
| Composite with tile layer 1 disabled (reg 0x32 bit 4). | |
| static void | textRowBorder (pico9918_t *tms9918, const int t1Scroll, const uint32_t padding, const uint32_t width) |
| A text row draws 240 of the 256 pixels and the composite copies all of them, so layer 1's buffer has to carry the side borders itself. | |
| static uint8_t | graphics_i_scan_line (pico9918_t *tms9918, uint16_t y, uint8_t pixels[TMS9918_PIXELS_X]) |
| generate a Graphics I or Graphics II mode scanline | |
| uint8_t | pico9918_scan_line (pico9918_t *tms9918, uint16_t y) |
| generate a scanline | |
| uint8_t | pico9918_reg_value (pico9918_t *tms9918, pico9918_register_t reg) |
| return a register value - see the header for the locked-device aliasing | |
| uint8_t | pico9918_status_value (pico9918_t *tms9918, pico9918_status_register_t reg) |
| return a status register value without the side effects of reading it | |
| PICO9918_INTERNAL void | pico9918_write_reg_value_impl (pico9918_t *tms9918, uint8_t reg, uint8_t value) |
| set a register from the second byte of a host register write | |
| uint8_t | pico9918_vram_value (pico9918_t *tms9918, uint16_t addr) |
| return a value from vram | |
| bool | pico9918_display_enabled (pico9918_t *tms9918) |
| check BLANK flag | |
| pico9918_mode_t | pico9918_display_mode (pico9918_t *tms9918) |
| current display mode | |
| void | pico9918_debug_sync_mode_impl (pico9918_t *tms9918) |
| see impl/pico9918_priv.h. | |
| uint32_t | pico9918_line_bytes (pico9918_t *tms9918) |
| how many bytes of pixels[] this mode fills. | |
| const uint8_t * | pico9918_line_source (pico9918_t *tms9918) |
| where the scanline just generated actually is. | |
| uint16_t | pico9918_default_palette (int index) |
| a default palette entry, 0xargb | |
Variables | |
| static const pico9918_mode_t | r1Modes [] |
| static const uint16_t | defaultPalette [] |
| static const uint32_t | zeroWord = 0 |
| rowMasks | |
| static uint8_t | doubledBitsNibble [16] |
| static uint32_t | transparentPixels [2] |
| bool | lookupsReady = false |
| static const TileLayerConfig | T1_CONFIG |
| static const TileLayerConfig | T2_CONFIG |
| static const uint32_t | text80ColorWord [16] |
| static const uint32_t | text80MaskWord [256] |
| static void(*const | textRowClones [2][4])(pico9918_t *tms9918, const uint8_t *rowNames, const TileRowAddr *addr, const uint8_t *rowColors, const uint32_t colorStride, const uint32_t pal, uint8_t *dest, const uint32_t scroll, const bool alwaysOnTop) |
| static void(*const | text80RowClones [2][4])(pico9918_t *tms9918, const uint8_t *rowNames, const TileRowAddr *addr, const uint8_t *rowColors, const uint32_t colorStride, const uint32_t pal, uint8_t *dest, const uint32_t scroll, const bool alwaysOnTop) |
| static void(*const | tileRowClones [2][6])(pico9918_t *tms9918, const bool hpSize, uint16_t rowNamesAddr, uint16_t colorTableAddr, uint8_t tileIndex, uint8_t startPattBit, const bool attrPerPos, uint8_t pal, const bool alwaysOnTop, const TileRowAddr *addr) |
| static bool | underLayer = false |
| const uint8_t * | pico9918_cached_line_source = 0 |
pico9918-core - Core interface
Copyright (c) 2021 Troy Schrapel
This code is licensed under the MIT license
https://github.com/visrealm/pico9918-core
Definition in file pico9918.c.
| #define EMITTER_NOINLINE PICO9918_NOINLINE |
Definition at line 26 of file pico9918.c.
| #define INTERRUPT_CB tms9918->interrupt |
Definition at line 138 of file pico9918.c.
| #define MASK_NEXT_PIXEL 0x80000000u |
Definition at line 503 of file pico9918.c.
| #define TEXT_SCROLL_CELL | ( | s | ) | ((s) & 0xffffu) |
Definition at line 1405 of file pico9918.c.
| #define TEXT_SCROLL_OFFSET | ( | s | ) | ((s) >> 16) |
Definition at line 1406 of file pico9918.c.
| #define TEXT80_COLOR_WORD | ( | n | ) | ((uint32_t)((n) * 0x111111u)) |
Definition at line 1558 of file pico9918.c.
| #define TEXT80_MASK_WORD | ( | bits | ) |
Definition at line 1559 of file pico9918.c.
| #define TEXT80_MASK_WORD4 | ( | bits | ) | TEXT80_MASK_WORD(bits), TEXT80_MASK_WORD(bits), TEXT80_MASK_WORD(bits), TEXT80_MASK_WORD(bits) |
Definition at line 1572 of file pico9918.c.
| #define TEXT40_NEXT_CELL | ( | ) |
| #define TEXT_ROW_PARAMS |
Definition at line 1865 of file pico9918.c.
| #define TEXT_ROW_CLONE | ( | name, | |
| cols, | |||
| t2, | |||
| e | |||
| ) |
Definition at line 1869 of file pico9918.c.
| #define TEXT80_NEXT_CELL | ( | ) |
| #define TEXT80_OPAQUE_CELL | ( | ) |
| #define TEXT80_OVERLAY_CELL | ( | ) |
| #define TEXT80_OVERLAY_STORE | ( | shift | ) |
| #define TEXT80_ROW_CLONE | ( | name, | |
| cells, | |||
| scroll | |||
| ) |
Definition at line 2070 of file pico9918.c.
| #define LOCKED_ROW_CLONE | ( | name, | |
| g, | |||
| m | |||
| ) |
Definition at line 2446 of file pico9918.c.
| #define TILE_ROW_PARAMS |
Definition at line 2470 of file pico9918.c.
| #define TILE_ROW_ARGS |
Definition at line 2474 of file pico9918.c.
| #define TILE_ROW_CLONE | ( | name, | |
| t2, | |||
| e, | |||
| g, | |||
| m | |||
| ) |
Definition at line 2537 of file pico9918.c.
| #define TILE_ROW_GM2 4 |
Definition at line 2558 of file pico9918.c.
| #define TILE_ROW_MCM 5 |
Definition at line 2559 of file pico9918.c.
| #define UNDER_PIXEL | ( | n | ) |
| #define MIXED_PIXEL | ( | n | ) |
| typedef uint32_t BitMask[9] |
Definition at line 498 of file pico9918.c.
| typedef uint32_t TileMask[SCANLINE_MASK_WORDS] |
Definition at line 499 of file pico9918.c.
|
static |
create a new TMS9918
Definition at line 46 of file pico9918.c.
References PICO9918_BASE_TMS9918, PICO9918_CHIP_MAX, PICO9918_INST, PICO9918_INST_ONLY, pico9918_reset(), and pico9918_set_chip().
| size_t pico9918_instance_size | ( | void | ) |
see the header.
bytes an instance occupies, for a versioned save/restore
What a versioned save/restore copies from the instance base.
Definition at line 118 of file pico9918.c.
| bool pico9918_unlocked | ( | pico9918_t * | tms9918 | ) |
see the header.
is the F18A unlock latch set?
The latch itself, not the personality that could set it.
Definition at line 124 of file pico9918.c.
| void pico9918_set_interrupt_callback | ( | pico9918_t * | tms9918, |
| pico9918_interrupt_fn | cb, | ||
| void * | userdata | ||
| ) |
register the host's /INT hook, so a host need not poll
Fires on every pin write, not on a level change; a host wanting edges compares against its own last value. It does NOT fire from pico9918_reset(), whose tail order is the caller's, so re-derive from pico9918_interrupt_status() after one.
Definition at line 141 of file pico9918.c.
| void pico9918_interrupt_dispatch | ( | pico9918_t * | tms9918, |
| bool | active | ||
| ) |
see impl.
What the desktop PICO9918_HOST_SET_INT expands to.
Definition at line 149 of file pico9918.c.
|
inlinestatic |
Definition at line 169 of file pico9918.c.
|
inlinestatic |
sprite size (8 or 16)
Definition at line 188 of file pico9918.c.
References TMS_R1_SPRITE_16.
Referenced by renderSprites().
|
inlinestatic |
sprite size (0 = 1x, 1 = 2x)
Definition at line 194 of file pico9918.c.
References TMS_R1_SPRITE_MAG2.
|
inlinestatic |
name table base address
Definition at line 200 of file pico9918.c.
Referenced by graphics_i_scan_line().
|
inlinestatic |
name table base address
Definition at line 206 of file pico9918.c.
References PICO9918_REG_NAME_TABLE2.
|
inlinestatic |
color table base address
Definition at line 212 of file pico9918.c.
Referenced by graphics_i_scan_line().
|
inlinestatic |
color table base address
Definition at line 220 of file pico9918.c.
References PICO9918_REG_COLOR_TABLE2.
|
inlinestatic |
|
inlinestatic |
sprite attribute table base address
Definition at line 236 of file pico9918.c.
|
inlinestatic |
sprite pattern table base address
Definition at line 242 of file pico9918.c.
Referenced by renderSprites().
|
inlinestatic |
background color
Definition at line 248 of file pico9918.c.
Referenced by f18a_tile_layer_scan_line(), pico9918_scan_line(), renderText80Row(), text_scan_line(), tmsBgColor(), tmsFgColor(), and tmsMainFgColor().
|
inlinestatic |
foreground color
Definition at line 254 of file pico9918.c.
References tmsMainBgColor().
Referenced by f18a_tile_layer_scan_line(), and text_scan_line().
|
inlinestatic |
|
inlinestatic |
|
static |
Definition at line 290 of file pico9918.c.
|
static |
the feature bits a personality answers to - the ladder, in one place
Definition at line 313 of file pico9918.c.
References PICO9918_CHIP_F18A, PICO9918_CHIP_PICO9918, PICO9918_CHIP_PICO9918_PRO, and PICO9918_CHIP_TMS9918A.
Referenced by pico9918_set_chip().
| void pico9918_set_chip | ( | pico9918_t * | tms9918, |
| pico9918_chip_t | chip | ||
| ) |
select which chip this instance answers as
Clamped to PICO9918_CHIP_MAX, so a request the build cannot honour comes back as the highest it can rather than as a half-honoured one - read pico9918_chip() to find out which you got. Stepping down to a personality that CANNOT UNLOCK AT ALL relocks the device, because the register file it would otherwise leave visible is not one a TMS9918A has. Stepping between two personalities that can both unlock leaves the latch alone, so this is not "stepping down relocks" in general - read pico9918_unlocked().
A reset preserves it: the personality is the chip on the board, not state the bus can clear. A new instance starts at PICO9918_CHIP_MAX, which is what a consumer that never calls this keeps.
Stepping to a personality that has no settings block also takes R30 to that chip's own scanline sprite limit - four on a TMS9918 or TMS9918A, which have no register to raise it with. One that HAS a settings block keeps whatever the block last applied, so this and pico9918_config_apply_now() may be called in either order.
Definition at line 330 of file pico9918.c.
References chipFeatures(), PICO9918_CHIP_MAX, PICO9918_CHIP_PICO9918_PRO, PICO9918_REG_GPU_CONTROL, PICO9918_REG_MAX_SCAN_SPRITES, pico9918_splash_select_pro(), and PICO9918_SR_IDENT.
Referenced by PICO9918_SECTION_SCRATCH_X().
| pico9918_chip_t pico9918_chip | ( | pico9918_t * | tms9918 | ) |
which chip this instance answers as
Definition at line 370 of file pico9918.c.
| void pico9918_reset | ( | pico9918_t * | tms9918 | ) |
reset the new TMS9918
reset the TMS9918
Definition at line 378 of file pico9918.c.
References pico9918_frame_reset_int_impl(), PICO9918_INST_ONLY, pico9918_splash_reset(), PICO9918_SR_IDENT, PICO9918_SR_STATUS, and PICO9918_SR_VERSION.
Referenced by PICO9918_SECTION_SCRATCH_X().
| void pico9918_destroy | ( | pico9918_t * | tms9918 | ) |
destroy a TMS9918
destroy a TMS9918 and release everything it owns
tms9918: tms9918 object to destroy / clean up
Definition at line 420 of file pico9918.c.
| void pico9918_write_addr | ( | pico9918_t * | tms9918, |
| uint8_t | data | ||
| ) |
write an address (mode = 1) to the tms9918
write an address (mode = 1) to the tms9918 - the data byte DB0 -> DB7
data: the data (DB0 -> DB7) to send
Definition at line 433 of file pico9918.c.
References PICO9918_INST, and pico9918_write_addr_impl().
Referenced by pico9918_set_address_read(), and pico9918_write_register_value().
| uint8_t pico9918_read_status | ( | pico9918_t * | tms9918 | ) |
read from the status register
Definition at line 439 of file pico9918.c.
References PICO9918_INST_ONLY, and pico9918_read_status_impl().
| uint8_t pico9918_peek_status | ( | pico9918_t * | tms9918 | ) |
read from the status register without resetting it
Definition at line 445 of file pico9918.c.
References PICO9918_INST_ONLY, and pico9918_peek_status_impl().
| void pico9918_write_data | ( | pico9918_t * | tms9918, |
| uint8_t | data | ||
| ) |
write data (mode = 0) to the tms9918
write data (mode = 0) to the tms9918 - the data byte DB0 -> DB7
data: the data (DB0 -> DB7) to send
Definition at line 455 of file pico9918.c.
References PICO9918_INST, and pico9918_write_data_impl().
Referenced by clearTmsRam(), pico9918_initialise_gfx_ii(), pico9918_write_byte_rpt(), pico9918_write_bytes(), pico9918_write_string(), and pico9918_write_string_offset().
| uint8_t pico9918_read_data | ( | pico9918_t * | tms9918 | ) |
read data (mode = 0) from the tms9918
Definition at line 462 of file pico9918.c.
References PICO9918_INST_ONLY, and pico9918_read_data_impl().
| uint8_t pico9918_read_data_no_inc | ( | pico9918_t * | tms9918 | ) |
read data (mode = 0) from the tms9918
read data (mode = 0) without incrementing the address pointer
Definition at line 468 of file pico9918.c.
References PICO9918_INST_ONLY, and pico9918_read_data_no_inc_impl().
| bool pico9918_interrupt_status | ( | pico9918_t * | tms9918 | ) |
return true if both INT status and INT control set
true if the device is asserting /INT
Definition at line 474 of file pico9918.c.
References PICO9918_INST_ONLY, and pico9918_interrupt_status_impl().
| void pico9918_interrupt_set | ( | pico9918_t * | tms9918 | ) |
raise the INT status flag
set the interrupt flag
Definition at line 480 of file pico9918.c.
References PICO9918_INST_ONLY, and pico9918_interrupt_set_impl().
| void pico9918_set_status | ( | pico9918_t * | tms9918, |
| uint8_t | status | ||
| ) |
set status flag
set the status flags
Definition at line 487 of file pico9918.c.
References PICO9918_INST, and pico9918_set_status_impl().
|
static |
Definition at line 507 of file pico9918.c.
|
inlinestatic |
Test and update the sprite collision mask.
Definition at line 515 of file pico9918.c.
Referenced by renderSprites().
|
inlinestatic |
set the transparent sprite mask.
Definition at line 539 of file pico9918.c.
Referenced by renderSprites().
|
inlinestatic |
Clear the row pixels bit mask.
Definition at line 556 of file pico9918.c.
Referenced by renderEcmTileToAlignedBuffer().
|
inlinestatic |
Update the row pixels bit mask (aligned - no word boundary crossing).
Definition at line 575 of file pico9918.c.
Referenced by renderEcm0Tile(), and renderEcmTileToAlignedBuffer().
|
inlinestatic |
Test against the row pixels bit mask (aligned - no word boundary crossing).
Definition at line 582 of file pico9918.c.
Referenced by renderEcm0Tile(), and renderEcmTileToAlignedBuffer().
|
static |
Definition at line 590 of file pico9918.c.
|
static |
Definition at line 649 of file pico9918.c.
|
inlinestatic |
Test and update the row pixels bit mask.
Definition at line 657 of file pico9918.c.
Referenced by renderBitmapLayerBody().
|
static |
Definition at line 700 of file pico9918.c.
|
static |
Definition at line 709 of file pico9918.c.
|
inlinestatic |
Definition at line 781 of file pico9918.c.
| void initLookups | ( | void | ) |
Definition at line 827 of file pico9918.c.
|
inlinestatic |
Definition at line 856 of file pico9918.c.
|
inlinestatic |
Definition at line 869 of file pico9918.c.
|
inlinestatic |
Definition at line 886 of file pico9918.c.
|
inlinestatic |
the sprite ECM level, zero on a locked device - the one term a clone can pin
Definition at line 979 of file pico9918.c.
References PICO9918_R49_ECM_SPRITE, and PICO9918_REG_ENHANCED1.
Referenced by renderSprites().
|
inlinestatic |
Output Sprites to a scanline.
ecm0 pins the ECM level to zero, which folds the plane loop to one pass, the colour shift to nothing and the whole ECM emit arm away.
Definition at line 988 of file pico9918.c.
References PICO9918_INST_ONLY, PICO9918_R24_SPRITE_PS, PICO9918_R29_SPRITE_STRIDE, PICO9918_R50_REPORT_MAX, PICO9918_REG_ENHANCED2, PICO9918_REG_MAX_SCAN_SPRITES, PICO9918_REG_PAGE_SIZE, PICO9918_REG_PALETTE_SELECT, PICO9918_SR0_5S, PICO9918_SR0_COLLISION, spriteEcm(), TMS9918_PIXELS_X, tmsSetTransparentSpriteMask(), tmsSpritePatternTableAddr(), tmsSpriteSize(), and tmsTestCollisionMask().
|
static |
Definition at line 1313 of file pico9918.c.
|
inlinestatic |
the per-mode half of a tile row's addressing, once per layer per scanline.
y is the scrolled raster row and rawY the unscrolled one. Multicolor is the only mode that needs both, and it needs them apart: its name address uses the scrolled row while its pattern byte comes from the raw one, so a vertical scroll changes which tiles are fetched but not which four-line block of each is shown.
Definition at line 1368 of file pico9918.c.
References tmsPatternTableAddr().
Referenced by graphics_i_scan_line(), and tileLayerAddr().
|
inlinestatic |
Definition at line 1394 of file pico9918.c.
|
inlinestatic |
Definition at line 1408 of file pico9918.c.
|
inlinestatic |
Definition at line 1422 of file pico9918.c.
|
inlinestatic |
Definition at line 1427 of file pico9918.c.
|
inlinestatic |
Definition at line 1492 of file pico9918.c.
|
inlinestatic |
where one layer reads this scanline from: the vertical scroll and its page swap, the name and colour rows, and the mode's pattern table.
Every mode and both layers come through here, which is what stops the scroll from being written a fourth time.
Position attributes decide the attribute row offset for every mode alike - by name when they are off, ECM0 or not. textMode selects only what a text row does not have: the page bits, in either direction.
Definition at line 1517 of file pico9918.c.
References PICO9918_INST, PICO9918_R49_ROW30, PICO9918_REG_ENHANCED1, PICO9918_REG_PAGE_SIZE, tileRowAddr(), and TMS_R0_DOUBLE_ROWS.
Referenced by f18a_tile_layer_scan_line(), and text_scan_line().
| PICO9918_INLINE_HOT void renderTextRow | ( | pico9918_t * | tms9918, |
| const uint8_t *__restrict | rowNames, | ||
| const TileRowAddr *__restrict | addr, | ||
| const uint8_t *__restrict | rowColors, | ||
| const uint32_t | colorStride, | ||
| uint32_t | pal, | ||
| uint8_t *__restrict | dest, | ||
| const uint32_t | scroll, | ||
| const bool | alwaysOnTop, | ||
| const uint32_t | numCols, | ||
| const bool | isTile2, | ||
| const uint32_t | ecm, | ||
| const bool | blend | ||
| ) |
one 40- or 80-column text row, six pixels a cell at one byte each
colorStride is 0 when the whole row shares one colour pair. At ECM1-3 a cell is an ordinary ECM tile six pixels wide and the fg/bg pair goes inert.
Definition at line 1601 of file pico9918.c.
References PICO9918_R29_TILE_STRIDE, and PICO9918_REG_PAGE_SIZE.
|
static |
Definition at line 1905 of file pico9918.c.
| PICO9918_INLINE_HOT void renderText80Row | ( | pico9918_t * | tms9918, |
| const uint8_t *__restrict | rowNames, | ||
| const uint8_t *__restrict | patternTable, | ||
| const uint8_t *__restrict | rowColors, | ||
| const bool | opaq, | ||
| uint8_t *__restrict | pixels, | ||
| const uint32_t | startCol, | ||
| const uint32_t | numCells, | ||
| const bool | scrolled | ||
| ) |
one 80-column text row, six pixels a cell at half a byte each.
Four cells are twelve bytes, so a group goes out as three words.
scrolled splits it in two. Unscrolled, the colour bytes arrive four at a time as one aligned word and the row cannot wrap, so the colour memo and the four-cell transparent skip both live in that loop. Scrolled, the row starts on an arbitrary cell and wraps to its own first one, so neither holds: the colour table is not word-aligned to the group and the group can straddle the wrap. That clone reads a colour byte a cell and does without the skip.
The fine offset is only ever 0, 2 or 4 pixels, which at 4bpp is a whole number of bytes - so the caller backs the start cell up by that many and moves pixels four bytes per byte of offset, which keeps the three-word store aligned and puts the cells it skipped over in the side border.
Definition at line 1932 of file pico9918.c.
References tmsMainBgColor().
|
inlinestatic |
Definition at line 2082 of file pico9918.c.
|
inlinestatic |
Definition at line 2099 of file pico9918.c.
|
static |
generate a 40- or 80-column text mode scanline.
Text has a path of its own, and hardware says so: it selects a different name address, a different attribute address, a different colour source, a different flip, a different horizontal scroll counter and a different expansion width - six pixels against eight. What it shares with the graphics modes is the fetch schedule, which for us is the address generator above, the sprite pass and the backdrop.
The emitters write the finished line rather than a layer buffer, so the composite runs only where something has to be arbitrated - a bitmap layer, or a priority second layer.
Definition at line 2126 of file pico9918.c.
References PICO9918_INST, PICO9918_R49_TILE2_ENABLE, PICO9918_R50_POS_ATTR, PICO9918_R50_TILE1_OFF, PICO9918_REG_ENHANCED1, PICO9918_REG_ENHANCED2, tileLayerAddr(), tmsMainBgColor(), and tmsMainFgColor().
Referenced by pico9918_scan_line().
|
inlinestatic |
Write full tile to aligned buffer - 8 pixels at once.
Definition at line 2219 of file pico9918.c.
Referenced by renderEcm0Tile(), and renderEcmTileToAlignedBuffer().
|
inlinestatic |
render an ECM0 (enhanced color mode) graphics I tile.
basically the same as original, but can scroll
INLINE: so will be different versions generated, depending on hard-coded (or known at compile-time) arguments
Definition at line 2232 of file pico9918.c.
References tmsTestRowBitsMaskAligned(), tmsUpdateRowBitsMaskAligned(), and writeToAlignedBuffer().
|
inlinestatic |
render one ECM tile into the layer buffer
Definition at line 2282 of file pico9918.c.
References tmsClearRowBitsMask(), tmsTestRowBitsMaskAligned(), tmsUpdateRowBitsMaskAligned(), and writeToAlignedBuffer().
|
inlinestatic |
Definition at line 2382 of file pico9918.c.
| PICO9918_INLINE_HOT void renderTileRowLocked | ( | pico9918_t * | tms9918, |
| uint16_t | rowNamesAddr, | ||
| uint16_t | colorTableAddr, | ||
| uint8_t | tileIndex, | ||
| uint8_t | pal, | ||
| uint8_t | pixels[TMS9918_PIXELS_X], | ||
| const TileRowAddr * | addr, | ||
| const bool | gm2, | ||
| const bool | mcm | ||
| ) |
generate a locked (plain TMS9918) tile row, straight into the scanline
Definition at line 2390 of file pico9918.c.
References PICO9918_INST.
| PICO9918_INLINE_HOT void renderTileRow | ( | pico9918_t * | tms9918, |
| const bool | hpSize, | ||
| uint16_t | rowNamesAddr, | ||
| uint16_t | colorTableAddr, | ||
| uint8_t | tileIndex, | ||
| uint8_t | startPattBit, | ||
| const bool | attrPerPos, | ||
| uint8_t | pal, | ||
| const bool | alwaysOnTop, | ||
| const TileRowAddr * | addr, | ||
| const bool | isTile2, | ||
| const uint32_t | ecm, | ||
| const bool | gm2, | ||
| const bool | mcm | ||
| ) |
Definition at line 2478 of file pico9918.c.
| PICO9918_INLINE_HOT void f18a_tile_layer_scan_line | ( | pico9918_t * | tms9918, |
| uint16_t | y, | ||
| const TileLayerConfig * | config, | ||
| const bool | blend | ||
| ) |
generate a tile mode scanline for either T1 or T2 layer
Inlined into both callers on purpose, not by the compiler's judgement: only there does config fold to a constant, and every field it reads is otherwise a load on a hot line. It sits near the size gcc stops at, so a statement added here has twice silently cost the board a layer.
Definition at line 2571 of file pico9918.c.
References PICO9918_INST, PICO9918_R49_ECM_TILE, PICO9918_R50_POS_ATTR, PICO9918_REG_ENHANCED1, PICO9918_REG_ENHANCED2, PICO9918_REG_PAGE_SIZE, PICO9918_REG_PALETTE_SELECT, PICO9918_REG_T1_HSCROLL, tileLayerAddr(), tmsMainBgColor(), and tmsMainFgColor().
Referenced by f18a_tile1_scan_line(), and f18a_tile2_scan_line().
|
static |
generate a Graphics I mode scanline for the T1 layer
Definition at line 2645 of file pico9918.c.
References f18a_tile_layer_scan_line(), and PICO9918_INST.
Referenced by graphics_i_scan_line().
|
static |
generate a Graphics I mode scanline for the T2 layer
Definition at line 2651 of file pico9918.c.
References f18a_tile_layer_scan_line(), and PICO9918_INST.
Referenced by graphics_i_scan_line().
| PICO9918_INLINE_HOT bool renderBitmapLayerBody | ( | pico9918_t * | tms9918, |
| uint16_t | y, | ||
| bool | opaque, | ||
| const uint8_t | width, | ||
| const uint16_t | addr, | ||
| const uint8_t | bmlCtl, | ||
| uint8_t | pixels[TMS9918_PIXELS_X], | ||
| const bool | wide, | ||
| const bool | intoTile1 | ||
| ) |
generate an F18A bitmap layer scanline
INLINE: so will be different versions generated, depending on hard-coded (or known at compile-time) arguments
Definition at line 2668 of file pico9918.c.
References PICO9918_REG_BML_X, TMS9918_PIXELS_X, and tmsTestRowBitsMask().
|
static |
Definition at line 2822 of file pico9918.c.
|
inlinestatic |
Definition at line 2830 of file pico9918.c.
|
static |
generate an F18A bitmap layer scanline
Definition at line 2839 of file pico9918.c.
References PICO9918_INST, PICO9918_REG_BML_BASE, PICO9918_REG_BML_CONTROL, PICO9918_REG_BML_HEIGHT, PICO9918_REG_BML_TOP_ROW, and PICO9918_REG_BML_WIDTH.
Referenced by graphics_i_scan_line().
|
inlinestatic |
Definition at line 2876 of file pico9918.c.
|
inlinestatic |
Definition at line 2902 of file pico9918.c.
|
inlinestatic |
Definition at line 2930 of file pico9918.c.
|
inlinestatic |
Definition at line 2960 of file pico9918.c.
|
inlinestatic |
Definition at line 2974 of file pico9918.c.
| PICO9918_INLINE_HOT void compositeAlignedBody | ( | pico9918_t * | tms9918, |
| uint8_t | pixels[TMS9918_PIXELS_X], | ||
| const int | t1Scroll, | ||
| const int | t2Scroll, | ||
| const bool | wide | ||
| ) |
Definition at line 2996 of file pico9918.c.
|
static |
Definition at line 3106 of file pico9918.c.
|
static |
Definition at line 3114 of file pico9918.c.
|
inlinestatic |
Definition at line 3121 of file pico9918.c.
|
static |
Composite with tile layer 1 disabled (reg 0x32 bit 4).
Layer 1 contributes no pixel at all, so every position the selection mask leaves to it must keep whatever the backdrop, bitmap layer and sprites already put there - the colour stage falls through to the backdrop for a transparent merged pixel. Writing layer 1's buffer, or a zero buffer, would paint palette entry 0 instead.
Definition at line 3141 of file pico9918.c.
References TMS9918_PIXELS_X.
Referenced by graphics_i_scan_line().
|
static |
A text row draws 240 of the 256 pixels and the composite copies all of them, so layer 1's buffer has to carry the side borders itself.
The row is emitted on cell boundaries and read back t1Scroll pixels along, so the border moves with the scroll - and the cells that fall outside it either side are overwritten here rather than never written.
Definition at line 3185 of file pico9918.c.
Referenced by graphics_i_scan_line().
|
static |
generate a Graphics I or Graphics II mode scanline
Definition at line 3199 of file pico9918.c.
References bitmap_layer_scan_line(), compositeTile2OnlyBuffer(), f18a_tile1_scan_line(), f18a_tile2_scan_line(), PICO9918_INST, PICO9918_R31_BML_ENABLE, PICO9918_R49_ECM_TILE, PICO9918_R49_TILE2_ENABLE, PICO9918_R50_TILE1_OFF, PICO9918_REG_BML_CONTROL, PICO9918_REG_ENHANCED1, PICO9918_REG_ENHANCED2, PICO9918_REG_T1_HSCROLL, PICO9918_REG_T2_HSCROLL, textRowBorder(), tileRowAddr(), TMS9918_PIXELS_X, tmsColorTableAddr(), and tmsNameTableAddr().
Referenced by pico9918_scan_line().
| uint8_t pico9918_scan_line | ( | pico9918_t * | tms9918, |
| uint16_t | y | ||
| ) |
generate a scanline
Read it back with pico9918_line_source and pico9918_line_bytes: how wide a line is and which buffer holds it are both properties of the mode and the build, so the library owns the memory.
Definition at line 3335 of file pico9918.c.
References graphics_i_scan_line(), PICO9918_INST, PICO9918_INST_ONLY, pico9918_line_bytes(), PICO9918_R24_TILE1_PS, PICO9918_REG_PALETTE_SELECT, text_scan_line(), TMS_R1_DISP_ACTIVE, and tmsMainBgColor().
Referenced by pico9918_frame_scanline().
| uint8_t pico9918_reg_value | ( | pico9918_t * | tms9918, |
| pico9918_register_t | reg | ||
| ) |
return a register value - see the header for the locked-device aliasing
return a register value
Definition at line 3420 of file pico9918.c.
| uint8_t pico9918_status_value | ( | pico9918_t * | tms9918, |
| pico9918_status_register_t | reg | ||
| ) |
return a status register value without the side effects of reading it
return a status register value, without the side effects of reading it
Definition at line 3427 of file pico9918.c.
References PICO9918_R15_STATUS_NUM.
| PICO9918_INTERNAL void pico9918_write_reg_value_impl | ( | pico9918_t * | tms9918, |
| uint8_t | regSelect, | ||
| uint8_t | value | ||
| ) |
set a register from the second byte of a host register write
regSelect is that byte, not a register number: bit 7 set, the register in the low six. The locked-mask aliasing and the M4 rule are both defined on it, which is why it is not a pico9918_register_t. Carries the unlock sequence, the GPU arming writes, the palette rebuild, and the /INT reconcile on the three writes that can change the pin - R0, R1 and the unlock latch. Out of line, unlike its neighbours here: it is large, and the inline entry below is its only hot caller.
Definition at line 3433 of file pico9918.c.
References PICO9918_CONFIG_FIRST_SETTABLE, PICO9918_INST_ONLY, PICO9918_R50_RESET, PICO9918_R56_GPU_RUN, PICO9918_REG_CONFIG_INDEX, PICO9918_REG_CONFIG_VALUE, PICO9918_REG_ENHANCED2, PICO9918_REG_FLASH_CONTROL, PICO9918_REG_GPU_CONTROL, PICO9918_REG_GPU_PC_LSB, PICO9918_REG_GPU_PC_MSB, PICO9918_REG_MAX_SCAN_SPRITES, PICO9918_REG_STATUS_SELECT, PICO9918_REG_UNLOCK, PICO9918_SR_CONFIG_VALUE, PICO9918_SR_GPU, PICO9918_SR_MICROS_LSB, PICO9918_SR_MICROS_MSB, PICO9918_SR_MILLIS_LSB, PICO9918_SR_MILLIS_MSB, PICO9918_SR_SECONDS_LSB, PICO9918_SR_SECONDS_MSB, and pico9918_write_reconcile_int_impl().
Referenced by pico9918_write_addr_impl().
| uint8_t pico9918_vram_value | ( | pico9918_t * | tms9918, |
| uint16_t | addr | ||
| ) |
return a value from vram
Definition at line 3573 of file pico9918.c.
| bool pico9918_display_enabled | ( | pico9918_t * | tms9918 | ) |
check BLANK flag
check the BLANK flag
Definition at line 3580 of file pico9918.c.
References TMS_R1_DISP_ACTIVE.
| pico9918_mode_t pico9918_display_mode | ( | pico9918_t * | tms9918 | ) |
current display mode
the current display mode
Definition at line 3587 of file pico9918.c.
Referenced by pico9918_diag_update().
| void pico9918_debug_sync_mode_impl | ( | pico9918_t * | tms9918 | ) |
see impl/pico9918_priv.h.
What the scanline entry does, for a caller between two.
Definition at line 3594 of file pico9918.c.
Referenced by pico9918_debug_reg_write().
| uint32_t pico9918_line_bytes | ( | pico9918_t * | tms9918 | ) |
how many bytes of pixels[] this mode fills.
how many bytes of the line the current mode fills: 256, or 512 for unlocked 80-column text on a board built with the 8bpp tier
Every mode is 256 but unlocked 80-column text on a board with the 8bpp tier, which is 512 - so the palette expansion, the backdrop fill and anything reading the line ask here rather than each deciding it again.
Definition at line 3606 of file pico9918.c.
References TMS9918_PIXELS_X.
Referenced by pico9918_scan_line().
| const uint8_t * pico9918_line_source | ( | pico9918_t * | tms9918 | ) |
where the scanline just generated actually is.
where the scanline just generated actually is - the arbitration buffer, or a tile layer's own buffer on a line that needed no compositing
Usually the buffer that was passed in, but on a line with nothing to arbitrate it is a tile layer's own buffer and the passed one holds only the backdrop fill - so read the line from here rather than from what was handed over.
Definition at line 3617 of file pico9918.c.
| uint16_t pico9918_default_palette | ( | int | index | ) |
a default palette entry, 0xargb
a default palette value, 0x0rgb
Definition at line 3624 of file pico9918.c.
Referenced by pico9918_config_defaults().
|
static |
Definition at line 166 of file pico9918.c.
|
static |
Definition at line 276 of file pico9918.c.
|
static |
Definition at line 492 of file pico9918.c.
| rowMasks |
Definition at line 512 of file pico9918.c.
|
static |
Definition at line 734 of file pico9918.c.
|
static |
Definition at line 809 of file pico9918.c.
| bool lookupsReady = false |
Definition at line 826 of file pico9918.c.
|
static |
Definition at line 1448 of file pico9918.c.
|
static |
Definition at line 1461 of file pico9918.c.
|
static |
Definition at line 1564 of file pico9918.c.
|
static |
Definition at line 1575 of file pico9918.c.
|
static |
Definition at line 1885 of file pico9918.c.
|
static |
Definition at line 1911 of file pico9918.c.
|
static |
Definition at line 2560 of file pico9918.c.
|
static |
Definition at line 2656 of file pico9918.c.
| const uint8_t* pico9918_cached_line_source = 0 |
Definition at line 2662 of file pico9918.c.