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

pico9918-core - the debugger surface More...

#include "impl/pico9918_priv.h"
#include "pico9918_debug.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ Include dependency graph for debug_test.c:

Go to the source code of this file.

Functions

static void fail (const char *what, unsigned long wanted, unsigned long got)
 
static void expectRegion (const char *what, uint32_t addr, uint32_t wantFlags, uint32_t wantEnd)
 
int main (void)
 

Variables

static int failures
 

Detailed Description

pico9918-core - the debugger surface

Copyright (c) 2026 Troy Schrapel

This code is licensed under the MIT license

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

What is under test is nowhere near the copy loops. It is that the regions land where the union actually puts its fields; that region, read and write agree about where each one stops, since a pane splitting bulk work on those boundaries has to land on the same bytes the transfer does; and that the register write does the four things it promises and not a fifth.

That last one is checked twice. Once case by case - R30 on a locked device landing at R30 rather than R6, R55 not arming a program, R57 not moving the unlock latch - and once by snapshotting the whole instance across a write and asserting that exactly two bytes moved. The second is the one that catches state nobody thought to name, including state added to pico9918_t after this was written.

The edges are here because every one of them is a coin-flip an implementation would otherwise settle silently: zero length, a null buffer, exactly at the end, past it, and a length that would run off the end of the map.

Definition in file debug_test.c.

Function Documentation

◆ fail()

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

Definition at line 38 of file debug_test.c.

◆ expectRegion()

static void expectRegion ( const char *  what,
uint32_t  addr,
uint32_t  wantFlags,
uint32_t  wantEnd 
)
static

Definition at line 44 of file debug_test.c.

◆ main()

int main ( void  )

Definition at line 53 of file debug_test.c.

Variable Documentation

◆ failures

int failures
static

Definition at line 36 of file debug_test.c.