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

pico9918-core - TMS9900 CPU interpreter (portable C) More...

#include <stdbool.h>
#include <stdint.h>
+ Include dependency graph for tms9900.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Tms9900Cpu
 

Macros

#define TMS_ST_LGT   0x80 /* Logic greater-than */
 
#define TMS_ST_AGT   0x40 /* Arithmetic greater-than */
 
#define TMS_ST_EQ   0x20 /* Equal */
 
#define TMS_ST_C   0x10 /* Carry */
 
#define TMS_ST_OV   0x08 /* Overflow */
 
#define TMS_ST_P   0x04 /* Parity (odd) */
 

Functions

void tms9900_init (Tms9900Cpu *cpu, uint8_t *mem, uint8_t *regx38, uint16_t pc, uint16_t wp)
 
uint16_t run9900_c (Tms9900Cpu *cpu)
 
uint16_t run9900_budget_c (Tms9900Cpu *cpu, uint32_t budget, bool *outOfBudget)
 

Detailed Description

pico9918-core - TMS9900 CPU interpreter (portable C)

Copyright (c) 2026 Troy Schrapel

This code is licensed under the MIT license

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

This is a full reimplementation of JasonACT's RP2040 thumb assembly core found in thumb9900_m0.S / thumb9900_m33.S. It is not cycle-accurate and intentionally mirrors the status-flag encoding used in the assembly (bits: LG=0x80, AG=0x40, EQ=0x20, C=0x10, OV=0x08, P=0x04) so existing GPU glue can remain unchanged. run9900_c takes a Tms9900Cpu the caller has initialised with tms9900_init; gpu.c adapts it to the assembly core's four-argument run9900 signature. PICO9918_GPU_C_CORE selects between them.

Definition in file tms9900.h.

Macro Definition Documentation

◆ TMS_ST_LGT

#define TMS_ST_LGT   0x80 /* Logic greater-than */

Definition at line 31 of file tms9900.h.

◆ TMS_ST_AGT

#define TMS_ST_AGT   0x40 /* Arithmetic greater-than */

Definition at line 32 of file tms9900.h.

◆ TMS_ST_EQ

#define TMS_ST_EQ   0x20 /* Equal */

Definition at line 33 of file tms9900.h.

◆ TMS_ST_C

#define TMS_ST_C   0x10 /* Carry */

Definition at line 34 of file tms9900.h.

◆ TMS_ST_OV

#define TMS_ST_OV   0x08 /* Overflow */

Definition at line 35 of file tms9900.h.

◆ TMS_ST_P

#define TMS_ST_P   0x04 /* Parity (odd) */

Definition at line 36 of file tms9900.h.

Function Documentation

◆ tms9900_init()

void tms9900_init ( Tms9900Cpu cpu,
uint8_t *  mem,
uint8_t *  regx38,
uint16_t  pc,
uint16_t  wp 
)

Definition at line 1127 of file tms9900.c.

◆ run9900_c()

uint16_t run9900_c ( Tms9900Cpu cpu)

Definition at line 1140 of file tms9900.c.

◆ run9900_budget_c()

uint16_t run9900_budget_c ( Tms9900Cpu cpu,
uint32_t  budget,
bool *  outOfBudget 
)

Definition at line 1145 of file tms9900.c.