|
pico9918-core 1.3.0
TMS9918A / F18A video display processor emulation in C99
|
pico9918-core - the TMS9900 cores' unit tests: ARM assembly against portable C More...
#include <stdio.h>#include <string.h>#include <stdint.h>#include "pico/stdlib.h"#include "tms9900.h"
Include dependency graph for tms9900_test.c:Go to the source code of this file.
Macros | |
| #define | MEM_SIZE (0x10000u + 36) |
| #define | WP 0xFFFEu |
| #define | PROG 0x0100u |
| #define | SCRATCH 0x0200u |
| #define | REG(r) ((uint32_t)(WP + (r) * 2u)) |
| #define | CHECK_REG(lbl, reg, expected) |
| #define | CHECK_MEM16(lbl, addr, expected) |
| #define | CHECK_MEM8(lbl, addr, expected) |
| #define | MAX_PROG 128u |
| #define | IDLE 0x0340u |
| #define | CHECK_JUMP(lbl, taken) |
Functions | |
| uint16_t | run9900 (uint8_t *memory, uint16_t pc, uint16_t wp, uint8_t *regx38) |
| static | _Alignas (4) |
| static uint16_t | r16 (uint32_t addr) |
| static void | setup (const uint16_t *regs) |
| static void | load_prog (const uint8_t *prog, uint16_t len) |
| static void | run_c (void) |
| static void | run_asm (void) |
| static void | check (const char *label, int ok, const char *detail) |
| static void | emit (uint8_t *b, uint16_t *o, uint16_t w) |
| static void | li (uint8_t *b, uint16_t *o, uint8_t rd, uint16_t imm) |
| static void | ai (uint8_t *b, uint16_t *o, uint8_t rd, uint16_t imm) |
| static void | andi_op (uint8_t *b, uint16_t *o, uint8_t rd, uint16_t imm) |
| static void | ori_op (uint8_t *b, uint16_t *o, uint8_t rd, uint16_t imm) |
| static void | ci (uint8_t *b, uint16_t *o, uint8_t rd, uint16_t imm) |
| static void | stwp (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | stst (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | lwpi (uint8_t *b, uint16_t *o, uint16_t wp) |
| static void | limi (uint8_t *b, uint16_t *o, uint16_t mask) |
| static void | rtwp (uint8_t *b, uint16_t *o) |
| static void | blwp (uint8_t *b, uint16_t *o, uint16_t addr) |
| static void | b_ind (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | b_abs (uint8_t *b, uint16_t *o, uint16_t addr) |
| static void | x_reg (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | clr (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | neg (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | inv (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | inc (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | inct (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | dec (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | dect (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | bl_abs (uint8_t *b, uint16_t *o, uint16_t addr) |
| static void | swpb (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | seto (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | abs_r (uint8_t *b, uint16_t *o, uint8_t rd) |
| static void | rt (uint8_t *b, uint16_t *o) |
| static void | sra (uint8_t *b, uint16_t *o, uint8_t rd, uint8_t c) |
| static void | srl (uint8_t *b, uint16_t *o, uint8_t rd, uint8_t c) |
| static void | sla (uint8_t *b, uint16_t *o, uint8_t rd, uint8_t c) |
| static void | src_op (uint8_t *b, uint16_t *o, uint8_t rd, uint8_t c) |
| static void | jcc (uint8_t *b, uint16_t *o, uint8_t cond, int8_t off) |
| static void | jmp (uint8_t *b, uint16_t *o, int8_t off) |
| static void | jlt (uint8_t *b, uint16_t *o, int8_t off) |
| static void | jle (uint8_t *b, uint16_t *o, int8_t off) |
| static void | jeq (uint8_t *b, uint16_t *o, int8_t off) |
| static void | jhe (uint8_t *b, uint16_t *o, int8_t off) |
| static void | jgt (uint8_t *b, uint16_t *o, int8_t off) |
| static void | jne (uint8_t *b, uint16_t *o, int8_t off) |
| static void | jnc (uint8_t *b, uint16_t *o, int8_t off) |
| static void | joc (uint8_t *b, uint16_t *o, int8_t off) |
| static void | jno (uint8_t *b, uint16_t *o, int8_t off) |
| static void | jl (uint8_t *b, uint16_t *o, int8_t off) |
| static void | jh (uint8_t *b, uint16_t *o, int8_t off) |
| static void | jop (uint8_t *b, uint16_t *o, int8_t off) |
| static void | coc (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | czc (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | xor_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | pix (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | mpy (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | div_op (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | szc_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | szcb_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | sub_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | sb_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | cb_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | add_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | ab_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | mov_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | mov_ir (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | mov_ri (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | mov_ar (uint8_t *b, uint16_t *o, uint16_t addr, uint8_t rd) |
| static void | movb_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | soc_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | socb_rr (uint8_t *b, uint16_t *o, uint8_t rs, uint8_t rd) |
| static void | test_data_transfer (void) |
| static void | test_arithmetic (void) |
| static void | test_logical (void) |
| static void | test_shifts (void) |
| static void | test_branches (void) |
| static void | test_jumps (void) |
| static void | test_misc (void) |
| static void | test_pix (void) |
| static void | test_blwp (void) |
| static void | test_decode_flat (void) |
| static void | test_decode (void) |
| static void | test_stress (void) |
| int | main (void) |
Variables | |
| static bool | f18aMemory = false |
| static char | _det [128] |
pico9918-core - the TMS9900 cores' unit tests: ARM assembly against portable C
Copyright (c) 2026 Troy Schrapel
This code is licensed under the MIT license
https://github.com/visrealm/pico9918-core
Runs tests sequentially against the ARM assembly core (run9900) then the portable C core (run9900_c), printing PASS/FAIL for each. Each test prints its name BEFORE running so a hang is immediately identifiable from the output.
Memory layout: 0x0000 - workspace (WP=0x0000, registers R0..R15 at offsets 0..30) 0x0100 - test program 0x0200 - scratch / indirect target area
Definition in file tms9900_test.c.
| #define MEM_SIZE (0x10000u + 36) |
Definition at line 43 of file tms9900_test.c.
| #define WP 0xFFFEu |
Definition at line 44 of file tms9900_test.c.
| #define PROG 0x0100u |
Definition at line 45 of file tms9900_test.c.
| #define SCRATCH 0x0200u |
Definition at line 46 of file tms9900_test.c.
| #define REG | ( | r | ) | ((uint32_t)(WP + (r) * 2u)) |
Definition at line 47 of file tms9900_test.c.
| #define CHECK_REG | ( | lbl, | |
| reg, | |||
| expected | |||
| ) |
Definition at line 152 of file tms9900_test.c.
| #define CHECK_MEM16 | ( | lbl, | |
| addr, | |||
| expected | |||
| ) |
Definition at line 158 of file tms9900_test.c.
| #define CHECK_MEM8 | ( | lbl, | |
| addr, | |||
| expected | |||
| ) |
Definition at line 164 of file tms9900_test.c.
| #define MAX_PROG 128u |
Definition at line 173 of file tms9900_test.c.
| #define IDLE 0x0340u |
Definition at line 181 of file tms9900_test.c.
| #define CHECK_JUMP | ( | lbl, | |
| taken | |||
| ) |
|
static |
Definition at line 49 of file tms9900_test.c.
|
inlinestatic |
Definition at line 72 of file tms9900_test.c.
|
static |
Definition at line 84 of file tms9900_test.c.
|
static |
Definition at line 94 of file tms9900_test.c.
|
static |
Definition at line 120 of file tms9900_test.c.
|
static |
Definition at line 102 of file tms9900_test.c.
|
static |
Definition at line 131 of file tms9900_test.c.
|
inlinestatic |
Definition at line 175 of file tms9900_test.c.
|
inlinestatic |
Definition at line 183 of file tms9900_test.c.
|
inlinestatic |
Definition at line 184 of file tms9900_test.c.
|
inlinestatic |
Definition at line 185 of file tms9900_test.c.
|
inlinestatic |
Definition at line 186 of file tms9900_test.c.
|
inlinestatic |
Definition at line 187 of file tms9900_test.c.
|
inlinestatic |
Definition at line 188 of file tms9900_test.c.
|
inlinestatic |
Definition at line 189 of file tms9900_test.c.
|
inlinestatic |
Definition at line 190 of file tms9900_test.c.
|
inlinestatic |
Definition at line 191 of file tms9900_test.c.
|
inlinestatic |
Definition at line 192 of file tms9900_test.c.
|
inlinestatic |
Definition at line 194 of file tms9900_test.c.
|
inlinestatic |
Definition at line 195 of file tms9900_test.c.
|
inlinestatic |
Definition at line 196 of file tms9900_test.c.
|
inlinestatic |
Definition at line 198 of file tms9900_test.c.
|
inlinestatic |
Definition at line 199 of file tms9900_test.c.
|
inlinestatic |
Definition at line 200 of file tms9900_test.c.
|
inlinestatic |
Definition at line 201 of file tms9900_test.c.
|
inlinestatic |
Definition at line 202 of file tms9900_test.c.
|
inlinestatic |
Definition at line 203 of file tms9900_test.c.
|
inlinestatic |
Definition at line 204 of file tms9900_test.c.
|
inlinestatic |
Definition at line 205 of file tms9900_test.c.
|
inlinestatic |
Definition at line 206 of file tms9900_test.c.
|
inlinestatic |
Definition at line 207 of file tms9900_test.c.
|
inlinestatic |
Definition at line 208 of file tms9900_test.c.
|
inlinestatic |
Definition at line 209 of file tms9900_test.c.
|
inlinestatic |
Definition at line 210 of file tms9900_test.c.
|
inlinestatic |
Definition at line 213 of file tms9900_test.c.
|
inlinestatic |
Definition at line 214 of file tms9900_test.c.
|
inlinestatic |
Definition at line 215 of file tms9900_test.c.
|
inlinestatic |
Definition at line 216 of file tms9900_test.c.
|
inlinestatic |
Definition at line 224 of file tms9900_test.c.
|
inlinestatic |
Definition at line 229 of file tms9900_test.c.
|
inlinestatic |
Definition at line 230 of file tms9900_test.c.
|
inlinestatic |
Definition at line 231 of file tms9900_test.c.
|
inlinestatic |
Definition at line 232 of file tms9900_test.c.
|
inlinestatic |
Definition at line 233 of file tms9900_test.c.
|
inlinestatic |
Definition at line 234 of file tms9900_test.c.
|
inlinestatic |
Definition at line 235 of file tms9900_test.c.
|
inlinestatic |
Definition at line 236 of file tms9900_test.c.
|
inlinestatic |
Definition at line 237 of file tms9900_test.c.
|
inlinestatic |
Definition at line 238 of file tms9900_test.c.
|
inlinestatic |
Definition at line 239 of file tms9900_test.c.
|
inlinestatic |
Definition at line 240 of file tms9900_test.c.
|
inlinestatic |
Definition at line 241 of file tms9900_test.c.
|
inlinestatic |
Definition at line 243 of file tms9900_test.c.
|
inlinestatic |
Definition at line 244 of file tms9900_test.c.
|
inlinestatic |
Definition at line 245 of file tms9900_test.c.
|
inlinestatic |
Definition at line 246 of file tms9900_test.c.
|
inlinestatic |
Definition at line 247 of file tms9900_test.c.
|
inlinestatic |
Definition at line 248 of file tms9900_test.c.
|
inlinestatic |
Definition at line 252 of file tms9900_test.c.
|
inlinestatic |
Definition at line 253 of file tms9900_test.c.
|
inlinestatic |
Definition at line 254 of file tms9900_test.c.
|
inlinestatic |
Definition at line 255 of file tms9900_test.c.
|
inlinestatic |
Definition at line 256 of file tms9900_test.c.
|
inlinestatic |
Definition at line 257 of file tms9900_test.c.
|
inlinestatic |
Definition at line 258 of file tms9900_test.c.
|
inlinestatic |
Definition at line 259 of file tms9900_test.c.
|
inlinestatic |
Definition at line 260 of file tms9900_test.c.
|
inlinestatic |
Definition at line 261 of file tms9900_test.c.
|
inlinestatic |
Definition at line 262 of file tms9900_test.c.
|
inlinestatic |
Definition at line 263 of file tms9900_test.c.
|
inlinestatic |
Definition at line 264 of file tms9900_test.c.
|
inlinestatic |
Definition at line 265 of file tms9900_test.c.
|
static |
Definition at line 271 of file tms9900_test.c.
|
static |
Definition at line 328 of file tms9900_test.c.
|
static |
Definition at line 470 of file tms9900_test.c.
|
static |
Definition at line 577 of file tms9900_test.c.
|
static |
Definition at line 623 of file tms9900_test.c.
|
static |
Definition at line 716 of file tms9900_test.c.
|
static |
Definition at line 777 of file tms9900_test.c.
|
static |
Definition at line 834 of file tms9900_test.c.
|
static |
Definition at line 864 of file tms9900_test.c.
|
static |
Definition at line 923 of file tms9900_test.c.
|
static |
Definition at line 950 of file tms9900_test.c.
|
static |
Definition at line 998 of file tms9900_test.c.
| int main | ( | void | ) |
Definition at line 1029 of file tms9900_test.c.
|
static |
Definition at line 118 of file tms9900_test.c.
|
static |
Definition at line 150 of file tms9900_test.c.