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   2
 
#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   13
 
#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, bool unlocked)
 
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 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
 
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 247 of file golden.c.

◆ FNV64_PRIME

#define FNV64_PRIME   0x00000100000001b3ull

Definition at line 248 of file golden.c.

◆ POST_PAL_PIXELS

#define POST_PAL_PIXELS   (GOLDEN_BYTES_PER_LINE * 2)

Definition at line 290 of file golden.c.

◆ SCENE_COUNT

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

Definition at line 843 of file golden.c.

◆ MAX_LINES

#define MAX_LINES   240

Definition at line 844 of file golden.c.

◆ OVERLAY_MAGIC

#define OVERLAY_MAGIC   "TMSO"

Definition at line 1196 of file golden.c.

◆ OVERLAY_VERSION

#define OVERLAY_VERSION   1

Definition at line 1197 of file golden.c.

◆ OVERLAY_FONT_WIDTH

#define OVERLAY_FONT_WIDTH   768

Definition at line 1219 of file golden.c.

◆ OVERLAY_FONT_HEIGHT

#define OVERLAY_FONT_HEIGHT   6

Definition at line 1220 of file golden.c.

◆ OVERLAY_SPLASH_WIDTH

#define OVERLAY_SPLASH_WIDTH   176

Definition at line 1221 of file golden.c.

◆ OVERLAY_SPLASH_HEIGHT

#define OVERLAY_SPLASH_HEIGHT   10

Definition at line 1222 of file golden.c.

◆ fontWidth

#define fontWidth   goldenUnusedFontWidth

Definition at line 1228 of file golden.c.

◆ fontHeight

#define fontHeight   goldenUnusedFontHeight

Definition at line 1229 of file golden.c.

◆ splashWidth

#define splashWidth   goldenUnusedSplashWidth

Definition at line 1230 of file golden.c.

◆ splashHeight

#define splashHeight   goldenUnusedSplashHeight

Definition at line 1231 of file golden.c.

◆ OVERLAY_PIXELS_X

#define OVERLAY_PIXELS_X   642

Definition at line 1257 of file golden.c.

◆ OVERLAY_PREFILL_SEED

#define OVERLAY_PREFILL_SEED   0xfedc

Definition at line 1272 of file golden.c.

◆ OVERLAY_FONT_ROW_BYTES

#define OVERLAY_FONT_ROW_BYTES   (OVERLAY_FONT_WIDTH / 8)

Definition at line 1339 of file golden.c.

◆ OVERLAY_SPLASH_ENTER_FRAMES

#define OVERLAY_SPLASH_ENTER_FRAMES   60

Definition at line 1398 of file golden.c.

◆ OVERLAY_SPLASH_HOLD_FRAMES

#define OVERLAY_SPLASH_HOLD_FRAMES   180

Definition at line 1399 of file golden.c.

◆ OVERLAY_SPLASH_START_POS

#define OVERLAY_SPLASH_START_POS    (OVERLAY_SPLASH_ENTER_FRAMES + OVERLAY_SPLASH_HEIGHT + 2)

Definition at line 1400 of file golden.c.

◆ OVERLAY_MAX_ROWS

#define OVERLAY_MAX_ROWS   4096

Definition at line 1450 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 1516 of file golden.c.

◆ OVERLAY_BANNER_FG

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

Definition at line 1520 of file golden.c.

◆ OVERLAY_SPLASH_VVIRT

#define OVERLAY_SPLASH_VVIRT   240u

Definition at line 1626 of file golden.c.

◆ OVERLAY_SPLASH_VPIXELS

#define OVERLAY_SPLASH_VPIXELS   192u

Definition at line 1627 of file golden.c.

◆ OVERLAY_SPLASH_VBORDER

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

Definition at line 1628 of file golden.c.

◆ FRAME_MAGIC

#define FRAME_MAGIC   "TMSF"

Definition at line 2279 of file golden.c.

◆ FRAME_VERSION

#define FRAME_VERSION   2

Definition at line 2282 of file golden.c.

◆ FRAME_R0_DOUBLE_ROWS

#define FRAME_R0_DOUBLE_ROWS   0x08

Definition at line 2286 of file golden.c.

◆ FRAME_R31_ROW30

#define FRAME_R31_ROW30   0x40

Definition at line 2289 of file golden.c.

◆ FRAME_DISPLAY_VGA

#define FRAME_DISPLAY_VGA   480

Definition at line 2297 of file golden.c.

◆ FRAME_DISPLAY_SCART_PAL

#define FRAME_DISPLAY_SCART_PAL   268

Definition at line 2298 of file golden.c.

◆ FRAME_DISPLAY_SCART_NTSC

#define FRAME_DISPLAY_SCART_NTSC   220

Definition at line 2299 of file golden.c.

◆ FRAME_INTERLACED_PIXEL_SCALE

#define FRAME_INTERLACED_PIXEL_SCALE   1

Definition at line 2304 of file golden.c.

◆ FRAME_MAX_ROWS

#define FRAME_MAX_ROWS   1024

Definition at line 2601 of file golden.c.

◆ FRAME_ROW_VALUES

#define FRAME_ROW_VALUES   13

Definition at line 2621 of file golden.c.

◆ FRAME_R1_INT_ENABLE

#define FRAME_R1_INT_ENABLE   0x20

Definition at line 2897 of file golden.c.

◆ FRAME_SR0_F

#define FRAME_SR0_F   0x80 /* frame interrupt */

Definition at line 2901 of file golden.c.

◆ FRAME_SR0_5S

#define FRAME_SR0_5S   0x40 /* fifth sprite */

Definition at line 2902 of file golden.c.

◆ FRAME_SR0_COL

#define FRAME_SR0_COL   0x20 /* sprite collision */

Definition at line 2903 of file golden.c.

◆ FRAME_SR0_ID

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

Definition at line 2904 of file golden.c.

◆ FRAME_R0_INT_SCANLINE

#define FRAME_R0_INT_SCANLINE   0x10

Definition at line 2908 of file golden.c.

◆ FRAME_SR1_HF

#define FRAME_SR1_HF   0x01

Definition at line 2909 of file golden.c.

Function Documentation

◆ lcgSeed()

static void lcgSeed ( uint32_t  seed)
static

Definition at line 74 of file golden.c.

◆ lcgByte()

static uint8_t lcgByte ( void  )
static

Definition at line 79 of file golden.c.

◆ regWrite()

static void regWrite ( uint8_t  reg,
uint8_t  value 
)
static

Definition at line 89 of file golden.c.

◆ vramSetWriteAddr()

static void vramSetWriteAddr ( uint16_t  addr)
static

Definition at line 95 of file golden.c.

◆ vramSetReadAddr()

static void vramSetReadAddr ( uint16_t  addr)
static

Definition at line 103 of file golden.c.

◆ vramFillLcg()

static void vramFillLcg ( uint16_t  addr,
int  count 
)
static

Definition at line 109 of file golden.c.

◆ vramFillByte()

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

Definition at line 115 of file golden.c.

◆ vramWriteBytes()

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

Definition at line 121 of file golden.c.

◆ unlockF18a()

static void unlockF18a ( void  )
static

Definition at line 128 of file golden.c.

◆ paletteWriteLcg()

static void paletteWriteLcg ( int  count)
static

Definition at line 137 of file golden.c.

◆ sceneBegin()

static void sceneBegin ( void  )
static

Definition at line 151 of file golden.c.

◆ dumpPalette()

static void dumpPalette ( uint8_t  out[GOLDEN_PAL_BYTES])
static

Definition at line 181 of file golden.c.

◆ fnv1a()

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

Definition at line 250 of file golden.c.

◆ refPixel()

static uint16_t refPixel ( uint16_t  pram)
static

Definition at line 281 of file golden.c.

◆ refRegenerate()

static void refRegenerate ( bool  paired)
static

Definition at line 331 of file golden.c.

◆ refExpand()

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

Definition at line 361 of file golden.c.

◆ expandLine()

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

Definition at line 372 of file golden.c.

◆ refDivergence()

static int refDivergence ( void  )
static

Definition at line 384 of file golden.c.

◆ sceneGraphicsI()

static void sceneGraphicsI ( void  )
static

Definition at line 398 of file golden.c.

◆ sceneGraphicsII()

static void sceneGraphicsII ( void  )
static

Definition at line 414 of file golden.c.

◆ sceneText()

static void sceneText ( void  )
static

Definition at line 429 of file golden.c.

◆ sceneMulticolor()

static void sceneMulticolor ( void  )
static

Definition at line 441 of file golden.c.

◆ sceneText80()

static void sceneText80 ( void  )
static

Definition at line 456 of file golden.c.

◆ sceneSpritesMax()

static void sceneSpritesMax ( void  )
static

Definition at line 469 of file golden.c.

◆ sceneF18aUnlocked()

static void sceneF18aUnlocked ( void  )
static

Definition at line 500 of file golden.c.

◆ sceneF18aEcm3Bml()

static void sceneF18aEcm3Bml ( void  )
static

Definition at line 529 of file golden.c.

◆ sceneF18aBmlWrap()

static void sceneF18aBmlWrap ( void  )
static

Definition at line 556 of file golden.c.

◆ sceneF18aBmlStride()

static void sceneF18aBmlStride ( void  )
static

Definition at line 583 of file golden.c.

◆ sceneF18aText80Attrs()

static void sceneF18aText80Attrs ( void  )
static

Definition at line 608 of file golden.c.

◆ sceneF18aVramSnapshot()

static void sceneF18aVramSnapshot ( void  )
static

Definition at line 631 of file golden.c.

◆ sceneF18aBmlPriority()

static void sceneF18aBmlPriority ( void  )
static

Definition at line 668 of file golden.c.

◆ sceneF18aEcm0()

static void sceneF18aEcm0 ( void  )
static

Definition at line 706 of file golden.c.

◆ sceneF18aGfx2()

static void sceneF18aGfx2 ( void  )
static

Definition at line 762 of file golden.c.

◆ sceneRawReset()

static void sceneRawReset ( void  )
static

Definition at line 802 of file golden.c.

◆ renderScene()

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

Definition at line 870 of file golden.c.

◆ putU32()

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

Definition at line 947 of file golden.c.

◆ putU64()

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

Definition at line 953 of file golden.c.

◆ getU32()

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

Definition at line 959 of file golden.c.

◆ getU64()

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

Definition at line 967 of file golden.c.

◆ scenePath()

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

Definition at line 976 of file golden.c.

◆ captureScene()

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

Definition at line 981 of file golden.c.

◆ compareScene()

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

Definition at line 1035 of file golden.c.

◆ overlayPrefill()

static void overlayPrefill ( void  )
static

Definition at line 1274 of file golden.c.

◆ overlayRestorePrefill()

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

Definition at line 1288 of file golden.c.

◆ refDarken()

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

Definition at line 1315 of file golden.c.

◆ refGlyphRowBits()

static uint8_t refGlyphRowBits ( char  ch,
int  fy 
)
static

Definition at line 1341 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 1360 of file golden.c.

◆ refSplashReset()

static void refSplashReset ( void  )
static

Definition at line 1403 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 1408 of file golden.c.

◆ overlayEmitRow()

static void overlayEmitRow ( void  )
static

Definition at line 1466 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 1538 of file golden.c.

◆ overlayTextGroup()

static void overlayTextGroup ( void  )
static

Definition at line 1556 of file golden.c.

◆ overlaySplashFrame()

static void overlaySplashFrame ( uint32_t  frameCount,
bool  sample 
)
static

Definition at line 1630 of file golden.c.

◆ overlaySplashGroup()

static void overlaySplashGroup ( void  )
static

Definition at line 1658 of file golden.c.

◆ refSwatch()

static PICO9918_PIXEL_T refSwatch ( uint16_t  pram)
static

Definition at line 1747 of file golden.c.

◆ refPalettePanel()

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

Definition at line 1758 of file golden.c.

◆ refRegisterPanel()

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

Definition at line 1783 of file golden.c.

◆ overlaySetConfig()

static void overlaySetConfig ( uint8_t  index,
uint8_t  value 
)
static

Definition at line 1810 of file golden.c.

◆ overlayPrimeDiag()

static void overlayPrimeDiag ( void  )
static

Definition at line 1847 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 1908 of file golden.c.

◆ overlayPanelGroup()

static void overlayPanelGroup ( void  )
static

Definition at line 2084 of file golden.c.

◆ overlayRender()

static void overlayRender ( void  )
static

Definition at line 2113 of file golden.c.

◆ overlayCapture()

static bool overlayCapture ( const char *  dataDir)
static

Definition at line 2128 of file golden.c.

◆ overlayCompare()

static bool overlayCompare ( const char *  dataDir)
static

Definition at line 2165 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 2367 of file golden.c.

◆ frameGeometry()

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

Definition at line 2404 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 2449 of file golden.c.

◆ refGeometry()

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

Definition at line 2489 of file golden.c.

◆ frameActiveLines()

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

Definition at line 2562 of file golden.c.

◆ refActiveLines()

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

Definition at line 2574 of file golden.c.

◆ frameEmitRow()

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

Definition at line 2634 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 2678 of file golden.c.

◆ frameMapQuad()

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

Definition at line 2702 of file golden.c.

◆ frameMapGroup()

static void frameMapGroup ( void  )
static

Definition at line 2725 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 2794 of file golden.c.

◆ frameGeomGroup()

static void frameGeomGroup ( void  )
static

Definition at line 2831 of file golden.c.

◆ refMergeStatus()

static uint8_t refMergeStatus ( uint8_t  currentStatus,
uint8_t  tempStatus 
)
static

Definition at line 2922 of file golden.c.

◆ refIntPin()

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

Definition at line 2966 of file golden.c.

◆ frameIntSetup()

static void frameIntSetup ( bool  want)
static

Definition at line 2987 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 3002 of file golden.c.

◆ frameIntQuad()

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

Definition at line 3050 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 3081 of file golden.c.

◆ frameHIntReadCase()

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

Definition at line 3109 of file golden.c.

◆ frameIntGroup()

static void frameIntGroup ( void  )
static

Definition at line 3143 of file golden.c.

◆ frameRender()

static void frameRender ( void  )
static

Definition at line 3249 of file golden.c.

◆ frameCapture()

static bool frameCapture ( const char *  dataDir)
static

Definition at line 3273 of file golden.c.

◆ frameCompare()

static bool frameCompare ( const char *  dataDir)
static

Definition at line 3311 of file golden.c.

◆ resetCheck()

static bool resetCheck ( void  )
static

Definition at line 3390 of file golden.c.

◆ unlockCheck()

static bool unlockCheck ( void  )
static

Definition at line 3416 of file golden.c.

◆ main()

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

Definition at line 3456 of file golden.c.

Variable Documentation

◆ goldenClockNow

uint32_t goldenClockNow = 0

Definition at line 67 of file golden.c.

◆ lcgState

uint32_t lcgState
static

Definition at line 72 of file golden.c.

◆ libPixels

PICO9918_PIXEL_T libPixels[POST_PAL_PIXELS]
static

Definition at line 292 of file golden.c.

◆ refPixels

uint16_t refPixels[POST_PAL_PIXELS]
static

Definition at line 293 of file golden.c.

◆ refLut

uint32_t refLut[256]
static

Definition at line 317 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 824 of file golden.c.

◆ frame

uint8_t frame[MAX_LINES][GOLDEN_BYTES_PER_LINE+1]
static

Definition at line 854 of file golden.c.

◆ palDump

uint8_t palDump[GOLDEN_PAL_BYTES]
static

Definition at line 857 of file golden.c.

◆ digests

uint64_t digests[MAX_LINES][GOLDEN_DIGESTS_PER_LINE]
static

Definition at line 860 of file golden.c.

◆ refFailLine

int refFailLine
static

Definition at line 865 of file golden.c.

◆ refFailPixel

int refFailPixel
static

Definition at line 866 of file golden.c.

◆ refFailLib

uint16_t refFailLib
static

Definition at line 867 of file golden.c.

◆ refFailRef

uint16_t refFailRef
static

Definition at line 868 of file golden.c.

◆ ovLib

PICO9918_PIXEL_T ovLib[OVERLAY_PIXELS_X]
static

Definition at line 1259 of file golden.c.

◆ ovRef

PICO9918_PIXEL_T ovRef[OVERLAY_PIXELS_X]
static

Definition at line 1260 of file golden.c.

◆ refLogoOffset

int refLogoOffset
static

Definition at line 1393 of file golden.c.

◆ refCanHide

bool refCanHide
static

Definition at line 1394 of file golden.c.

◆ overlayDigests

uint64_t overlayDigests[OVERLAY_MAX_ROWS][2]
static

Definition at line 1452 of file golden.c.

◆ overlayRowCount

int overlayRowCount
static

Definition at line 1453 of file golden.c.

◆ ovFailRow

int ovFailRow
static

Definition at line 1456 of file golden.c.

◆ ovFailPixel

int ovFailPixel
static

Definition at line 1457 of file golden.c.

◆ ovFailLib

uint16_t ovFailLib
static

Definition at line 1458 of file golden.c.

◆ ovFailRef

uint16_t ovFailRef
static

Definition at line 1459 of file golden.c.

◆ ovRowLabel

const char* ovRowLabel[OVERLAY_MAX_ROWS]
static

Definition at line 1463 of file golden.c.

◆ ovCurrentLabel

const char* ovCurrentLabel = ""
static

Definition at line 1464 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 2603 of file golden.c.

◆ frameRowCount

int frameRowCount
static

Definition at line 2604 of file golden.c.

◆ frFailRow

int frFailRow
static

Definition at line 2607 of file golden.c.

◆ frFailField

const char* frFailField
static

Definition at line 2608 of file golden.c.

◆ frFailCand

long frFailCand
static

Definition at line 2609 of file golden.c.

◆ frFailRef

long frFailRef
static

Definition at line 2610 of file golden.c.

◆ frRowLabel

const char* frRowLabel[FRAME_MAX_ROWS]
static

Definition at line 2612 of file golden.c.

◆ frCurrentLabel

const char* frCurrentLabel = ""
static

Definition at line 2613 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"}

Definition at line 2628 of file golden.c.

◆ frMapLabels

char frMapLabels[FRAME_MAX_ROWS][32]
static

Definition at line 2700 of file golden.c.

◆ frIntLabels

char frIntLabels[FRAME_MAX_ROWS][40]
static

Definition at line 3048 of file golden.c.