pico9918-core 1.3.0
TMS9918A / F18A video display processor emulation in C99
Loading...
Searching...
No Matches
pico9918.c File Reference

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 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
 
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
 
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
 

Detailed Description

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.

Macro Definition Documentation

◆ EMITTER_NOINLINE

#define EMITTER_NOINLINE   PICO9918_NOINLINE

Definition at line 26 of file pico9918.c.

◆ MASK_NEXT_PIXEL

#define MASK_NEXT_PIXEL   0x80000000u

Definition at line 443 of file pico9918.c.

◆ TEXT_SCROLL_CELL

#define TEXT_SCROLL_CELL (   s)    ((s) & 0xffffu)

Definition at line 1343 of file pico9918.c.

◆ TEXT_SCROLL_OFFSET

#define TEXT_SCROLL_OFFSET (   s)    ((s) >> 16)

Definition at line 1344 of file pico9918.c.

◆ TEXT80_COLOR_WORD

#define TEXT80_COLOR_WORD (   n)    ((uint32_t)((n) * 0x111111u))

Definition at line 1496 of file pico9918.c.

◆ TEXT80_MASK_WORD

#define TEXT80_MASK_WORD (   bits)
Value:
(((uint32_t)((bits) & 0x20 ? 0x0000F0u : 0x0)) | ((uint32_t)((bits) & 0x10 ? 0x00000Fu : 0x0)) | \
((uint32_t)((bits) & 0x08 ? 0x00F000u : 0x0)) | ((uint32_t)((bits) & 0x04 ? 0x000F00u : 0x0)) | \
((uint32_t)((bits) & 0x02 ? 0xF00000u : 0x0)) | ((uint32_t)((bits) & 0x01 ? 0x0F0000u : 0x0)))

Definition at line 1497 of file pico9918.c.

◆ TEXT80_MASK_WORD4

#define TEXT80_MASK_WORD4 (   bits)     TEXT80_MASK_WORD(bits), TEXT80_MASK_WORD(bits), TEXT80_MASK_WORD(bits), TEXT80_MASK_WORD(bits)

Definition at line 1510 of file pico9918.c.

◆ TEXT40_NEXT_CELL

#define TEXT40_NEXT_CELL ( )
Value:
const uint32_t name = *names++; \
const uint8_t color = colors[name & nameAttrMask]; \
colors += colorStride;

◆ TEXT_ROW_PARAMS

#define TEXT_ROW_PARAMS
Value:
PICO9918_INST_ARG 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
#define PICO9918_INST_ARG
declare the instance ahead of other parameters
Definition pico9918.h:71

Definition at line 1803 of file pico9918.c.

◆ TEXT_ROW_CLONE

#define TEXT_ROW_CLONE (   name,
  cols,
  t2,
 
)
Value:
static EMITTER_NOINLINE void __time_critical_func(name)(TEXT_ROW_PARAMS) \
{ \
renderTextRow(PICO9918_INST rowNames, addr, rowColors, colorStride, pal, dest, scroll, alwaysOnTop, \
cols, t2, e, false); \
}
#define PICO9918_INST
pass the instance ahead of other arguments
Definition pico9918.h:73

Definition at line 1807 of file pico9918.c.

◆ TEXT80_NEXT_CELL

#define TEXT80_NEXT_CELL ( )
Value:
{ \
++rowNamesTable; \
if (scrolled && ++col == TEXT80_NUM_COLS) \
{ \
col = 0; \
rowNamesTable = rowNames; \
colors = rowColors; \
} \
else if (scrolled) \
++colors; \
}

◆ TEXT80_OPAQUE_CELL

#define TEXT80_OPAQUE_CELL ( )
Value:
{ \
uint8_t color; \
if (scrolled) \
color = *colors; \
else \
{ \
color = (uint8_t)colorWord; \
colorWord >>= 8; \
} \
if (color != lastColor) \
{ \
const uint8_t bgColor = color & 0xf; \
const uint8_t fgColor = color >> 4; \
bgColorMask = text80ColorWord[bgColor ? bgColor : bgc]; \
diffColorMask = bgColorMask ^ text80ColorWord[fgColor ? fgColor : bgc]; \
lastColor = color; \
} \
const uint32_t mask = text80MaskWord[patternTable[*rowNamesTable * PATTERN_BYTES]]; \
TEXT80_NEXT_CELL(); \
word = bgColorMask ^ (diffColorMask & mask); \
}

◆ TEXT80_OVERLAY_CELL

#define TEXT80_OVERLAY_CELL ( )
Value:
{ \
const uint32_t mask = text80MaskWord[patternTable[*rowNamesTable * PATTERN_BYTES]]; \
uint8_t colorByte; \
if (scrolled) \
colorByte = *colors; \
else \
{ \
colorByte = (uint8_t)colorWord; \
colorWord >>= 8; \
} \
TEXT80_NEXT_CELL(); \
const uint32_t fgWord = text80ColorWord[colorByte >> 4]; \
const uint32_t bgWord = text80ColorWord[colorByte & 0xf]; \
const uint32_t fgSel = fgWord ? mask : 0; \
const uint32_t bgSel = bgWord ? (~mask & 0xffffffu) : 0; \
sel = fgSel | bgSel; \
val = (fgWord & fgSel) | (bgWord & bgSel); \
}

◆ TEXT80_OVERLAY_STORE

#define TEXT80_OVERLAY_STORE (   shift)
Value:
{ \
const uint32_t m = accSel | (sel << (shift)); \
const uint32_t v = accVal | (val << (shift)); \
const uint32_t old = *pix32; \
*pix32++ = old ^ ((old ^ v) & m); \
}

◆ TEXT80_ROW_CLONE

#define TEXT80_ROW_CLONE (   name,
  cells,
  scroll 
)
Value:
static EMITTER_NOINLINE void __time_critical_func(name)( \
PICO9918_INST_ARG 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) \
{ \
renderText80Row(PICO9918_INST rowNames, patternTable, rowColors, opaq, pixels, startCol, cells, \
scroll); \
}

Definition at line 2008 of file pico9918.c.

◆ LOCKED_ROW_CLONE

#define LOCKED_ROW_CLONE (   name,
  g,
 
)
Value:
static void __time_critical_func(name)(PICO9918_INST_ARG uint16_t rowNamesAddr, uint16_t colorTableAddr, \
uint8_t tileIndex, uint8_t pal, uint8_t pixels[TMS9918_PIXELS_X], \
const TileRowAddr* addr) \
{ \
renderTileRowLocked(PICO9918_INST rowNamesAddr, colorTableAddr, tileIndex, pal, pixels, addr, g, m); \
}
#define TMS9918_PIXELS_X
active display width, every mode
Definition pico9918.h:376

Definition at line 2374 of file pico9918.c.

◆ TILE_ROW_PARAMS

#define TILE_ROW_PARAMS
Value:
PICO9918_INST_ARG 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

Definition at line 2398 of file pico9918.c.

◆ TILE_ROW_ARGS

#define TILE_ROW_ARGS
Value:
PICO9918_INST hpSize, rowNamesAddr, colorTableAddr, tileIndex, startPattBit, attrPerPos, pal, alwaysOnTop, \
addr

Definition at line 2402 of file pico9918.c.

◆ TILE_ROW_CLONE

#define TILE_ROW_CLONE (   name,
  t2,
  e,
  g,
 
)
Value:
static void __time_critical_func(name)(TILE_ROW_PARAMS) \
{ \
renderTileRow(TILE_ROW_ARGS, t2, e, g, m); \
}

Definition at line 2465 of file pico9918.c.

◆ TILE_ROW_GM2

#define TILE_ROW_GM2   4

Definition at line 2486 of file pico9918.c.

◆ TILE_ROW_MCM

#define TILE_ROW_MCM   5

Definition at line 2487 of file pico9918.c.

◆ UNDER_PIXEL

#define UNDER_PIXEL (   n)
Value:
if (!hasSprites || !(spriteMask & MASK_NEXT_PIXEL)) \
{ \
const uint8_t pixel = (mask & MASK_NEXT_PIXEL) ? layer2[n] : layer1[n]; \
if (pixel) pixels[n] = pixel; \
} \
mask <<= 1; \
if (hasSprites) spriteMask <<= 1;

◆ MIXED_PIXEL

#define MIXED_PIXEL (   n)
Value:
if (!hasSprites || !(spriteMask & MASK_NEXT_PIXEL)) \
{ \
pixels[n] = (mask & MASK_NEXT_PIXEL) ? layer2[n] : layer1[n]; \
} \
mask <<= 1; \
if (hasSprites) spriteMask <<= 1;

Typedef Documentation

◆ BitMask

typedef uint32_t BitMask[9]

Definition at line 438 of file pico9918.c.

◆ TileMask

typedef uint32_t TileMask[SCANLINE_MASK_WORDS]

Definition at line 439 of file pico9918.c.

Function Documentation

◆ PICO9918_SECTION_SCRATCH_X() [1/2]

static PICO9918_SECTION_SCRATCH_X ( buffer  )
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().

◆ tmsMode()

static pico9918_mode_t tmsMode ( pico9918_t *  tms9918)
inlinestatic

Definition at line 115 of file pico9918.c.

◆ tmsSpriteSize()

static uint8_t tmsSpriteSize ( pico9918_t *  tms9918)
inlinestatic

sprite size (8 or 16)

Definition at line 134 of file pico9918.c.

References TMS_R1_SPRITE_16.

Referenced by renderSprites().

◆ tmsSpriteMag()

static bool tmsSpriteMag ( pico9918_t *  tms9918)
inlinestatic

sprite size (0 = 1x, 1 = 2x)

Definition at line 140 of file pico9918.c.

References TMS_R1_SPRITE_MAG2.

◆ tmsNameTableAddr()

static uint16_t tmsNameTableAddr ( pico9918_t *  tms9918)
inlinestatic

name table base address

Definition at line 146 of file pico9918.c.

Referenced by graphics_i_scan_line().

◆ tmsNameTable2Addr()

static uint16_t tmsNameTable2Addr ( pico9918_t *  tms9918)
inlinestatic

name table base address

Definition at line 152 of file pico9918.c.

References PICO9918_REG_NAME_TABLE2.

◆ tmsColorTableAddr()

static uint16_t tmsColorTableAddr ( pico9918_t *  tms9918)
inlinestatic

color table base address

Definition at line 158 of file pico9918.c.

Referenced by graphics_i_scan_line().

◆ tmsColorTable2Addr()

static uint16_t tmsColorTable2Addr ( pico9918_t *  tms9918)
inlinestatic

color table base address

Definition at line 166 of file pico9918.c.

References PICO9918_REG_COLOR_TABLE2.

◆ tmsPatternTableAddr()

static uint16_t tmsPatternTableAddr ( pico9918_t *  tms9918)
inlinestatic

pattern table base address

Definition at line 174 of file pico9918.c.

Referenced by tileRowAddr().

◆ tmsSpriteAttrTableAddr()

static uint16_t tmsSpriteAttrTableAddr ( pico9918_t *  tms9918)
inlinestatic

sprite attribute table base address

Definition at line 182 of file pico9918.c.

◆ tmsSpritePatternTableAddr()

static uint16_t tmsSpritePatternTableAddr ( pico9918_t *  tms9918)
inlinestatic

sprite pattern table base address

Definition at line 188 of file pico9918.c.

Referenced by renderSprites().

◆ tmsMainBgColor()

static pico9918_color_t tmsMainBgColor ( pico9918_t *  tms9918)
inlinestatic

◆ tmsMainFgColor()

static pico9918_color_t tmsMainFgColor ( pico9918_t *  tms9918)
inlinestatic

foreground color

Definition at line 200 of file pico9918.c.

References tmsMainBgColor().

Referenced by f18a_tile_layer_scan_line(), and text_scan_line().

◆ tmsFgColor()

static pico9918_color_t tmsFgColor ( pico9918_t *  tms9918,
uint8_t  colorByte 
)
inlinestatic

foreground color

Definition at line 207 of file pico9918.c.

References tmsMainBgColor().

◆ tmsBgColor()

static pico9918_color_t tmsBgColor ( pico9918_t *  tms9918,
uint8_t  colorByte 
)
inlinestatic

background color

Definition at line 214 of file pico9918.c.

References tmsMainBgColor().

◆ vdpRegisterReset()

static PICO9918_NOINLINE void vdpRegisterReset ( pico9918_t *  tms9918)
static

Definition at line 236 of file pico9918.c.

◆ chipFeatures()

static uint8_t chipFeatures ( pico9918_chip_t  chip)
static

the feature bits a personality answers to - the ladder, in one place

Definition at line 259 of file pico9918.c.

References PICO9918_CHIP_F18A, PICO9918_CHIP_PICO9918, PICO9918_CHIP_PICO9918_PRO, and PICO9918_CHIP_TMS9918A.

Referenced by pico9918_set_chip().

◆ 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 from an unlocked personality relocks the device, because the register file it would otherwise leave visible is not one a TMS9918A has.

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.

Definition at line 276 of file pico9918.c.

References chipFeatures(), PICO9918_CHIP_MAX, PICO9918_CHIP_PICO9918_PRO, PICO9918_REG_GPU_CONTROL, pico9918_splash_select_pro(), and PICO9918_SR_IDENT.

Referenced by PICO9918_SECTION_SCRATCH_X().

◆ pico9918_chip()

pico9918_chip_t pico9918_chip ( pico9918_t *  tms9918)

which chip this instance answers as

Definition at line 310 of file pico9918.c.

◆ pico9918_reset()

void pico9918_reset ( pico9918_t *  tms9918)

reset the new TMS9918

reset the TMS9918

Definition at line 318 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().

◆ pico9918_destroy()

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 360 of file pico9918.c.

◆ pico9918_write_addr()

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 373 of file pico9918.c.

References PICO9918_INST, and pico9918_write_addr_impl().

Referenced by pico9918_set_address_read(), and pico9918_write_register_value().

◆ pico9918_read_status()

uint8_t pico9918_read_status ( pico9918_t *  tms9918)

read from the status register

Definition at line 379 of file pico9918.c.

References PICO9918_INST_ONLY, and pico9918_read_status_impl().

◆ pico9918_peek_status()

uint8_t pico9918_peek_status ( pico9918_t *  tms9918)

read from the status register without resetting it

Definition at line 385 of file pico9918.c.

References PICO9918_INST_ONLY, and pico9918_peek_status_impl().

◆ pico9918_write_data()

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 395 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().

◆ pico9918_read_data()

uint8_t pico9918_read_data ( pico9918_t *  tms9918)

read data (mode = 0) from the tms9918

Definition at line 402 of file pico9918.c.

References PICO9918_INST_ONLY, and pico9918_read_data_impl().

◆ pico9918_read_data_no_inc()

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 408 of file pico9918.c.

References PICO9918_INST_ONLY, and pico9918_read_data_no_inc_impl().

◆ pico9918_interrupt_status()

bool pico9918_interrupt_status ( pico9918_t *  tms9918)

return true if both INT status and INT control set

true if both the INT status and the INT control bit are set

Definition at line 414 of file pico9918.c.

References PICO9918_INST_ONLY, and pico9918_interrupt_status_impl().

◆ pico9918_interrupt_set()

void pico9918_interrupt_set ( pico9918_t *  tms9918)

raise the INT status flag

set the interrupt flag

Definition at line 420 of file pico9918.c.

References PICO9918_INST_ONLY, and pico9918_interrupt_set_impl().

◆ pico9918_set_status()

void pico9918_set_status ( pico9918_t *  tms9918,
uint8_t  status 
)

set status flag

set the status flags

Definition at line 427 of file pico9918.c.

References PICO9918_INST, and pico9918_set_status_impl().

◆ PICO9918_SECTION_SCRATCH_X() [2/2]

static PICO9918_SECTION_SCRATCH_X ( lookup  )
static

Definition at line 447 of file pico9918.c.

◆ tmsTestCollisionMask()

static uint32_t tmsTestCollisionMask ( const uint32_t  xPos,
const uint32_t  spritePixels,
const uint32_t  spriteWidth 
)
inlinestatic

Test and update the sprite collision mask.

Definition at line 455 of file pico9918.c.

Referenced by renderSprites().

◆ tmsSetTransparentSpriteMask()

static void tmsSetTransparentSpriteMask ( const uint32_t  xPos,
const uint32_t  spritePixels,
const uint32_t  spriteWidth 
)
inlinestatic

set the transparent sprite mask.

Definition at line 479 of file pico9918.c.

Referenced by renderSprites().

◆ tmsClearRowBitsMask()

static void tmsClearRowBitsMask ( const uint32_t  xPos,
const uint32_t  tilePixels,
const uint32_t  tileWidth,
BitMask  rowBitsMask 
)
inlinestatic

Clear the row pixels bit mask.

Definition at line 496 of file pico9918.c.

Referenced by renderEcmTileToAlignedBuffer().

◆ tmsUpdateRowBitsMaskAligned()

static void tmsUpdateRowBitsMaskAligned ( const uint32_t  xPos,
const uint32_t  tilePixels,
BitMask  rowBitsMask 
)
inlinestatic

Update the row pixels bit mask (aligned - no word boundary crossing).

Definition at line 515 of file pico9918.c.

Referenced by renderEcm0Tile(), and renderEcmTileToAlignedBuffer().

◆ tmsTestRowBitsMaskAligned()

static uint32_t tmsTestRowBitsMaskAligned ( const uint32_t  xPos,
const uint32_t  tilePixels,
const BitMask  rowBitsMask 
)
inlinestatic

Test against the row pixels bit mask (aligned - no word boundary crossing).

Definition at line 522 of file pico9918.c.

Referenced by renderEcm0Tile(), and renderEcmTileToAlignedBuffer().

◆ tmsCopyAlignMask()

static PICO9918_NOINLINE void tmsCopyAlignMask ( TileMask  dstMask,
const TileMask  srcMask,
int  pixelShift 
)
static

Definition at line 530 of file pico9918.c.

◆ tmsRestoreAlignMask()

static PICO9918_NOINLINE void tmsRestoreAlignMask ( TileMask  dstMask,
const TileMask  srcMask,
int  pixelShift,
int  otherShift 
)
static

Definition at line 589 of file pico9918.c.

◆ tmsTestRowBitsMask()

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 
)
inlinestatic

Test and update the row pixels bit mask.

Definition at line 597 of file pico9918.c.

Referenced by renderBitmapLayerBody().

◆ ecmByte()

static uint8_t ecmByte ( bool  h,
bool  m,
bool  l 
)
static

Definition at line 640 of file pico9918.c.

◆ ecmLookupInit()

static void ecmLookupInit ( void  )
static

Definition at line 649 of file pico9918.c.

◆ repeatedPalette()

static uint32_t repeatedPalette ( const uint32_t  index)
inlinestatic

Definition at line 721 of file pico9918.c.

◆ initLookups()

void initLookups ( void  )

Definition at line 767 of file pico9918.c.

◆ ecmSplitQuads()

static uint32_t ecmSplitQuads ( const uint32_t  patt)
inlinestatic

Definition at line 796 of file pico9918.c.

◆ calculateEcmIndex()

static uint32_t calculateEcmIndex ( const uint32_t  ecm,
const uint32_t  sb0,
const uint32_t  sb1,
const uint32_t  sb2 
)
inlinestatic

Definition at line 809 of file pico9918.c.

◆ loadSpriteData()

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 
)
inlinestatic

Definition at line 826 of file pico9918.c.

◆ spriteEcm()

static uint32_t spriteEcm ( pico9918_t *  tms9918)
inlinestatic

the sprite ECM level, zero on a locked device - the one term a clone can pin

Definition at line 919 of file pico9918.c.

References PICO9918_R49_ECM_SPRITE, and PICO9918_REG_ENHANCED1.

Referenced by renderSprites().

◆ renderSprites()

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] 
)
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 928 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().

◆ pico9918_output_sprites()

static uint8_t pico9918_output_sprites ( pico9918_t *  tms9918,
uint16_t  y,
uint8_t  pixels[TMS9918_PIXELS_X] 
)
static

Definition at line 1251 of file pico9918.c.

◆ tileRowAddr()

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 
)
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 1306 of file pico9918.c.

References tmsPatternTableAddr().

Referenced by graphics_i_scan_line(), and tileLayerAddr().

◆ textScrollCell()

static uint32_t textScrollCell ( const uint32_t  hscrollPixels)
inlinestatic

Definition at line 1332 of file pico9918.c.

◆ textScrollSplit()

static uint32_t textScrollSplit ( const uint32_t  hscroll,
const bool  wide 
)
inlinestatic

Definition at line 1346 of file pico9918.c.

◆ textPixelOffset()

static uint32_t textPixelOffset ( const uint32_t  hscroll,
const bool  wide 
)
inlinestatic

Definition at line 1360 of file pico9918.c.

◆ scrollOffset()

static int scrollOffset ( const uint32_t  hscroll,
const bool  text,
const bool  wide 
)
inlinestatic

Definition at line 1365 of file pico9918.c.

◆ textScroll80()

static TextScroll textScroll80 ( pico9918_t *  tms9918,
const TileLayerConfig config 
)
inlinestatic

Definition at line 1430 of file pico9918.c.

◆ tileLayerAddr()

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 
)
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 1455 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().

◆ renderTextRow()

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 1539 of file pico9918.c.

References PICO9918_R29_TILE_STRIDE, and PICO9918_REG_PAGE_SIZE.

◆ text80RowT2Blend()

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 
)
static

Definition at line 1843 of file pico9918.c.

◆ renderText80Row()

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 1870 of file pico9918.c.

References tmsMainBgColor().

◆ renderText80Layer()

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 
)
inlinestatic

Definition at line 2020 of file pico9918.c.

◆ text80TwoTone()

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 
)
inlinestatic

Definition at line 2037 of file pico9918.c.

◆ text_scan_line()

static void text_scan_line ( pico9918_t *  tms9918,
uint16_t  y,
uint8_t  pixels[TMS9918_PIXELS_X] 
)
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 2064 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().

◆ writeToAlignedBuffer()

static void writeToAlignedBuffer ( uint8_t *  buffer,
uint32_t  xPos,
const uint32_t  left,
const uint32_t  right 
)
inlinestatic

Write full tile to aligned buffer - 8 pixels at once.

Definition at line 2157 of file pico9918.c.

Referenced by renderEcm0Tile(), and renderEcmTileToAlignedBuffer().

◆ renderEcm0Tile()

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 
)
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 2170 of file pico9918.c.

References tmsTestRowBitsMaskAligned(), tmsUpdateRowBitsMaskAligned(), and writeToAlignedBuffer().

◆ renderEcmTileToAlignedBuffer()

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 
)
inlinestatic

render one ECM tile into the layer buffer

Definition at line 2220 of file pico9918.c.

References tmsClearRowBitsMask(), tmsTestRowBitsMaskAligned(), tmsUpdateRowBitsMaskAligned(), and writeToAlignedBuffer().

◆ lockedFgBg()

static void lockedFgBg ( pico9918_t *  tms9918,
uint32_t  fgbg[2],
const uint8_t  pal,
const uint32_t  colorByte 
)
inlinestatic

Definition at line 2320 of file pico9918.c.

◆ renderTileRowLocked()

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 2328 of file pico9918.c.

References PICO9918_INST.

◆ renderTileRow()

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 2406 of file pico9918.c.

◆ f18a_tile_layer_scan_line()

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 2499 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().

◆ f18a_tile1_scan_line()

static void f18a_tile1_scan_line ( pico9918_t *  tms9918,
uint16_t  y 
)
static

generate a Graphics I mode scanline for the T1 layer

Definition at line 2573 of file pico9918.c.

References f18a_tile_layer_scan_line(), and PICO9918_INST.

Referenced by graphics_i_scan_line().

◆ f18a_tile2_scan_line()

static void f18a_tile2_scan_line ( pico9918_t *  tms9918,
uint16_t  y,
const bool  blend 
)
static

generate a Graphics I mode scanline for the T2 layer

Definition at line 2579 of file pico9918.c.

References f18a_tile_layer_scan_line(), and PICO9918_INST.

Referenced by graphics_i_scan_line().

◆ renderBitmapLayerBody()

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 2596 of file pico9918.c.

References PICO9918_REG_BML_X, TMS9918_PIXELS_X, and tmsTestRowBitsMask().

◆ renderBitmapLayer80()

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

Definition at line 2750 of file pico9918.c.

◆ renderBitmapLayer40()

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] 
)
inlinestatic

Definition at line 2758 of file pico9918.c.

◆ bitmap_layer_scan_line()

static bool bitmap_layer_scan_line ( pico9918_t *  tms9918,
uint16_t  y,
uint8_t  pixels[TMS9918_PIXELS_X],
const bool  intoTile1 
)
static

generate an F18A bitmap layer scanline

Definition at line 2767 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().

◆ compositeChunkWide()

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 
)
inlinestatic

Definition at line 2804 of file pico9918.c.

◆ compositeChunkUnder()

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 
)
inlinestatic

Definition at line 2830 of file pico9918.c.

◆ compositeChunkBytes()

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 
)
inlinestatic

Definition at line 2858 of file pico9918.c.

◆ spriteGridWord()

static uint32_t spriteGridWord ( const uint32_t  maskWord,
const BitMask  mask,
const bool  wide 
)
inlinestatic

Definition at line 2888 of file pico9918.c.

◆ overlaySpritesOnTile1()

static void overlaySpritesOnTile1 ( uint32_t *__restrict  dst,
const uint32_t *__restrict  src,
const bool  wide 
)
inlinestatic

Definition at line 2902 of file pico9918.c.

◆ compositeAlignedBody()

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 2924 of file pico9918.c.

◆ compositeAligned40()

static void compositeAligned40 ( pico9918_t *  tms9918,
uint8_t  pixels[TMS9918_PIXELS_X],
const int  t1Scroll,
const int  t2Scroll 
)
static

Definition at line 3034 of file pico9918.c.

◆ compositeAligned80()

static void compositeAligned80 ( pico9918_t *  tms9918,
uint8_t  pixels[TMS9918_PIXELS_X],
const int  t1Scroll,
const int  t2Scroll 
)
static

Definition at line 3042 of file pico9918.c.

◆ compositeAlignedTileBuffers()

static void compositeAlignedTileBuffers ( pico9918_t *  tms9918,
uint8_t  pixels[TMS9918_PIXELS_X],
const int  t1Scroll,
const int  t2Scroll,
const bool  wide 
)
inlinestatic

Definition at line 3049 of file pico9918.c.

◆ compositeTile2OnlyBuffer()

static PICO9918_NOINLINE void compositeTile2OnlyBuffer ( pico9918_t *  tms9918,
uint8_t  pixels[TMS9918_PIXELS_X],
const int  t2Scroll,
const bool  wide 
)
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 3069 of file pico9918.c.

References TMS9918_PIXELS_X.

Referenced by graphics_i_scan_line().

◆ textRowBorder()

static void textRowBorder ( pico9918_t *  tms9918,
const int  t1Scroll,
const uint32_t  padding,
const uint32_t  width 
)
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 3113 of file pico9918.c.

Referenced by graphics_i_scan_line().

◆ graphics_i_scan_line()

◆ 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 3256 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().

◆ pico9918_reg_value()

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 3329 of file pico9918.c.

◆ pico9918_status_value()

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 3336 of file pico9918.c.

References PICO9918_R15_STATUS_NUM.

◆ pico9918_write_reg_value_impl()

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 3342 of file pico9918.c.

References 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().

◆ pico9918_vram_value()

uint8_t pico9918_vram_value ( pico9918_t *  tms9918,
uint16_t  addr 
)

return a value from vram

Definition at line 3485 of file pico9918.c.

◆ pico9918_display_enabled()

bool pico9918_display_enabled ( pico9918_t *  tms9918)

check BLANK flag

check the BLANK flag

Definition at line 3492 of file pico9918.c.

References TMS_R1_DISP_ACTIVE.

◆ pico9918_display_mode()

pico9918_mode_t pico9918_display_mode ( pico9918_t *  tms9918)

current display mode

the current display mode

Definition at line 3499 of file pico9918.c.

Referenced by pico9918_diag_update().

◆ pico9918_debug_sync_mode_impl()

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 3506 of file pico9918.c.

Referenced by pico9918_debug_reg_write().

◆ pico9918_line_bytes()

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 3518 of file pico9918.c.

References TMS9918_PIXELS_X.

Referenced by pico9918_scan_line().

◆ pico9918_line_source()

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 3529 of file pico9918.c.

◆ pico9918_default_palette()

uint16_t pico9918_default_palette ( int  index)

a default palette entry, 0xargb

a default palette value, 0x0rgb

Definition at line 3536 of file pico9918.c.

Referenced by pico9918_config_defaults().

Variable Documentation

◆ r1Modes

const pico9918_mode_t r1Modes[]
static
Initial value:
= {TMS_MODE_GRAPHICS_I, TMS_MODE_MULTICOLOR, TMS_MODE_TEXT,
TMS_MODE_GRAPHICS_I}

Definition at line 112 of file pico9918.c.

◆ defaultPalette

const uint16_t defaultPalette[]
static
Initial value:
= {
0x0000, 0xF000, 0xF2C3, 0xF5D6, 0xF54F, 0xF76F, 0xFD54, 0xF4EF, 0xFF54, 0xFF76, 0xFDC3, 0xFED6, 0xF2B2,
0xFC5C, 0xFCCC, 0xFFFF,
0x0000, 0xF2C3, 0xF000, 0xF54F, 0xF000, 0xFD54, 0xF000, 0xF4EF, 0xF000, 0xFCCC, 0xF000, 0xFDC3, 0xF000,
0xFC5C, 0xF000, 0xFFFF,
0x0000, 0xF00A, 0xF0A0, 0xF0AA, 0xFA00, 0xFA0A, 0xFA50, 0xFAAA, 0xF555, 0xF55F, 0xF5F5, 0xF5FF, 0xFF55,
0xFF5F, 0xFFF5, 0xFFFF,
0x0000, 0xF555, 0xF000, 0xF00A, 0xF000, 0xF0A0, 0xF000, 0xF0AA, 0xF000, 0xFA00, 0xF000, 0xFA0A, 0xF000,
0xFA50, 0xF000, 0xFFFF}

Definition at line 222 of file pico9918.c.

◆ zeroWord

const uint32_t zeroWord = 0
static

Definition at line 432 of file pico9918.c.

◆ rowMasks

rowMasks

Definition at line 452 of file pico9918.c.

◆ doubledBitsNibble

uint8_t doubledBitsNibble[16]
static
Initial value:
= {0x00, 0x03, 0x0c, 0x0f, 0x30, 0x33, 0x3c, 0x3f,
0xc0, 0xc3, 0xcc, 0xcf, 0xf0, 0xf3, 0xfc, 0xff}

Definition at line 674 of file pico9918.c.

◆ transparentPixels

uint32_t transparentPixels[2]
static

Definition at line 749 of file pico9918.c.

◆ lookupsReady

bool lookupsReady = false

Definition at line 766 of file pico9918.c.

◆ T1_CONFIG

const TileLayerConfig T1_CONFIG
static
Initial value:
= {.vertScrollReg = 0x1c,
.yPageSwapMask = 0x01,
.paletteShift = 4,
.paletteMask = 0x03,
.startPattReg = 0x1b,
.hpSizeMask = 0x02,
.priorityReg = 0,
.priorityMask = 0,
.colorTableReg = TMS_REG_COLOR_TABLE,
.isTile2 = false,
.nameTableAddrFunc = tmsNameTableAddr,
.colorTableAddrFunc = tmsColorTableAddr}
static uint16_t tmsColorTableAddr(pico9918_t *tms9918)
color table base address
Definition pico9918.c:158
static uint16_t tmsNameTableAddr(pico9918_t *tms9918)
name table base address
Definition pico9918.c:146

Definition at line 1386 of file pico9918.c.

◆ T2_CONFIG

const TileLayerConfig T2_CONFIG
static
Initial value:
= {.vertScrollReg = 0x1a,
.yPageSwapMask = 0x10,
.paletteShift = 2,
.paletteMask = 0x0c,
.startPattReg = 0x19,
.hpSizeMask = 0x20,
.priorityReg = 0x32,
.priorityMask = 0x01,
.colorTableReg = 11,
.isTile2 = true,
.nameTableAddrFunc = tmsNameTable2Addr,
.colorTableAddrFunc = tmsColorTable2Addr}
static uint16_t tmsNameTable2Addr(pico9918_t *tms9918)
name table base address
Definition pico9918.c:152
static uint16_t tmsColorTable2Addr(pico9918_t *tms9918)
color table base address
Definition pico9918.c:166

Definition at line 1399 of file pico9918.c.

◆ text80ColorWord

const uint32_t text80ColorWord[16]
static
Initial value:
= {
TEXT80_COLOR_WORD(0x0), TEXT80_COLOR_WORD(0x1), TEXT80_COLOR_WORD(0x2), TEXT80_COLOR_WORD(0x3),
TEXT80_COLOR_WORD(0x4), TEXT80_COLOR_WORD(0x5), TEXT80_COLOR_WORD(0x6), TEXT80_COLOR_WORD(0x7),
TEXT80_COLOR_WORD(0x8), TEXT80_COLOR_WORD(0x9), TEXT80_COLOR_WORD(0xa), TEXT80_COLOR_WORD(0xb),
TEXT80_COLOR_WORD(0xc), TEXT80_COLOR_WORD(0xd), TEXT80_COLOR_WORD(0xe), TEXT80_COLOR_WORD(0xf)}

Definition at line 1502 of file pico9918.c.

◆ text80MaskWord

const uint32_t text80MaskWord[256]
static
Initial value:
= {
TEXT80_MASK_WORD4(0x00), TEXT80_MASK_WORD4(0x01), TEXT80_MASK_WORD4(0x02), TEXT80_MASK_WORD4(0x03),
TEXT80_MASK_WORD4(0x04), TEXT80_MASK_WORD4(0x05), TEXT80_MASK_WORD4(0x06), TEXT80_MASK_WORD4(0x07),
TEXT80_MASK_WORD4(0x08), TEXT80_MASK_WORD4(0x09), TEXT80_MASK_WORD4(0x0a), TEXT80_MASK_WORD4(0x0b),
TEXT80_MASK_WORD4(0x0c), TEXT80_MASK_WORD4(0x0d), TEXT80_MASK_WORD4(0x0e), TEXT80_MASK_WORD4(0x0f),
TEXT80_MASK_WORD4(0x10), TEXT80_MASK_WORD4(0x11), TEXT80_MASK_WORD4(0x12), TEXT80_MASK_WORD4(0x13),
TEXT80_MASK_WORD4(0x14), TEXT80_MASK_WORD4(0x15), TEXT80_MASK_WORD4(0x16), TEXT80_MASK_WORD4(0x17),
TEXT80_MASK_WORD4(0x18), TEXT80_MASK_WORD4(0x19), TEXT80_MASK_WORD4(0x1a), TEXT80_MASK_WORD4(0x1b),
TEXT80_MASK_WORD4(0x1c), TEXT80_MASK_WORD4(0x1d), TEXT80_MASK_WORD4(0x1e), TEXT80_MASK_WORD4(0x1f),
TEXT80_MASK_WORD4(0x20), TEXT80_MASK_WORD4(0x21), TEXT80_MASK_WORD4(0x22), TEXT80_MASK_WORD4(0x23),
TEXT80_MASK_WORD4(0x24), TEXT80_MASK_WORD4(0x25), TEXT80_MASK_WORD4(0x26), TEXT80_MASK_WORD4(0x27),
TEXT80_MASK_WORD4(0x28), TEXT80_MASK_WORD4(0x29), TEXT80_MASK_WORD4(0x2a), TEXT80_MASK_WORD4(0x2b),
TEXT80_MASK_WORD4(0x2c), TEXT80_MASK_WORD4(0x2d), TEXT80_MASK_WORD4(0x2e), TEXT80_MASK_WORD4(0x2f),
TEXT80_MASK_WORD4(0x30), TEXT80_MASK_WORD4(0x31), TEXT80_MASK_WORD4(0x32), TEXT80_MASK_WORD4(0x33),
TEXT80_MASK_WORD4(0x34), TEXT80_MASK_WORD4(0x35), TEXT80_MASK_WORD4(0x36), TEXT80_MASK_WORD4(0x37),
TEXT80_MASK_WORD4(0x38), TEXT80_MASK_WORD4(0x39), TEXT80_MASK_WORD4(0x3a), TEXT80_MASK_WORD4(0x3b),
TEXT80_MASK_WORD4(0x3c), TEXT80_MASK_WORD4(0x3d), TEXT80_MASK_WORD4(0x3e), TEXT80_MASK_WORD4(0x3f)}

Definition at line 1513 of file pico9918.c.

◆ textRowClones

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) ( 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
Initial value:
= {
{text40RowT1, text40RowT1Ecm1, text40RowT1Ecm2, text40RowT1Ecm3},
{text40RowT2, text40RowT2Ecm1, text40RowT2Ecm2, text40RowT2Ecm3}}

Definition at line 1823 of file pico9918.c.

◆ text80RowClones

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) ( 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
Initial value:
= {
{text80RowT1, text80RowT1Ecm1, text80RowT1Ecm2, text80RowT1Ecm3},
{text80RowT2, text80RowT2Ecm1, text80RowT2Ecm2, text80RowT2Ecm3}}

Definition at line 1849 of file pico9918.c.

◆ tileRowClones

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) ( 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
Initial value:
= {
{rowT1Ecm0, rowT1Ecm1, rowT1Ecm2, rowT1Ecm3, rowT1Gm2, rowT1Mcm},
{rowT2Ecm0, rowT2Ecm1, rowT2Ecm2, rowT2Ecm3, rowT2Gm2, rowT2Mcm}}

Definition at line 2488 of file pico9918.c.

◆ underLayer

bool underLayer = false
static

Definition at line 2584 of file pico9918.c.

◆ pico9918_cached_line_source

const uint8_t* pico9918_cached_line_source = 0

Definition at line 2590 of file pico9918.c.