pico9918-core 1.3.0
TMS9918A / F18A video display processor emulation in C99
Loading...
Searching...
No Matches
splash.h
Go to the documentation of this file.
1/**
2 * \file
3 * \brief pico9918-core - Splash overlay
4 *
5 * Copyright (c) 2024 Troy Schrapel
6 *
7 * This code is licensed under the MIT license
8 *
9 * https://github.com/visrealm/pico9918-core
10 *
11 * The splash logo the device shows over the bottom border for its first few
12 * hundred frames, before the host enables the display. Device behaviour, not
13 * decoration - an emulator that omits it is not emulating the device.
14 *
15 * Geometry arrives per call. The overlay owns no display parameters, so this
16 * header carries no host dependency; the caller supplies the row counts it
17 * already has.
18 *
19 * PICO9918_NO_SPLASH compiles this module to nothing (the build also drops the
20 * image asset), so the calls remain valid and cost nothing.
21 */
22
23#ifndef _PICO9918_SPLASH_H
24#define _PICO9918_SPLASH_H
25
26#include "impl/platform.h"
27#include "pico9918.h"
28#include "pico9918_build_config.h"
29
30#include <stdbool.h>
31#include <stdint.h>
32
33#ifndef PICO9918_NO_SPLASH
34/** \brief set to 1 to build without the splash overlay */
35#define PICO9918_NO_SPLASH 0
36#endif
37
38/*
39 * This is the library's first public API to hand out a PICO9918_PIXEL_T buffer,
40 * and the pixel width is a per-build choice, so a consumer compiled against a
41 * different policy than the library would stride every write wrongly - with a
42 * clean compile and a clean link, then corrupt pixels. Assert UNCONDITIONALLY
43 * against the width recorded when the library was built.
44 *
45 * The width comes from the generated pico9918_build_config.h rather than from
46 * a compile definition on purpose: a definition set on the library's CMake
47 * target reaches the library's own translation units and nobody else, so it
48 * cannot catch the case that matters. Found by adversarial review, which showed
49 * a uint32 consumer linking a uint16 library and writing at half stride.
50 */
51PICO9918_STATIC_ASSERT(sizeof(PICO9918_PIXEL_T) == PICO9918_BUILD_PIXEL_SIZE,
52 "PICO9918_PIXEL_T does not match the width this library was built "
53 "with (see pico9918_build_config.h). Select the same pixel "
54 "policy the library used - one ships, and it is the default in "
55 "platform/ on both platforms.");
56
57#ifdef __cplusplus
58extern "C"
59{
60#endif
61
62 /** restart the splash animation (after... reset) */
64 void pico9918_splash_reset(void);
65
66 /** allow the splash to animate back out - the host calls this once the display
67 * has been enabled */
70
71 /**
72 * render the splash logo into the scanline buffer, if row `y` falls in the
73 * logo band. Also advances the animation, on y == 0.
74 */
76 void pico9918_splash_render(uint16_t y, uint32_t frameCount, uint32_t vBorder, uint32_t vPixels,
77 uint32_t vVirtualPixels, PICO9918_PIXEL_T* pixels);
78
79#if PICO9918_BUILD_RUNTIME_CHIP
80
81/** \brief badge columns - must stay a multiple of 8, see splash.c */
82#define PICO9918_F18A_BADGE_WIDTH 56
83/** \brief badge rows, each one OUTPUT line rather than one display line */
84#define PICO9918_F18A_BADGE_HEIGHT 14
85/** \brief frames the badge is shown for, counting from reset */
86#define PICO9918_F18A_BADGE_FRAMES 384
87
88 /**
89 * \brief render the F18A's power-on badge into the scanline buffer
90 *
91 * What PICO9918_CHIP_F18A shows where PICO9918_CHIP_PICO9918 shows its own splash.
92 * Not gated behind PICO9918_NO_SPLASH: that option drops the PICO9918's splash, and
93 * an F18A still has a badge.
94 *
95 * `outputLine` is the host's OUTPUT line, not a display line, so one row of the
96 * badge is one physical scanline. Only a host driving pico9918_frame_output_line
97 * gets it; an interlaced one, which drives pico9918_frame_scanline per field, does
98 * not.
99 *
100 * \return whether it drew, i.e. whether `pixels` changed.
101 */
102 /**
103 * \brief choose the PRO artwork over the PICO9918's
104 *
105 * pico9918_set_chip calls this; a host has no reason to. Only a runtime-chip build
106 * carries both images - a board resolves its one at build time.
107 */
109 void pico9918_splash_select_pro(bool pro);
110
112 bool pico9918_f18a_badge_render(uint16_t outputLine, uint32_t frameCount,
113 PICO9918_PIXEL_T* pixels);
114
115#endif // PICO9918_BUILD_RUNTIME_CHIP
116
117#ifdef __cplusplus
118}
119#endif
120
121#endif // _PICO9918_SPLASH_H
pico9918-core - core interface
#define PICO9918_DLLEXPORT
the linkage every public entry point carries - see LINKAGE MODES above
Definition pico9918.h:41
pico9918-core - Platform Abstraction
void pico9918_splash_allow_hide(void)
allow the splash to animate back out - the host calls this once the display has been enabled
Definition splash.c:64
void pico9918_splash_select_pro(bool pro)
render the F18A's power-on badge into the scanline buffer
Definition splash.c:36
void pico9918_splash_render(uint16_t y, uint32_t frameCount, uint32_t vBorder, uint32_t vPixels, uint32_t vVirtualPixels, PICO9918_PIXEL_T *pixels)
render the splash logo into the scanline buffer, if row y falls in the logo band.
Definition splash.c:74
void pico9918_splash_reset(void)
restart the splash animation (after... reset)
Definition splash.c:57