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

pico9918-core - the post-palette pixel path More...

#include "impl/pico9918_priv.h"
#include "pico9918_frame.h"
#include <stdio.h>
#include <string.h>
+ Include dependency graph for pixel_test.c:

Go to the source code of this file.

Macros

#define H_VIRTUAL   640u
 
#define H_BORDER   ((H_VIRTUAL - TMS9918_PIXELS_X * 2u) / 2u) /* 64 pixels each side */
 
#define SENTINEL   0xbeefu
 

Functions

static void fail (const char *what, unsigned where, unsigned wanted, unsigned got)
 
static void regWrite (uint8_t reg, uint8_t value)
 
static void unlock (void)
 
static void distinctPalette (void)
 
static uint16_t want (int index)
 
static void renderLines (uint16_t from, uint16_t to)
 
static uint16_t activeLine (void)
 
static void renderOneActiveLine (void)
 
static void text80 (void)
 
static void checkLineBytes (const char *stage, uint32_t wanted)
 
static void checkDoubledLayout (const char *stage)
 
static void checkPackedLayout (const char *stage)
 
static void checkGeometry (const char *stage, int doubled)
 
static uint16_t dimmed (uint16_t src)
 
static void setScanlines (int on)
 
static void checkDimMaths (void)
 
static void checkDimScale1 (void)
 
int main (void)
 

Variables

static pico9918_scanline_params_t params = {H_VIRTUAL, 240, false, 0}
 
static PICO9918_PIXEL_T line [H_VIRTUAL+16]
 
static int failures
 

Detailed Description

pico9918-core - the post-palette pixel path

Copyright (c) 2026 Troy Schrapel

This code is licensed under the MIT license

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

Everything between a palette index and a host's framebuffer, which nothing else covers: the goldens render a 256-byte line and digest it, and the scene suite compares palette INDEXES. Neither looks at a wide row's colours, and neither looks at where in the scanline the picture lands.

Both are load-bearing for a host. The LUT has two layouts - a pixel pair per entry for every mode that doubles, and a nibble pair for the 4bpp 80-column line - and a row that picks the wrong one still renders, in the wrong colours. The geometry is denominated in 32-bit words holding two pixels, so a host that reads the window at the wrong offset gets the border fill through the middle of its picture.

Definition in file pixel_test.c.

Macro Definition Documentation

◆ H_VIRTUAL

#define H_VIRTUAL   640u

Definition at line 29 of file pixel_test.c.

◆ H_BORDER

#define H_BORDER   ((H_VIRTUAL - TMS9918_PIXELS_X * 2u) / 2u) /* 64 pixels each side */

Definition at line 30 of file pixel_test.c.

◆ SENTINEL

#define SENTINEL   0xbeefu

Definition at line 31 of file pixel_test.c.

Function Documentation

◆ fail()

static void fail ( const char *  what,
unsigned  where,
unsigned  wanted,
unsigned  got 
)
static

Definition at line 38 of file pixel_test.c.

◆ regWrite()

static void regWrite ( uint8_t  reg,
uint8_t  value 
)
static

Definition at line 43 of file pixel_test.c.

◆ unlock()

static void unlock ( void  )
static

Definition at line 49 of file pixel_test.c.

◆ distinctPalette()

static void distinctPalette ( void  )
static

Definition at line 57 of file pixel_test.c.

◆ want()

static uint16_t want ( int  index)
static

Definition at line 62 of file pixel_test.c.

◆ renderLines()

static void renderLines ( uint16_t  from,
uint16_t  to 
)
static

Definition at line 67 of file pixel_test.c.

◆ activeLine()

static uint16_t activeLine ( void  )
static

Definition at line 74 of file pixel_test.c.

◆ renderOneActiveLine()

static void renderOneActiveLine ( void  )
static

Definition at line 84 of file pixel_test.c.

◆ text80()

static void text80 ( void  )
static

Definition at line 90 of file pixel_test.c.

◆ checkLineBytes()

static void checkLineBytes ( const char *  stage,
uint32_t  wanted 
)
static

Definition at line 99 of file pixel_test.c.

◆ checkDoubledLayout()

static void checkDoubledLayout ( const char *  stage)
static

Definition at line 115 of file pixel_test.c.

◆ checkPackedLayout()

static void checkPackedLayout ( const char *  stage)
static

Definition at line 133 of file pixel_test.c.

◆ checkGeometry()

static void checkGeometry ( const char *  stage,
int  doubled 
)
static

Definition at line 153 of file pixel_test.c.

◆ dimmed()

static uint16_t dimmed ( uint16_t  src)
static

Definition at line 182 of file pixel_test.c.

◆ setScanlines()

static void setScanlines ( int  on)
static

Definition at line 189 of file pixel_test.c.

◆ checkDimMaths()

static void checkDimMaths ( void  )
static

Definition at line 199 of file pixel_test.c.

◆ checkDimScale1()

static void checkDimScale1 ( void  )
static

Definition at line 230 of file pixel_test.c.

◆ main()

int main ( void  )

Definition at line 259 of file pixel_test.c.

Variable Documentation

◆ params

pico9918_scanline_params_t params = {H_VIRTUAL, 240, false, 0}
static

Definition at line 33 of file pixel_test.c.

◆ line

PICO9918_PIXEL_T line[H_VIRTUAL+16]
static

Definition at line 34 of file pixel_test.c.

◆ failures

int failures
static

Definition at line 36 of file pixel_test.c.