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

pico9918-core - byte-exact frame dumps, and the comparison against them More...

#include "pico9918.h"
#include "impl/pico9918_priv.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include "overlay/diag.h"
#include "overlay/splash.h"
#include "overlay/bmp_font.h"
#include "overlay/bmp_splash.h"
#include "pico9918_frame.h"
+ Include dependency graph for golden.c:

Go to the source code of this file.

Data Structures

struct  Scene
 
struct  FrameParams
 
struct  FrameGeometry
 
struct  FrameRow
 

Macros

#define GOLDEN_DATA_DIR   "data"
 
#define GOLDEN_MAGIC   "TMSG"
 
#define GOLDEN_VERSION   3
 
#define GOLDEN_NAME_LEN   32
 
#define GOLDEN_BYTES_PER_LINE   TMS9918_PIXELS_X /* 256 indexed pixels */
 
#define GOLDEN_PAL_ENTRIES   64 /* pram entries per scene */
 
#define GOLDEN_PAL_BYTES   (GOLDEN_PAL_ENTRIES * 2)
 
#define GOLDEN_DIGESTS_PER_LINE   2
 
#define GOLDEN_DIGEST_BYTES   (GOLDEN_DIGESTS_PER_LINE * 8)
 
#define FNV64_OFFSET   0xcbf29ce484222325ull
 
#define FNV64_PRIME   0x00000100000001b3ull
 
#define POST_PAL_PIXELS   (GOLDEN_BYTES_PER_LINE * 2)
 
#define SCENE_COUNT   ((int)(sizeof(scenes) / sizeof(scenes[0])))
 
#define MAX_LINES   240
 
#define OVERLAY_MAGIC   "TMSO"
 
#define OVERLAY_VERSION   1
 
#define OVERLAY_FONT_WIDTH   768
 
#define OVERLAY_FONT_HEIGHT   6
 
#define OVERLAY_SPLASH_WIDTH   176
 
#define OVERLAY_SPLASH_HEIGHT   10
 
#define fontWidth   goldenUnusedFontWidth
 
#define fontHeight   goldenUnusedFontHeight
 
#define splashWidth   goldenUnusedSplashWidth
 
#define splashHeight   goldenUnusedSplashHeight
 
#define OVERLAY_PIXELS_X   642
 
#define OVERLAY_PREFILL_SEED   0xfedc
 
#define OVERLAY_FONT_ROW_BYTES   (OVERLAY_FONT_WIDTH / 8)
 
#define OVERLAY_SPLASH_ENTER_FRAMES   60
 
#define OVERLAY_SPLASH_HOLD_FRAMES   180
 
#define OVERLAY_SPLASH_START_POS    (OVERLAY_SPLASH_ENTER_FRAMES + OVERLAY_SPLASH_HEIGHT + 2)
 
#define OVERLAY_MAX_ROWS   4096
 
#define OVERLAY_CENTRE_X(text)    ((uint16_t)((OVERLAY_PIXELS_X - (sizeof(text) - 1) * PICO9918_DIAG_CHAR_WIDTH) / 2))
 
#define OVERLAY_BANNER_FG   ((PICO9918_PIXEL_T)(PICO9918_PIXEL_FROM_RGB12(0xff0f) & 0x0fff))
 
#define OVERLAY_SPLASH_VVIRT   240u
 
#define OVERLAY_SPLASH_VPIXELS   192u
 
#define OVERLAY_SPLASH_VBORDER   ((OVERLAY_SPLASH_VVIRT - OVERLAY_SPLASH_VPIXELS) / 2u)
 
#define FRAME_MAGIC   "TMSF"
 
#define FRAME_VERSION   3
 
#define FRAME_R0_DOUBLE_ROWS   0x08
 
#define FRAME_R31_ROW30   0x40
 
#define FRAME_DISPLAY_VGA   480
 
#define FRAME_DISPLAY_SCART_PAL   268
 
#define FRAME_DISPLAY_SCART_NTSC   220
 
#define FRAME_INTERLACED_PIXEL_SCALE   1
 
#define FRAME_MAX_ROWS   1024
 
#define FRAME_ROW_VALUES   15
 
#define FRAME_R1_INT_ENABLE   0x20
 
#define FRAME_SR0_F   0x80 /* frame interrupt */
 
#define FRAME_SR0_5S   0x40 /* fifth sprite */
 
#define FRAME_SR0_COL   0x20 /* sprite collision */
 
#define FRAME_SR0_ID   0x1f /* fifth-sprite number, low five bits */
 
#define FRAME_R0_INT_SCANLINE   0x10
 
#define FRAME_SR1_HF   0x01
 

Functions

static void lcgSeed (uint32_t seed)
 
static uint8_t lcgByte (void)
 
static void regWrite (uint8_t reg, uint8_t value)
 
static void vramSetWriteAddr (uint16_t addr)
 
static void vramSetReadAddr (uint16_t addr)
 
static void vramFillLcg (uint16_t addr, int count)
 
static void vramFillByte (uint16_t addr, uint8_t value, int count)
 
static void vramWriteBytes (uint16_t addr, const uint8_t *bytes, int count)
 
static void unlockF18a (void)
 
static void paletteWriteLcg (int count)
 
static void sceneBegin (void)
 
static void dumpPalette (uint8_t out[GOLDEN_PAL_BYTES])
 
static uint64_t fnv1a (const void *data, size_t len)
 
static uint16_t refPixel (uint16_t pram)
 
static void refRegenerate (bool paired)
 
static void refExpand (uint16_t *dst, const uint8_t *src, int n)
 
static void expandLine (const uint8_t *indexed, uint64_t digests[GOLDEN_DIGESTS_PER_LINE])
 
static int refDivergence (void)
 
static void sceneGraphicsI (void)
 
static void sceneGraphicsII (void)
 
static void sceneText (void)
 
static void sceneMulticolor (void)
 
static void sceneText80 (void)
 
static void sceneSpritesMax (void)
 
static void sceneF18aUnlocked (void)
 
static void sceneF18aEcm3Bml (void)
 
static void sceneF18aBmlWrap (void)
 
static void sceneF18aBmlStride (void)
 
static void sceneF18aText80Attrs (void)
 
static void sceneF18aVramSnapshot (void)
 
static void sceneF18aBmlPriority (void)
 
static void sceneF18aEcm0 (void)
 
static void sceneF18aGfx2 (void)
 
static void sceneRawReset (void)
 
static void renderScene (const Scene *scene, int *lines5s, int *linesCol)
 
static void putU32 (FILE *f, uint32_t v)
 
static void putU64 (FILE *f, uint64_t v)
 
static bool getU32 (FILE *f, uint32_t *v)
 
static bool getU64 (FILE *f, uint64_t *v)
 
static void scenePath (char *buf, size_t bufLen, const char *dataDir, const char *name)
 
static bool captureScene (const Scene *scene, const char *dataDir)
 
static bool compareScene (const Scene *scene, const char *dataDir)
 
static void overlayPrefill (void)
 
static void overlayRestorePrefill (PICO9918_PIXEL_T *dst, int from, int to)
 
static int refDarken (int x, PICO9918_PIXEL_T *pixels)
 
static uint8_t refGlyphRowBits (char ch, int fy)
 
static int refRenderText (uint16_t scanline, const char *text, uint16_t x, uint16_t y, PICO9918_PIXEL_T fg, PICO9918_PIXEL_T *pixels)
 
static void refSplashReset (void)
 
static void refSplashRender (uint16_t y, uint32_t frameCount, uint32_t vBorder, uint32_t vPixels, uint32_t vVirtualPixels, PICO9918_PIXEL_T *pixels)
 
static void overlayEmitRow (void)
 
static void overlayTextCase (const char *label, const char *text, uint16_t x, uint16_t y, PICO9918_PIXEL_T fg)
 
static void overlayTextGroup (void)
 
static void overlaySplashFrame (uint32_t frameCount, bool sample)
 
static void overlaySplashGroup (void)
 
static PICO9918_PIXEL_T refSwatch (uint16_t pram)
 
static void refPalettePanel (int y, uint32_t vVirtualPixels, PICO9918_PIXEL_T *pixels)
 
static void refRegisterPanel (int diagRow, int row, PICO9918_PIXEL_T *pixels)
 
static void overlaySetConfig (uint8_t index, uint8_t value)
 
static void overlayPrimeDiag (void)
 
static void overlayPanelCase (const char *label, bool registers, bool address, bool palette, bool unlocked, bool gfx2, bool performance)
 
static void overlayPanelGroup (void)
 
static void overlayRender (void)
 
static bool overlayCapture (const char *dataDir)
 
static bool overlayCompare (const char *dataDir)
 
static uint16_t frameMapLine (uint16_t yRaw, const FrameParams *params, uint8_t reg0, uint8_t interlacedFieldOrder)
 
static FrameGeometry frameGeometry (FrameParams *params, uint8_t reg0, uint8_t reg31)
 
static uint16_t refMapLine (uint16_t yRaw, const FrameParams *params, uint8_t reg0, uint8_t interlacedFieldOrder)
 
static FrameGeometry refGeometry (FrameParams *params, uint8_t reg0, uint8_t reg31)
 
static int32_t frameActiveLines (const FrameGeometry *g, int displayPixels)
 
static int32_t refActiveLines (const FrameGeometry *g, int displayPixels)
 
static void frameEmitRow (const FrameRow *cand, const FrameRow *ref)
 
static void frameMapCase (const char *label, uint16_t yRaw, bool interlaced, uint8_t reg0, uint8_t order)
 
static void frameMapQuad (const char *label, uint16_t lineInField, bool interlaced, uint8_t reg0)
 
static void frameMapGroup (void)
 
static void frameGeomCase (const char *label, int displayPixels, bool interlaced, uint8_t reg0, uint8_t reg31)
 
static void frameGeomGroup (void)
 
static uint8_t refMergeStatus (uint8_t currentStatus, uint8_t tempStatus)
 
static bool refIntPin (uint8_t mergedStatus, uint8_t reg1, uint8_t reg0, uint8_t sr1)
 
static void frameIntSetup (bool want)
 
static void frameIntCase (const char *label, uint8_t currentStatus, uint8_t tempStatus, uint8_t reg1, bool intPinPre, uint8_t reg0, uint8_t sr1, bool unlocked)
 
static void frameIntQuad (const char *label, uint8_t currentStatus, uint8_t tempStatus)
 
static void frameHIntPair (const char *label, uint8_t currentStatus, uint8_t tempStatus, uint8_t reg1, uint8_t reg0, uint8_t sr1, bool unlocked)
 
static void frameHIntReadCase (const char *label, uint8_t currentStatus, uint8_t reg1)
 
static void frameSr0ReadCase (const char *label, uint8_t reg0, uint8_t sr1, bool unlocked)
 
static void frameSr0ThenSr1 (void)
 
static void frameRelockCase (void)
 
static void frameIntGroup (void)
 
static void frameRender (void)
 
static bool frameCapture (const char *dataDir)
 
static bool frameCompare (const char *dataDir)
 
static bool resetCheck (void)
 
static bool unlockCheck (void)
 
int main (int argc, char *argv[])
 

Variables

uint32_t goldenClockNow = 0
 
uint8_t goldenPublishedStatus = 0
 
uint32_t goldenPublishCount = 0
 
static uint32_t lcgState
 
static PICO9918_PIXEL_T libPixels [POST_PAL_PIXELS]
 
static uint16_t refPixels [POST_PAL_PIXELS]
 
static uint32_t refLut [256]
 
static const Scene scenes []
 
static uint8_t frame [MAX_LINES][GOLDEN_BYTES_PER_LINE+1]
 
static uint8_t palDump [GOLDEN_PAL_BYTES]
 
static uint64_t digests [MAX_LINES][GOLDEN_DIGESTS_PER_LINE]
 
static int refFailLine
 
static int refFailPixel
 
static uint16_t refFailLib
 
static uint16_t refFailRef
 
uint8_t font []
 
uint8_t splash []
 
PICO9918_PIXEL_T splash_pal []
 
static PICO9918_PIXEL_T ovLib [OVERLAY_PIXELS_X]
 
static PICO9918_PIXEL_T ovRef [OVERLAY_PIXELS_X]
 
static int refLogoOffset
 
static bool refCanHide
 
static uint64_t overlayDigests [OVERLAY_MAX_ROWS][2]
 
static int overlayRowCount
 
static int ovFailRow
 
static int ovFailPixel
 
static uint16_t ovFailLib
 
static uint16_t ovFailRef
 
static const char * ovRowLabel [OVERLAY_MAX_ROWS]
 
static const char * ovCurrentLabel = ""
 
const PICO9918_PIXEL_T labelColor
 
const PICO9918_PIXEL_T valueColor
 
const PICO9918_PIXEL_T unitsColor
 
static uint64_t frameDigests [FRAME_MAX_ROWS][2]
 
static int frameRowCount
 
static int frFailRow
 
static const char * frFailField
 
static long frFailCand
 
static long frFailRef
 
static const char * frRowLabel [FRAME_MAX_ROWS]
 
static const char * frCurrentLabel = ""
 
static const char *const frameFieldName [FRAME_ROW_VALUES]
 
static char frMapLabels [FRAME_MAX_ROWS][32]
 
static char frIntLabels [FRAME_MAX_ROWS][40]
 

Detailed Description

pico9918-core - byte-exact frame dumps, and the comparison against them

Copyright (c) 2026 Troy Schrapel

This code is licensed under the MIT license

https://github.com/visrealm/pico9918-core

Drives fixed register/VRAM scenes through the public bus API and captures the indexed output of pico9918_scan_line() plus its returned status byte, one golden file per scene, followed by a dump of the 64 live palette RAM entries (read back through the public bus - see dumpPalette). Compare mode recomputes every scene and diffs byte-for-byte against the committed goldens.

Each line also carries two post-palette digests, so the palette -> pixel conversion in pico9918_palette.c is observable: see "Post-palette surfaces".

Usage: golden_runner compare against goldens (nonzero exit on FAIL) golden_runner –capture rewrite the goldens golden_runner –data DIR override the golden data directory

All scene content is generated by a fixed-seed LCG - no rand(), no time.

Definition in file golden.c.

Macro Definition Documentation

◆ GOLDEN_DATA_DIR

#define GOLDEN_DATA_DIR   "data"

Definition at line 44 of file golden.c.

◆ GOLDEN_MAGIC

#define GOLDEN_MAGIC   "TMSG"

Definition at line 47 of file golden.c.

◆ GOLDEN_VERSION

#define GOLDEN_VERSION   3

Definition at line 48 of file golden.c.

◆ GOLDEN_NAME_LEN

#define GOLDEN_NAME_LEN   32

Definition at line 49 of file golden.c.

◆ GOLDEN_BYTES_PER_LINE

#define GOLDEN_BYTES_PER_LINE   TMS9918_PIXELS_X /* 256 indexed pixels */

Definition at line 50 of file golden.c.

◆ GOLDEN_PAL_ENTRIES

#define GOLDEN_PAL_ENTRIES   64 /* pram entries per scene */

Definition at line 51 of file golden.c.

◆ GOLDEN_PAL_BYTES

#define GOLDEN_PAL_BYTES   (GOLDEN_PAL_ENTRIES * 2)

Definition at line 52 of file golden.c.

◆ GOLDEN_DIGESTS_PER_LINE

#define GOLDEN_DIGESTS_PER_LINE   2

Definition at line 55 of file golden.c.

◆ GOLDEN_DIGEST_BYTES

#define GOLDEN_DIGEST_BYTES   (GOLDEN_DIGESTS_PER_LINE * 8)

Definition at line 56 of file golden.c.

◆ FNV64_OFFSET

#define FNV64_OFFSET   0xcbf29ce484222325ull

Definition at line 251 of file golden.c.

◆ FNV64_PRIME

#define FNV64_PRIME   0x00000100000001b3ull

Definition at line 252 of file golden.c.

◆ POST_PAL_PIXELS

#define POST_PAL_PIXELS   (GOLDEN_BYTES_PER_LINE * 2)

Definition at line 294 of file golden.c.

◆ SCENE_COUNT

#define SCENE_COUNT   ((int)(sizeof(scenes) / sizeof(scenes[0])))

Definition at line 847 of file golden.c.

◆ MAX_LINES

#define MAX_LINES   240

Definition at line 848 of file golden.c.

◆ OVERLAY_MAGIC

#define OVERLAY_MAGIC   "TMSO"

Definition at line 1200 of file golden.c.

◆ OVERLAY_VERSION

#define OVERLAY_VERSION   1

Definition at line 1201 of file golden.c.

◆ OVERLAY_FONT_WIDTH

#define OVERLAY_FONT_WIDTH   768

Definition at line 1223 of file golden.c.

◆ OVERLAY_FONT_HEIGHT

#define OVERLAY_FONT_HEIGHT   6

Definition at line 1224 of file golden.c.

◆ OVERLAY_SPLASH_WIDTH

#define OVERLAY_SPLASH_WIDTH   176

Definition at line 1225 of file golden.c.

◆ OVERLAY_SPLASH_HEIGHT

#define OVERLAY_SPLASH_HEIGHT   10

Definition at line 1226 of file golden.c.

◆ fontWidth

#define fontWidth   goldenUnusedFontWidth

Definition at line 1232 of file golden.c.

◆ fontHeight

#define fontHeight   goldenUnusedFontHeight

Definition at line 1233 of file golden.c.

◆ splashWidth

#define splashWidth   goldenUnusedSplashWidth

Definition at line 1234 of file golden.c.

◆ splashHeight

#define splashHeight   goldenUnusedSplashHeight

Definition at line 1235 of file golden.c.

◆ OVERLAY_PIXELS_X

#define OVERLAY_PIXELS_X   642

Definition at line 1261 of file golden.c.

◆ OVERLAY_PREFILL_SEED

#define OVERLAY_PREFILL_SEED   0xfedc

Definition at line 1276 of file golden.c.

◆ OVERLAY_FONT_ROW_BYTES

#define OVERLAY_FONT_ROW_BYTES   (OVERLAY_FONT_WIDTH / 8)

Definition at line 1343 of file golden.c.

◆ OVERLAY_SPLASH_ENTER_FRAMES

#define OVERLAY_SPLASH_ENTER_FRAMES   60

Definition at line 1402 of file golden.c.

◆ OVERLAY_SPLASH_HOLD_FRAMES

#define OVERLAY_SPLASH_HOLD_FRAMES   180

Definition at line 1403 of file golden.c.

◆ OVERLAY_SPLASH_START_POS

#define OVERLAY_SPLASH_START_POS    (OVERLAY_SPLASH_ENTER_FRAMES + OVERLAY_SPLASH_HEIGHT + 2)

Definition at line 1404 of file golden.c.

◆ OVERLAY_MAX_ROWS

#define OVERLAY_MAX_ROWS   4096

Definition at line 1454 of file golden.c.

◆ OVERLAY_CENTRE_X

#define OVERLAY_CENTRE_X (   text)     ((uint16_t)((OVERLAY_PIXELS_X - (sizeof(text) - 1) * PICO9918_DIAG_CHAR_WIDTH) / 2))

Definition at line 1520 of file golden.c.

◆ OVERLAY_BANNER_FG

#define OVERLAY_BANNER_FG   ((PICO9918_PIXEL_T)(PICO9918_PIXEL_FROM_RGB12(0xff0f) & 0x0fff))

Definition at line 1524 of file golden.c.

◆ OVERLAY_SPLASH_VVIRT

#define OVERLAY_SPLASH_VVIRT   240u

Definition at line 1630 of file golden.c.

◆ OVERLAY_SPLASH_VPIXELS

#define OVERLAY_SPLASH_VPIXELS   192u

Definition at line 1631 of file golden.c.

◆ OVERLAY_SPLASH_VBORDER

#define OVERLAY_SPLASH_VBORDER   ((OVERLAY_SPLASH_VVIRT - OVERLAY_SPLASH_VPIXELS) / 2u)

Definition at line 1632 of file golden.c.

◆ FRAME_MAGIC

#define FRAME_MAGIC   "TMSF"

Definition at line 2283 of file golden.c.

◆ FRAME_VERSION

#define FRAME_VERSION   3

Definition at line 2286 of file golden.c.

◆ FRAME_R0_DOUBLE_ROWS

#define FRAME_R0_DOUBLE_ROWS   0x08

Definition at line 2290 of file golden.c.

◆ FRAME_R31_ROW30

#define FRAME_R31_ROW30   0x40

Definition at line 2293 of file golden.c.

◆ FRAME_DISPLAY_VGA

#define FRAME_DISPLAY_VGA   480

Definition at line 2301 of file golden.c.

◆ FRAME_DISPLAY_SCART_PAL

#define FRAME_DISPLAY_SCART_PAL   268

Definition at line 2302 of file golden.c.

◆ FRAME_DISPLAY_SCART_NTSC

#define FRAME_DISPLAY_SCART_NTSC   220

Definition at line 2303 of file golden.c.

◆ FRAME_INTERLACED_PIXEL_SCALE

#define FRAME_INTERLACED_PIXEL_SCALE   1

Definition at line 2308 of file golden.c.

◆ FRAME_MAX_ROWS

#define FRAME_MAX_ROWS   1024

Definition at line 2605 of file golden.c.

◆ FRAME_ROW_VALUES

#define FRAME_ROW_VALUES   15

Definition at line 2625 of file golden.c.

◆ FRAME_R1_INT_ENABLE

#define FRAME_R1_INT_ENABLE   0x20

Definition at line 2901 of file golden.c.

◆ FRAME_SR0_F

#define FRAME_SR0_F   0x80 /* frame interrupt */

Definition at line 2905 of file golden.c.

◆ FRAME_SR0_5S

#define FRAME_SR0_5S   0x40 /* fifth sprite */

Definition at line 2906 of file golden.c.

◆ FRAME_SR0_COL

#define FRAME_SR0_COL   0x20 /* sprite collision */

Definition at line 2907 of file golden.c.

◆ FRAME_SR0_ID

#define FRAME_SR0_ID   0x1f /* fifth-sprite number, low five bits */

Definition at line 2908 of file golden.c.

◆ FRAME_R0_INT_SCANLINE

#define FRAME_R0_INT_SCANLINE   0x10

Definition at line 2912 of file golden.c.

◆ FRAME_SR1_HF

#define FRAME_SR1_HF   0x01

Definition at line 2913 of file golden.c.

Function Documentation

◆ lcgSeed()

static void lcgSeed ( uint32_t  seed)
static

Definition at line 78 of file golden.c.

◆ lcgByte()

static uint8_t lcgByte ( void  )
static

Definition at line 83 of file golden.c.

◆ regWrite()

static void regWrite ( uint8_t  reg,
uint8_t  value 
)
static

Definition at line 93 of file golden.c.

◆ vramSetWriteAddr()

static void vramSetWriteAddr ( uint16_t  addr)
static

Definition at line 99 of file golden.c.

◆ vramSetReadAddr()

static void vramSetReadAddr ( uint16_t  addr)
static

Definition at line 107 of file golden.c.

◆ vramFillLcg()

static void vramFillLcg ( uint16_t  addr,
int  count 
)
static

Definition at line 113 of file golden.c.

◆ vramFillByte()

static void vramFillByte ( uint16_t  addr,
uint8_t  value,
int  count 
)
static

Definition at line 119 of file golden.c.

◆ vramWriteBytes()

static void vramWriteBytes ( uint16_t  addr,
const uint8_t *  bytes,
int  count 
)
static

Definition at line 125 of file golden.c.

◆ unlockF18a()

static void unlockF18a ( void  )
static

Definition at line 132 of file golden.c.

◆ paletteWriteLcg()

static void paletteWriteLcg ( int  count)
static

Definition at line 141 of file golden.c.

◆ sceneBegin()

static void sceneBegin ( void  )
static

Definition at line 155 of file golden.c.

◆ dumpPalette()

static void dumpPalette ( uint8_t  out[GOLDEN_PAL_BYTES])
static

Definition at line 185 of file golden.c.

◆ fnv1a()

static uint64_t fnv1a ( const void *  data,
size_t  len 
)
static

Definition at line 254 of file golden.c.

◆ refPixel()

static uint16_t refPixel ( uint16_t  pram)
static

Definition at line 285 of file golden.c.

◆ refRegenerate()

static void refRegenerate ( bool  paired)
static

Definition at line 335 of file golden.c.

◆ refExpand()

static void refExpand ( uint16_t *  dst,
const uint8_t *  src,
int  n 
)
static

Definition at line 365 of file golden.c.

◆ expandLine()

static void expandLine ( const uint8_t *  indexed,
uint64_t  digests[GOLDEN_DIGESTS_PER_LINE] 
)
static

Definition at line 376 of file golden.c.

◆ refDivergence()

static int refDivergence ( void  )
static

Definition at line 388 of file golden.c.

◆ sceneGraphicsI()

static void sceneGraphicsI ( void  )
static

Definition at line 402 of file golden.c.

◆ sceneGraphicsII()

static void sceneGraphicsII ( void  )
static

Definition at line 418 of file golden.c.

◆ sceneText()

static void sceneText ( void  )
static

Definition at line 433 of file golden.c.

◆ sceneMulticolor()

static void sceneMulticolor ( void  )
static

Definition at line 445 of file golden.c.

◆ sceneText80()

static void sceneText80 ( void  )
static

Definition at line 460 of file golden.c.

◆ sceneSpritesMax()

static void sceneSpritesMax ( void  )
static

Definition at line 473 of file golden.c.

◆ sceneF18aUnlocked()

static void sceneF18aUnlocked ( void  )
static

Definition at line 504 of file golden.c.

◆ sceneF18aEcm3Bml()

static void sceneF18aEcm3Bml ( void  )
static

Definition at line 533 of file golden.c.

◆ sceneF18aBmlWrap()

static void sceneF18aBmlWrap ( void  )
static

Definition at line 560 of file golden.c.

◆ sceneF18aBmlStride()

static void sceneF18aBmlStride ( void  )
static

Definition at line 587 of file golden.c.

◆ sceneF18aText80Attrs()

static void sceneF18aText80Attrs ( void  )
static

Definition at line 612 of file golden.c.

◆ sceneF18aVramSnapshot()

static void sceneF18aVramSnapshot ( void  )
static

Definition at line 635 of file golden.c.

◆ sceneF18aBmlPriority()

static void sceneF18aBmlPriority ( void  )
static

Definition at line 672 of file golden.c.

◆ sceneF18aEcm0()

static void sceneF18aEcm0 ( void  )
static

Definition at line 710 of file golden.c.

◆ sceneF18aGfx2()

static void sceneF18aGfx2 ( void  )
static

Definition at line 766 of file golden.c.

◆ sceneRawReset()

static void sceneRawReset ( void  )
static

Definition at line 806 of file golden.c.

◆ renderScene()

static void renderScene ( const Scene *  scene,
int *  lines5s,
int *  linesCol 
)
static

Definition at line 874 of file golden.c.

◆ putU32()

static void putU32 ( FILE *  f,
uint32_t  v 
)
static

Definition at line 951 of file golden.c.

◆ putU64()

static void putU64 ( FILE *  f,
uint64_t  v 
)
static

Definition at line 957 of file golden.c.

◆ getU32()

static bool getU32 ( FILE *  f,
uint32_t *  v 
)
static

Definition at line 963 of file golden.c.

◆ getU64()

static bool getU64 ( FILE *  f,
uint64_t *  v 
)
static

Definition at line 971 of file golden.c.

◆ scenePath()

static void scenePath ( char *  buf,
size_t  bufLen,
const char *  dataDir,
const char *  name 
)
static

Definition at line 980 of file golden.c.

◆ captureScene()

static bool captureScene ( const Scene *  scene,
const char *  dataDir 
)
static

Definition at line 985 of file golden.c.

◆ compareScene()

static bool compareScene ( const Scene *  scene,
const char *  dataDir 
)
static

Definition at line 1039 of file golden.c.

◆ overlayPrefill()

static void overlayPrefill ( void  )
static

Definition at line 1278 of file golden.c.

◆ overlayRestorePrefill()

static void overlayRestorePrefill ( PICO9918_PIXEL_T *  dst,
int  from,
int  to 
)
static

Definition at line 1292 of file golden.c.

◆ refDarken()

static int refDarken ( int  x,
PICO9918_PIXEL_T *  pixels 
)
static

Definition at line 1319 of file golden.c.

◆ refGlyphRowBits()

static uint8_t refGlyphRowBits ( char  ch,
int  fy 
)
static

Definition at line 1345 of file golden.c.

◆ refRenderText()

static int refRenderText ( uint16_t  scanline,
const char *  text,
uint16_t  x,
uint16_t  y,
PICO9918_PIXEL_T  fg,
PICO9918_PIXEL_T *  pixels 
)
static

Definition at line 1364 of file golden.c.

◆ refSplashReset()

static void refSplashReset ( void  )
static

Definition at line 1407 of file golden.c.

◆ refSplashRender()

static void refSplashRender ( uint16_t  y,
uint32_t  frameCount,
uint32_t  vBorder,
uint32_t  vPixels,
uint32_t  vVirtualPixels,
PICO9918_PIXEL_T *  pixels 
)
static

Definition at line 1412 of file golden.c.

◆ overlayEmitRow()

static void overlayEmitRow ( void  )
static

Definition at line 1470 of file golden.c.

◆ overlayTextCase()

static void overlayTextCase ( const char *  label,
const char *  text,
uint16_t  x,
uint16_t  y,
PICO9918_PIXEL_T  fg 
)
static

Definition at line 1542 of file golden.c.

◆ overlayTextGroup()

static void overlayTextGroup ( void  )
static

Definition at line 1560 of file golden.c.

◆ overlaySplashFrame()

static void overlaySplashFrame ( uint32_t  frameCount,
bool  sample 
)
static

Definition at line 1634 of file golden.c.

◆ overlaySplashGroup()

static void overlaySplashGroup ( void  )
static

Definition at line 1662 of file golden.c.

◆ refSwatch()

static PICO9918_PIXEL_T refSwatch ( uint16_t  pram)
static

Definition at line 1751 of file golden.c.

◆ refPalettePanel()

static void refPalettePanel ( int  y,
uint32_t  vVirtualPixels,
PICO9918_PIXEL_T *  pixels 
)
static

Definition at line 1762 of file golden.c.

◆ refRegisterPanel()

static void refRegisterPanel ( int  diagRow,
int  row,
PICO9918_PIXEL_T *  pixels 
)
static

Definition at line 1787 of file golden.c.

◆ overlaySetConfig()

static void overlaySetConfig ( uint8_t  index,
uint8_t  value 
)
static

Definition at line 1814 of file golden.c.

◆ overlayPrimeDiag()

static void overlayPrimeDiag ( void  )
static

Definition at line 1851 of file golden.c.

◆ overlayPanelCase()

static void overlayPanelCase ( const char *  label,
bool  registers,
bool  address,
bool  palette,
bool  unlocked,
bool  gfx2,
bool  performance 
)
static

Definition at line 1912 of file golden.c.

◆ overlayPanelGroup()

static void overlayPanelGroup ( void  )
static

Definition at line 2088 of file golden.c.

◆ overlayRender()

static void overlayRender ( void  )
static

Definition at line 2117 of file golden.c.

◆ overlayCapture()

static bool overlayCapture ( const char *  dataDir)
static

Definition at line 2132 of file golden.c.

◆ overlayCompare()

static bool overlayCompare ( const char *  dataDir)
static

Definition at line 2169 of file golden.c.

◆ frameMapLine()

static uint16_t frameMapLine ( uint16_t  yRaw,
const FrameParams *  params,
uint8_t  reg0,
uint8_t  interlacedFieldOrder 
)
static

Definition at line 2371 of file golden.c.

◆ frameGeometry()

static FrameGeometry frameGeometry ( FrameParams *  params,
uint8_t  reg0,
uint8_t  reg31 
)
static

Definition at line 2408 of file golden.c.

◆ refMapLine()

static uint16_t refMapLine ( uint16_t  yRaw,
const FrameParams *  params,
uint8_t  reg0,
uint8_t  interlacedFieldOrder 
)
static

Definition at line 2453 of file golden.c.

◆ refGeometry()

static FrameGeometry refGeometry ( FrameParams *  params,
uint8_t  reg0,
uint8_t  reg31 
)
static

Definition at line 2493 of file golden.c.

◆ frameActiveLines()

static int32_t frameActiveLines ( const FrameGeometry *  g,
int  displayPixels 
)
static

Definition at line 2566 of file golden.c.

◆ refActiveLines()

static int32_t refActiveLines ( const FrameGeometry *  g,
int  displayPixels 
)
static

Definition at line 2578 of file golden.c.

◆ frameEmitRow()

static void frameEmitRow ( const FrameRow *  cand,
const FrameRow *  ref 
)
static

Definition at line 2638 of file golden.c.

◆ frameMapCase()

static void frameMapCase ( const char *  label,
uint16_t  yRaw,
bool  interlaced,
uint8_t  reg0,
uint8_t  order 
)
static

Definition at line 2682 of file golden.c.

◆ frameMapQuad()

static void frameMapQuad ( const char *  label,
uint16_t  lineInField,
bool  interlaced,
uint8_t  reg0 
)
static

Definition at line 2706 of file golden.c.

◆ frameMapGroup()

static void frameMapGroup ( void  )
static

Definition at line 2729 of file golden.c.

◆ frameGeomCase()

static void frameGeomCase ( const char *  label,
int  displayPixels,
bool  interlaced,
uint8_t  reg0,
uint8_t  reg31 
)
static

Definition at line 2798 of file golden.c.

◆ frameGeomGroup()

static void frameGeomGroup ( void  )
static

Definition at line 2835 of file golden.c.

◆ refMergeStatus()

static uint8_t refMergeStatus ( uint8_t  currentStatus,
uint8_t  tempStatus 
)
static

Definition at line 2926 of file golden.c.

◆ refIntPin()

static bool refIntPin ( uint8_t  mergedStatus,
uint8_t  reg1,
uint8_t  reg0,
uint8_t  sr1 
)
static

Definition at line 2976 of file golden.c.

◆ frameIntSetup()

static void frameIntSetup ( bool  want)
static

Definition at line 2996 of file golden.c.

◆ frameIntCase()

static void frameIntCase ( const char *  label,
uint8_t  currentStatus,
uint8_t  tempStatus,
uint8_t  reg1,
bool  intPinPre,
uint8_t  reg0,
uint8_t  sr1,
bool  unlocked 
)
static

Definition at line 3011 of file golden.c.

◆ frameIntQuad()

static void frameIntQuad ( const char *  label,
uint8_t  currentStatus,
uint8_t  tempStatus 
)
static

Definition at line 3072 of file golden.c.

◆ frameHIntPair()

static void frameHIntPair ( const char *  label,
uint8_t  currentStatus,
uint8_t  tempStatus,
uint8_t  reg1,
uint8_t  reg0,
uint8_t  sr1,
bool  unlocked 
)
static

Definition at line 3103 of file golden.c.

◆ frameHIntReadCase()

static void frameHIntReadCase ( const char *  label,
uint8_t  currentStatus,
uint8_t  reg1 
)
static

Definition at line 3131 of file golden.c.

◆ frameSr0ReadCase()

static void frameSr0ReadCase ( const char *  label,
uint8_t  reg0,
uint8_t  sr1,
bool  unlocked 
)
static

Definition at line 3176 of file golden.c.

◆ frameSr0ThenSr1()

static void frameSr0ThenSr1 ( void  )
static

Definition at line 3217 of file golden.c.

◆ frameRelockCase()

static void frameRelockCase ( void  )
static

Definition at line 3248 of file golden.c.

◆ frameIntGroup()

static void frameIntGroup ( void  )
static

Definition at line 3284 of file golden.c.

◆ frameRender()

static void frameRender ( void  )
static

Definition at line 3422 of file golden.c.

◆ frameCapture()

static bool frameCapture ( const char *  dataDir)
static

Definition at line 3446 of file golden.c.

◆ frameCompare()

static bool frameCompare ( const char *  dataDir)
static

Definition at line 3484 of file golden.c.

◆ resetCheck()

static bool resetCheck ( void  )
static

Definition at line 3563 of file golden.c.

◆ unlockCheck()

static bool unlockCheck ( void  )
static

Definition at line 3589 of file golden.c.

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 3629 of file golden.c.

Variable Documentation

◆ goldenClockNow

uint32_t goldenClockNow = 0

Definition at line 67 of file golden.c.

◆ goldenPublishedStatus

uint8_t goldenPublishedStatus = 0

Definition at line 70 of file golden.c.

◆ goldenPublishCount

uint32_t goldenPublishCount = 0

Definition at line 71 of file golden.c.

◆ lcgState

uint32_t lcgState
static

Definition at line 76 of file golden.c.

◆ libPixels

PICO9918_PIXEL_T libPixels[POST_PAL_PIXELS]
static

Definition at line 296 of file golden.c.

◆ refPixels

uint16_t refPixels[POST_PAL_PIXELS]
static

Definition at line 297 of file golden.c.

◆ refLut

uint32_t refLut[256]
static

Definition at line 321 of file golden.c.

◆ scenes

const Scene scenes[]
static
Initial value:
= {
{ "graphics-i", 192, sceneGraphicsI },
{ "graphics-ii", 192, sceneGraphicsII },
{ "text", 192, sceneText },
{ "multicolor", 192, sceneMulticolor },
{ "text80", 192, sceneText80 },
{ "sprites-max", 192, sceneSpritesMax },
{ "f18a-unlocked", 240, sceneF18aUnlocked },
{ "f18a-ecm3-bml", 192, sceneF18aEcm3Bml },
{ "f18a-text80-attrs", 192, sceneF18aText80Attrs },
{ "f18a-vram-snapshot", 192, sceneF18aVramSnapshot},
{ "f18a-bml-priority", 192, sceneF18aBmlPriority },
{ "f18a-bml-wrap", 192, sceneF18aBmlWrap },
{ "f18a-bml-stride", 192, sceneF18aBmlStride },
{ "f18a-ecm0", 192, sceneF18aEcm0 },
{ "f18a-gfx2", 192, sceneF18aGfx2 },
{ "raw-reset", 8, sceneRawReset },
}

Definition at line 828 of file golden.c.

◆ frame

uint8_t frame[MAX_LINES][GOLDEN_BYTES_PER_LINE+1]
static

Definition at line 858 of file golden.c.

◆ palDump

uint8_t palDump[GOLDEN_PAL_BYTES]
static

Definition at line 861 of file golden.c.

◆ digests

uint64_t digests[MAX_LINES][GOLDEN_DIGESTS_PER_LINE]
static

Definition at line 864 of file golden.c.

◆ refFailLine

int refFailLine
static

Definition at line 869 of file golden.c.

◆ refFailPixel

int refFailPixel
static

Definition at line 870 of file golden.c.

◆ refFailLib

uint16_t refFailLib
static

Definition at line 871 of file golden.c.

◆ refFailRef

uint16_t refFailRef
static

Definition at line 872 of file golden.c.

◆ ovLib

PICO9918_PIXEL_T ovLib[OVERLAY_PIXELS_X]
static

Definition at line 1263 of file golden.c.

◆ ovRef

PICO9918_PIXEL_T ovRef[OVERLAY_PIXELS_X]
static

Definition at line 1264 of file golden.c.

◆ refLogoOffset

int refLogoOffset
static

Definition at line 1397 of file golden.c.

◆ refCanHide

bool refCanHide
static

Definition at line 1398 of file golden.c.

◆ overlayDigests

uint64_t overlayDigests[OVERLAY_MAX_ROWS][2]
static

Definition at line 1456 of file golden.c.

◆ overlayRowCount

int overlayRowCount
static

Definition at line 1457 of file golden.c.

◆ ovFailRow

int ovFailRow
static

Definition at line 1460 of file golden.c.

◆ ovFailPixel

int ovFailPixel
static

Definition at line 1461 of file golden.c.

◆ ovFailLib

uint16_t ovFailLib
static

Definition at line 1462 of file golden.c.

◆ ovFailRef

uint16_t ovFailRef
static

Definition at line 1463 of file golden.c.

◆ ovRowLabel

const char* ovRowLabel[OVERLAY_MAX_ROWS]
static

Definition at line 1467 of file golden.c.

◆ ovCurrentLabel

const char* ovCurrentLabel = ""
static

Definition at line 1468 of file golden.c.

◆ labelColor

const PICO9918_PIXEL_T labelColor
extern

Definition at line 93 of file diag.c.

◆ valueColor

const PICO9918_PIXEL_T valueColor
extern

Definition at line 94 of file diag.c.

◆ unitsColor

const PICO9918_PIXEL_T unitsColor
extern

Definition at line 95 of file diag.c.

◆ frameDigests

uint64_t frameDigests[FRAME_MAX_ROWS][2]
static

Definition at line 2607 of file golden.c.

◆ frameRowCount

int frameRowCount
static

Definition at line 2608 of file golden.c.

◆ frFailRow

int frFailRow
static

Definition at line 2611 of file golden.c.

◆ frFailField

const char* frFailField
static

Definition at line 2612 of file golden.c.

◆ frFailCand

long frFailCand
static

Definition at line 2613 of file golden.c.

◆ frFailRef

long frFailRef
static

Definition at line 2614 of file golden.c.

◆ frRowLabel

const char* frRowLabel[FRAME_MAX_ROWS]
static

Definition at line 2616 of file golden.c.

◆ frCurrentLabel

const char* frCurrentLabel = ""
static

Definition at line 2617 of file golden.c.

◆ frameFieldName

const char* const frameFieldName[FRAME_ROW_VALUES]
static
Initial value:
= {
"mappedLine", "vPixelScale", "vVirtualPixels", "vPixels", "vBorder", "triggerScanline", "paramsVPixelScale",
"paramsVVirtualPixels", "activeLines",
"frameStatusShadow", "sr0Register", "intPin", "sr1Register", "lockLatch", "publishedStatus"}

Definition at line 2632 of file golden.c.

◆ frMapLabels

char frMapLabels[FRAME_MAX_ROWS][32]
static

Definition at line 2704 of file golden.c.

◆ frIntLabels

char frIntLabels[FRAME_MAX_ROWS][40]
static

Definition at line 3070 of file golden.c.