|
pico9918-core 1.3.0
TMS9918A / F18A video display processor emulation in C99
|
pico9918-core - TMS9900 CPU interpreter (portable C) More...
Include dependency graph for tms9900.c:Go to the source code of this file.
Data Structures | |
| struct | Operand |
Macros | |
| #define | GPU_WINDOW_READS 0x05FFu |
| #define | GPU_WINDOW_WRITES 0x097Fu |
| #define | watch_write(cpu, addr) ((void)0) |
Functions | |
| static void | set_flags_word (Tms9900Cpu *cpu, uint16_t v) |
| static void | set_flags_byte (Tms9900Cpu *cpu, uint8_t v) |
| static uint32_t | gpu_addr (uint16_t a) |
| static uint8_t | rd8 (Tms9900Cpu *cpu, uint16_t a) |
| static void | wr8 (Tms9900Cpu *cpu, uint16_t a, uint8_t v) |
| static uint16_t | rd16 (Tms9900Cpu *cpu, uint16_t a) |
| static void | wr16 (Tms9900Cpu *cpu, uint16_t a, uint16_t v) |
| static uint32_t | wp_addr (Tms9900Cpu *cpu, uint8_t r) |
| static uint16_t | get_reg (Tms9900Cpu *cpu, uint8_t r) |
| static void | set_reg (Tms9900Cpu *cpu, uint8_t r, uint16_t v) |
| static uint16_t | fetchw (Tms9900Cpu *cpu) |
| static Operand | decode_operand (Tms9900Cpu *cpu, uint8_t field, uint8_t is_byte) |
| static void | store_operand (Tms9900Cpu *cpu, const Operand *o, uint16_t v) |
| static uint16_t | add16 (Tms9900Cpu *cpu, uint16_t a, uint16_t b) |
| static uint16_t | sub16 (Tms9900Cpu *cpu, uint16_t a, uint16_t b) |
| static uint8_t | add8 (Tms9900Cpu *cpu, uint8_t a, uint8_t b) |
| static uint8_t | sub8 (Tms9900Cpu *cpu, uint8_t a, uint8_t b) |
| static void | cmp16 (Tms9900Cpu *cpu, uint16_t first, uint16_t second) |
| static void | cmp8 (Tms9900Cpu *cpu, uint8_t src, uint8_t dst) |
| static uint16_t | slx16 (Tms9900Cpu *cpu, uint16_t v, uint8_t count) |
| static uint16_t | sra16 (Tms9900Cpu *cpu, uint16_t v, uint8_t count) |
| static uint16_t | srl16 (Tms9900Cpu *cpu, uint16_t v, uint8_t count) |
| static uint16_t | src16 (Tms9900Cpu *cpu, uint16_t v, uint8_t count) |
| static uint16_t | slc16 (Tms9900Cpu *cpu, uint16_t v, uint8_t count) |
| static uint16_t | src_through_c (Tms9900Cpu *cpu, uint16_t v, uint8_t count) |
| static void | handle_two_operand (Tms9900Cpu *cpu, uint16_t inst) |
| static void | handle_format9 (Tms9900Cpu *cpu, uint16_t inst) |
| static int | handle_branch_group (Tms9900Cpu *cpu, uint16_t inst) |
| static void | handle_shift_rotate (Tms9900Cpu *cpu, uint16_t inst) |
| static void | handle_f18a_stack (Tms9900Cpu *cpu, uint16_t inst) |
| static int | handle_immediate_system (Tms9900Cpu *cpu, uint16_t inst) |
| static void | handle_jump_single (Tms9900Cpu *cpu, uint16_t inst) |
| static void | handle_cru_single_bit (void) |
| 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) |
Variables | |
| static const uint8_t | parity_tbl [256] |
| static const uint16_t | gpu_window_base [16] |
| static const uint16_t | gpu_window_mask [16] |
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 (thumb9900_m0.S / thumb9900_m33.S) intended for non-ARM targets. It aims to be functionally identical where it matters to the GPU: the status flag layout matches the assembly core (LGT=0x80, AGT=0x40, EQ=0x20, C=0x10, OV=0x08, P=0x04). CRU (LDCR, STCR, SBO, SBZ, TB) and CKON/CKOF/LREX are no-ops in both cores.
Memory layout follows the existing GPU glue: a 64 KiB byte array that stores TMS9900 words in big-endian order. The workspace pointer (WP) is a byte address into that array and register access uses big-endian word loads/stores.
The interpreter stops when bit0 of the control byte at regx38 is cleared, or when an IDLE instruction is executed, returning the current PC just like the assembly core. Behavior of auto-increment and index modes matches the original core (increments are 1 for byte ops, 2 for word ops).
Definition in file tms9900.c.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
| 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 | ||
| ) |
|
static |
|
static |