# Start here: the TMS34010 as this core will model it This page is for someone who has written a 6502, Z80 or 68000 interpreter and has never touched a graphics system processor. Read it before any other document here. Nothing in it is a substitute for TI's manual; where a statement is not in the manual it is marked. **Sources.** TI, *TMS34010 User's Guide*, **SPVU001A, August 1988** — (33.4 MB; HTTP 200 confirmed 2026-09-12 — note that bitsavers returns 403 to curl's default user agent, so send a browser one). Section 12 is the alphabetical instruction set, **section 13 is the instruction timings** in machine states, **appendix A is the TMS34010 data sheet reproduced in full**, appendix C is "Software Compatibility with Future GSPs". For grep-able work use archive.org's OCR text layer, (1.17 MB), rather than the PDF. The TMS34020 equivalent is (doc 2564006-9721, August 1990). **A correction to this project's commission**: there is **no "TMS340 Family Data Manual"** on bitsavers under that or any name — the complete `components/ti/TMS340xx/` directory, `_dataBooks/` and `_dataSheets/` were enumerated on 2026-09-12 and it does not exist. Neither does a standalone TMS34010 data sheet PDF there; the data sheet (SPVS002A/C) survives only in third-party GitHub archives, and appendix A of the User's Guide is the same content. Cite the User's Guide. All TI documents remain TI's copyright. They are cited here, never redistributed, and no PDF is committed to this repository. Where the manual is ambiguous or silent, MAME 0.285's `src/devices/cpu/tms34010/` (BSD-3-Clause, copyright Alex Pasadyn and Zsolt Vasvari, parts by Aaron Giles; `34010gfx.hxx` adds Aaron Giles as a holder, `34010dsm.cpp` is Zsolt Vasvari's alone). **The BSD-3-Clause licence permits transcribing behaviour from that source into this project provided the copyright notice and the three conditions are reproduced;** any file in this repository that derives from MAME must carry that attribution. Facts cited below as `tms34010.cpp:NNN` were read at GitHub tag `mame0285`. Statements resting on MAME alone, with no manual confirmation in hand, are tagged `[unverified]`. --- ## 1. Memory is bit-addressed A TMS34010 address is 32 bits wide and selects **one bit**. The address space is 2^32 bits = 512 MB. Memory is physically organised as 16-bit words, little-endian, so: ```text byte address = bit address >> 3 16-bit word index = bit address >> 4 bit offset in word = bit address & 0x0F ``` Everything follows from that. The PC advances by 0x10 per instruction word. A 32-bit immediate costs 0x20. The stack pointer moves by 0x20 per 32-bit push. A pointer held in a register is a bit address. An address in a disassembly listing is a bit address. (MAME encodes this natively: the device's address space is declared with an address shift of +3, so MAME divides by 8 on the way to the byte-oriented memory system, `tms34010.cpp:63`. There are no `TOBYTE`/`TOWORD` macros in MAME 0.285; they were removed in favour of the shift.) The practical consequence for a Python core is that the host's memory object should expose **word** access, not bit access, and the core should do the bit arithmetic. Reading a 9-bit field at bit address 0x1234567 means reading the words containing bits 0x1234567..0x123456F, shifting and masking. A host that offered `read_bit`/`write_bit` would be correct and unusably slow. ## 2. Fields: the fundamental memory operand There is no "byte load" and no "word load" in the ordinary sense. There is a **field**: a run of 1 to 32 consecutive bits starting at any bit address. Two field descriptors are live at once, numbered 0 and 1, and every field-touching instruction names one of them in its opcode (`MOVE ...,0` and `MOVE ...,1` in TI's syntax). Each descriptor has: | Part | Where | Meaning | | --- | --- | --- | | **FS0** | ST bits 4-0 | Field 0 size in bits, 1-31, **and 32 encoded as 0** | | **FE0** | ST bit 5 | Field 0 extension: 1 = sign-extend on read, 0 = zero-extend | | **FS1** | ST bits 10-6 | Field 1 size, same encoding | | **FE1** | ST bit 11 | Field 1 extension | *A field size of 32 is stored as 0.* A five-bit number cannot hold 32, and TI chose 0 rather than a sixth bit. This is the single most easily-missed rule in the architecture and it is visible in the third instruction Mortal Kombat executes: `SETF 20h,1,1` leaves ST = 0x830, whose FS1 bits read zero ([mame-oracle.md](mame-oracle.md#sample-output)). A core that stores the field size verbatim will silently perform a zero-bit access. `SETF` writes a descriptor. `GETST`/`PUTST`/`PUSHST`/`POPST` move the whole ST. A field written to memory is truncated to the field size; a field read from memory is extended to 32 bits per FE. **Alignment and its cost.** Nothing requires a field to be aligned. A 32-bit field at bit address 0x1234561 spans three 16-bit words; a 16-bit field at an odd bit offset spans two. On real hardware this costs extra memory cycles — TI's tables quote instruction times "plus wait states" and the User's Guide's timing chapter treats an unaligned field access as an extra local-memory cycle ([timing.md](timing.md)). The architecture does not fault on it. A core must therefore implement the general case first and may special-case aligned 8/16/32-bit fields later purely for speed; the general case is a loop over the words the field touches. MAME implements this as 32 write functions (`wfield_01` through `wfield_32`, one per width) and 63 read functions (`rfield_z_NN` and `rfield_s_NN`), dispatched through tables (`34010fld.hxx`, 675 lines, and the tables at `:186` and `:661`). That is a reasonable shape to copy: the field width is nearly always constant across a loop, so hoisting the dispatch out of the inner loop is the whole optimisation. ## 3. The register file Two banks of fifteen 32-bit registers, plus one stack pointer shared by both, plus PC and ST. | | | | --- | --- | | **A0-A14** | General purpose, bank A | | **B0-B14** | General purpose, bank B — *and* the graphics parameter block | | **SP** | The stack pointer. It is simultaneously A15 and B15; there is only one of it. Grows **down**. | | **PC** | 32-bit bit address, always a multiple of 0x10 in practice | | **ST** | 32-bit status register | Which bank an instruction uses is **opcode bit 4**, not a mode bit. So `ADD A3,A5` and `ADD B3,B5` are two different opcodes and you cannot add an A register to a B register in one instruction. MAME stores the file as a single 31-entry array with `BREG(i) = m_regs[30 - i]`, so B0 is at index 30 and A15 and B15 both land on index 15 — which is exactly why SP is shared (`tms34010.cpp:154`). MAME's debugger exposes `A0`-`A14` and `B0`-`B14` and a separate `SP`; it deliberately does not expose A15 or B15 (`tms34010.cpp:722-737`). ### The B file's hardware roles During a graphics instruction the B registers are read as a parameter block. They are ordinary registers the rest of the time; nothing enforces these meanings except the instruction that reads them. | Reg | Name | Meaning | | --- | --- | --- | | B0 | SADDR | Source address (linear bit address, or XY) | | B1 | SPTCH | Source pitch — bits between the start of one source row and the next | | B2 | DADDR | Destination address | | B3 | DPTCH | Destination pitch | | B4 | OFFSET | The linear bit address of XY origin (0,0) | | B5 | WSTART | Window start, as XY | | B6 | WEND | Window end, as XY | | B7 | DYDX | The transfer's height and width: Y in the high half, X in the low half | | B8 | COLOR0 | Background colour, replicated to all 32 bits | | B9 | COLOR1 | Foreground colour, replicated to all 32 bits | | B10-B14 | — | Free, except that `LINE` uses B10-B14 as its Bresenham state | This is why the blitter cannot live on the host side of the interface: its arguments are *registers*, and the instructions that set them are ordinary `MOVI`s a core must already execute. ### ST, the status register | Bits | Name | Meaning | | --- | --- | --- | | 31 | N | Negative | | 30 | C | Carry | | 29 | Z | Zero | | 28 | V | Overflow | | 25 | P | PIXBLT in progress (the interrupted-blit resume flag) | | 21 | IE | Interrupt enable (master) | | 11 | FE1 | Field 1 extension | | 10-6 | FS1 | Field 1 size | | 5 | FE0 | Field 0 extension | | 4-0 | FS0 | Field 0 size | Bit positions from `tms34010.cpp:123-132`; MAME's `GENFLAGS` string renders them in exactly that order (`:1753-1772`). All other bits are reserved. **Reset sets ST to 0x00000010** — FS0 = 16, zero-extended, interrupts disabled — and so does entry to any interrupt (`tms34010.cpp:223-226`), which means *an interrupt handler must set up its own field descriptors before it can load anything*. Verified in the trace: the first `error.log` line of a Mortal Kombat run shows `ST=00000010`. ## 4. XY versus linear addressing Graphics instructions accept addresses in two forms, and the opcode says which. - **Linear**: an ordinary 32-bit bit address. - **XY**: a packed pair, Y in bits 31-16 and X in bits 15-0, both signed. The conversion, which `CVXYL` performs and which every XY-mode graphics instruction performs internally, is: ```text linear = OFFSET + (Y * pitch) + (X << pixel_size_log2) ``` `pitch` must be a power of two for the hardware to do this with a shift, and that is what the **conversion registers** are for: CONVSP and CONVDP hold the number of leading zeros of the source and destination pitch, which is the shift count. MAME decodes them as `convsp = 1 << (~value & 0x1f)` (`tms34010.cpp:1335-1341`), i.e. the register holds the one's complement of log2(pitch). PSIZE holds the pixel size in bits (1, 2, 4, 8, 16; the TMS34020 adds 32) and the core keeps log2 of it as a shift. Non-power-of-two pitches are legal but cost the CPU: TI documents `CVXYL`'s timing as pitch-dependent, and MAME admits it does not model that (`34010ops.hxx:183`: "TODO: Handle cycles properly, currently we assume power of two"). The TMS34020 handles non-power-of-two pitches in hardware by summing two shifted terms (`tms34010.cpp:1493-1531`). The window registers WSTART and WEND are **always** XY, never linear. ## 5. The general instruction set Every instruction is one 16-bit word, optionally followed by one or two words of immediate or displacement. The top bits select the operation; the bottom bits carry registers. The most common format: ```text 15 9 8 5 4 3 0 +--------------------+----------+---+---------+ | opcode | Rs | R | Rd | +--------------------+----------+---+---------+ ``` `R` is the **register file**: 0 = A, 1 = B. `Rs` and `Rd` are register numbers 0-15 (15 being SP). MAME's dispatch is a flat 4096-entry table indexed by `opcode >> 4` — the low nibble never selects an instruction, only a destination register (`tms34010.h:989`, `tms34010.cpp:904-912`). For an `Rs`-bearing instruction the same handler is repeated across 32 consecutive table slots. That table shape is worth copying: a Python core can dispatch on `op >> 4` into a 4096-entry list with no decode tree at all. There are about **170 distinct instructions** on the TMS34010 (273 handler symbols in MAME's table, collapsing to ~170 once the mechanical `_a`/`_b` file pairs are merged). ### The families | Family | Instructions | | --- | --- | | Move, register | `MOVE Rs,Rd`, `MOVX`, `MOVY`, `MOVK` (5-bit constant), `MOVI` (16- or 32-bit immediate), `MOVB` | | Move, memory | `MOVE *Rs,Rd,F` and its pre-decrement `*-Rs`, post-increment `*Rs+`, displacement `*Rs(disp)` and absolute `@addr` forms, in both directions and memory-to-memory; `MOVB` is the byte (8-bit, always) form | | Multiple move | `MMTM Rp,` and `MMFM Rp,` — push/pop a register list through any register. The workhorse prologue/epilogue; they are 4 % of a real trace | | Arithmetic | `ADD`, `ADDC`, `ADDI`, `ADDK`, `INC`, `SUB`, `SUBB`, `SUBI`, `SUBK`, `DEC`, `NEG`, `NEGB`, `ABS`, `MPYS`, `MPYU`, `DIVS`, `DIVU`, `MODS`, `MODU`, `CMP`, `CMPI`, `LMO` (leftmost one) | | Logic and bits | `AND`, `ANDI`, `ANDN`, `ANDNI`, `OR`, `ORI`, `XOR`, `XORI`, `NOT`, `CLR`, `SETC`, `CLRC`, `BTST`, `RL` | | Shifts | `SLA`, `SLL`, `SRA`, `SRL`, each with a constant or a register count | | Field control | `SETF FS,FE,F`, `SEXT Rd,F`, `ZEXT Rd,F` | | Jumps | `JAcc addr` (absolute conditional), `JRcc disp` (PC-relative, 8-bit or 16-bit displacement), `JUMP Rs` (register indirect), `DSJ`/`DSJS`/`DSJEQ`/`DSJNE` (decrement and jump, the loop primitives) | | Calls | `CALLA addr`, `CALLR disp`, `CALL Rs`, `RETS [n]` (with an optional stack adjustment), `RETI`, `TRAP n` | | Control | `EINT`, `DINT`, `NOP`, `EMU`, `REV`, `PUSHST`, `POPST`, `GETST`, `PUTST`, `GETPC`, `EXGPC`, `ADDXY`, `SUBXY`, `CMPXY`, `CPW` (compare point to window) | The condition codes on `JAcc`/`JRcc` are the usual sixteen: `UC` (always), `P`, `LS`, `HI`, `LT`, `GE`, `LE`, `GT`, `C`/`NC`, `EQ`/`NE` (Z), `V`/`NV`, `N`/`NN`, plus `Z`/`NZ` aliases. `JRUC` is an unconditional PC-relative jump and `JR` in a disassembly means the same thing. `ADDXY`, `SUBXY` and `CMPXY` operate on the packed XY form: they add the halves independently and set the flags from both halves. They are how you walk a coordinate without unpacking it. ## 6. The graphics instructions These are the reason the chip exists. They are instructions in the register file's sense — they read B0-B9, they use the same field machinery — and they are a separate section here because a core should build them second. | Instruction | What it does | | --- | --- | | `PIXT` | Move **one pixel**. Register-to-memory, memory-to-register or memory-to-memory, with linear or XY addressing on each side. The smallest unit that carries transparency, plane masking and pixel processing. | | `PIXBLT B,L` / `B,XY` / `L,L` / `L,XY` / `XY,L` / `XY,XY` | Move a rectangle of DYDX pixels from SADDR to DADDR. `B` means the source is a **binary** (one bit per pixel) bitmap expanded to COLOR0/COLOR1 — this is how fonts and masks are drawn. | | `FILL L` / `FILL XY` | Fill a DYDX rectangle at DADDR with COLOR1. | | `LINE 0` / `LINE 1` | Bresenham line from the state in B10-B14, one pixel per iteration. The `0`/`1` selects whether the final pixel is drawn. | | `DRAV Rs,Rd` | Draw-and-advance: plot one pixel at Rd (XY) and add Rs to it. The building block the manual suggests for polygons. | Four hardware behaviours are applied on every pixel these instructions touch, and they are the real content of the work: 1. **Pixel processing (PPOP)**, CONTROL bits 14-10: one of sixteen operations combining the source pixel with the destination pixel — replace, AND, OR, XOR, add, add-with-saturate, subtract, subtract-with-saturate, max, min, and their complements. MAME implements 22 distinct functions over a 32-entry table, with indices 22-31 aliasing back to plain replace (`34010gfx.hxx:248-277`). 2. **Transparency (T)**, CONTROL bit 5: when set, a source pixel whose value is zero **after** pixel processing is not written. 3. **Window checking (W)**, CONTROL bits 7-6: 0 = no windowing, 1 = interrupt on a write *inside* the window and do not write, 2 = write only inside the window with no interrupt, 3 = write only inside the window and set the window-violation interrupt if any pixel was clipped. WSTART and WEND bound the window, in XY. Modes 1 and 3 feed the WV interrupt. 4. **Plane masking (PMASK)**: a per-bit-plane write mask. A 1 bit in PMASK protects that plane from being written. **MAME does not implement this at all** — it logs "Plane masking not supported" and ignores the register (`tms34010.cpp:1277`), and sixteen `/* TODO: plane masking */` markers sit in its pixel primitives. A core that implements PMASK from the manual will *diverge from MAME* on any game that uses it, and that divergence is MAME's, not the core's. The combinatorial shape is worth seeing before designing for it: MAME generates its blitters as 4 transparency/op combinations × 5 pixel depths × 4 transfer shapes = **80 specialised functions**, reached through four 320-entry dispatch tables (index = `transparency | rop << 1 | psize << 6`). A Python core should do the opposite — one generic loop with the pixel operation as a callable — and accept being slow, because the alternative is 80 near-identical Python functions nobody can read. That is a deliberate, stated trade: readability over speed, the same trade z80-python made. ## 7. The I/O register file at 0xC0000000 Thirty-two 16-bit registers, one every 0x10 bit addresses, from 0xC0000000 to 0xC00001F0. They are read and written with ordinary `MOVE` instructions — there is no separate I/O space. (MAME installs them as an internal map over `0xc0000000-0xc00001ff`, which is 0x200 *bits* = 32 words: `tms34010.cpp:30-38`.) | Addr | Name | What it is | Core or host? | | --- | --- | --- | --- | | C0000000 | HESYNC | Horizontal end sync | **host** | | C0000010 | HEBLNK | Horizontal end blank | **host** | | C0000020 | HSBLNK | Horizontal start blank | **host** | | C0000030 | HTOTAL | Horizontal total | **host** | | C0000040 | VESYNC | Vertical end sync | **host** | | C0000050 | VEBLNK | Vertical end blank | **host** | | C0000060 | VSBLNK | Vertical start blank | **host** | | C0000070 | VTOTAL | Vertical total | **host** | | C0000080 | DPYCTL | Display control: enable, interlace, master/slave, **SRT mode (bit 11)**, DUDATE | **host**, but the core must honour bit 11 | | C0000090 | DPYSTRT | Display start address | **host** | | C00000A0 | DPYINT | Scanline at which the display interrupt fires | **host** | | C00000B0 | CONTROL | **T (bit 5), W (bits 7-6), PBH, PBV, PPOP (bits 14-10)** | **core** | | C00000C0 | HSTDATA | Host interface data | **host** | | C00000D0 | HSTADRL | Host address low | **host** | | C00000E0 | HSTADRH | Host address high | **host** | | C00000F0 | HSTCTLL | Host control low: MSGIN/MSGOUT, INTIN/INTOUT | **host**, core reads INTIN for the HI interrupt | | C0000100 | HSTCTLH | Host control high: **HLT (bit 15), NMI (bit 8), NMIM (bit 9)**, host increment modes | **split**: HLT and NMI are the core's, the rest the host's | | C0000110 | INTENB | Interrupt enable mask | **core** | | C0000120 | INTPEND | Interrupt pending | **core** | | C0000130 | CONVSP | Source pitch conversion | **core** | | C0000140 | CONVDP | Destination pitch conversion | **core** | | C0000150 | PSIZE | Pixel size in bits | **core** | | C0000160 | PMASK | Plane mask | **core** | | C0000170-C00001A0 | — | Reserved (four registers) | see below | | C00001B0 | DPYTAP | Display tap point | **host** | | C00001C0 | HCOUNT | Horizontal counter | **host** (read-only in effect) | | C00001D0 | VCOUNT | Vertical counter | **host** | | C00001E0 | DPYADR | Display address | **host** | | C00001F0 | REFCNT | DRAM refresh counter | **host** | Register order and MAME's behaviour per register from `tms34010.h:61-96` and `tms34010.cpp:1231-1244`. In MAME, HESYNC, VESYNC, HSTDATA, PMASK and the four reserved slots are **inert**: written values are stored and read back and nothing else happens (`tms34010.cpp:1584`). HCOUNT and REFCNT are **synthesized on read** from the screen position and from a cycle counter respectively (`:1556-1571`). ### What TI says about the reserved bits: appendix C The User's Guide's appendix C, "Software Compatibility with Future GSPs", is TI stating which behaviour is contractual and which is not. It is the best answer available to "what do the reserved bits do", and it is worth quoting in substance because it also explains several oddities in real code: - **Instruction execution times may differ between GSPs.** Do not write timing loops; use DPYINT or the external interrupts instead. (This is TI telling you, in 1988, that cycle counts are not a stable interface — which is a reason a core need not chase them; see [timing.md](timing.md).) - **Reserved status-register and I/O-register bits must be saved and restored blind** across a context switch. Never write a literal into them. - **Instruction-cache characteristics may differ** between GSP versions — cache size, loading order, bytes per miss, time per fetch — and code must not depend on any of them. (There *is* an instruction cache. A core that does not model it is following TI's own advice.) - **COLOR0 and COLOR1 are 16-bit on the TMS34010** and extend to 32 bits on later parts. - **PMASK is 16-bit at 0xC0000160 but should be treated as 32 bits, including 0xC0000170** — which explains one of the four "reserved" registers. - **Load B13 with all ones at initialisation**, because future GSPs use it as a pattern register. - If an instruction uses CONVSP then SPTCH must agree with it, and the 11 most significant bits of CONVSP must be zero. ### What belongs in the core and what belongs in the host The recommendation for this project, and the reasoning, because a later session will have to defend it: **The core owns**: the bit-field access machinery; the register file and its banking; PC, SP, ST; the whole instruction set including PIXT, PIXBLT, FILL, LINE and DRAV with window clipping, transparency, plane masking and pixel processing; the XY↔linear conversion; interrupt acceptance and vector fetch; and the I/O registers **CONTROL, PSIZE, PMASK, CONVSP, CONVDP, INTENB, INTPEND**, plus the HLT and NMI bits of HSTCTLH. *Why.* Every one of those changes what an instruction computes. CONTROL decides what `PIXT` writes; PSIZE decides how wide a pixel is; CONVDP decides where an XY address lands. Putting them on the host side means the host has to be consulted in the middle of an instruction, which is the one thing a clean host interface should never require. And the graphics instructions go through the same field path as `MOVE`: splitting them out means writing the bit-addressing machinery twice, on both sides of the boundary, and keeping the two in agreement forever. **The host owns**: the video timing generator (HESYNC through VTOTAL, DPYCTL, DPYSTRT, DPYTAP, DPYADR, HCOUNT, VCOUNT), DRAM refresh (REFCNT), the VRAM shift-register transfer, and the host interface (HSTDATA, HSTADRL/H, and the messaging and interrupt bits of HSTCTLL). *Why.* None of them changes what an instruction computes. They are a CRTC and a mailbox. The video registers' only effect on the CPU is *when* the display interrupt fires, which is a lifecycle call the host makes anyway. And the host interface is genuinely board-specific: on every Midway board the TMS34010 is the main CPU and nothing drives its host port, while on Atari's Hard Drivin' a 68010 does, and only the host knows which. **The boundary, concretely.** The host supplies `read_word(word_index)` and `write_word(word_index, value)` over its own memory, and `read_io(reg)` / `write_io(reg)` for the host-owned I/O registers. The core calls into the host for exactly three other things: a display interrupt (`set_display_interrupt()`), a host interrupt (`set_host_interrupt()`), and a shift-register transfer callback, which the core invokes when DPYCTL bit 11 is set and a pixel access occurs. That last one is not hypothetical — Mortal Kombat's code does exactly this, and the sequence is quoted in [mame-oracle.md](mame-oracle.md#sample-output). Two things deliberately **not** in the core: cycle-accurate refresh, and the interruptibility of a long PIXBLT. The second is discussed in [timing.md](timing.md); the short version is that hardware can interrupt a blit mid-transfer and resume it from the P flag in ST, and a first core should execute a blit atomically, set P correctly, and say so. ## 8. Interrupts Seven vectors, each a 32-bit bit address, in the top of the address space. Vector addresses from `tms34010.cpp:615-702` and `34010ops.hxx:1905`, which match the User's Guide's vector table. | Source | Vector (bit address) | Maskable by | Notes | | --- | --- | --- | --- | | RESET | 0xFFFFFFE0 | — | | | NMI | 0xFFFFFEE0 | nothing | Triggered by HSTCTLH bit 8; bit 9 (NMIM) suppresses the PC/ST push | | HI (host) | 0xFFFFFEC0 | INTENB bit 9, ST.IE | | | DI (display) | 0xFFFFFEA0 | INTENB bit 10, ST.IE | Fires when VCOUNT reaches DPYINT | | WV (window violation) | 0xFFFFFE80 | INTENB bit 11, ST.IE | Set by a clipped graphics write | | INT1 | 0xFFFFFFC0 | INTENB bit 1, ST.IE | External pin, level-sensitive | | INT2 | 0xFFFFFFA0 | INTENB bit 2, ST.IE | External pin, level-sensitive | | TRAP *n* | 0xFFFFFFE0 − (n << 5) | — | `TRAP 30` is also the illegal-opcode vector, 0xFFFFFC20 | INTPEND and INTENB share bit positions: INT1 = 0x0002, INT2 = 0x0004, HI = 0x0200, DI = 0x0400, WV = 0x0800 (`tms34010.h:99-103`). NMI is not in INTPEND; it lives in HSTCTLH. **Priority**, as MAME orders it: NMI first and unconditionally, then HI > DI > WV > INT1 > INT2, all gated on `INTPEND & INTENB` and on ST's IE bit (`tms34010.cpp:651-688`). **Entry sequence**: push PC, push ST, set ST to 0x00000010 (which clears IE — interrupts are disabled on entry — and resets the field descriptors to 16-bit zero-extended), fetch the 32-bit vector, jump. `RETI` pops ST then PC. A handler that wants 32-bit fields must `SETF` them itself. **INTPEND is mostly read-only**: X1P, X2P and HIP cannot be written at all, and WVP and DIP accept only zeros, i.e. they can be cleared but not set by software (`tms34010.cpp:1345-1353`). A core must enforce that or software that clears an interrupt by writing INTPEND will behave differently. **A halted CPU takes no interrupts at all.** HSTCTLH bit 15 halts the processor and MAME's comment on the path is emphatic (`tms34010.cpp:862-868`). ## 9. Reset - PC ← the 32-bit value at bit address 0xFFFFFFE0, masked to a multiple of 0x10. - ST ← 0x00000010. Field 0 is 16 bits zero-extended, field 1 is 32 bits (encoded 0) zero-extended, IE clear. - Every register including SP is zero in MAME's model; the User's Guide says the general registers are *undefined* after reset, so a core may choose either and must say which. `[unverified]` that hardware zeroes them — MAME does, real code always initialises SP first anyway (Mortal Kombat's fourth instruction is `MOVI 10FFFF0h,SP`). - The I/O registers come up with the display disabled. What a board does next is the board's business. - The HLT bit of HSTCTLH can hold the processor in reset; MAME's Midway drivers all call `set_halt_on_reset(false)`. ## 10. The TMS34020, in one section The TMS34020 is a superset, not a different architecture. A core written for the TMS34010 can grow into it. The differences that matter: - **32-bit data bus** rather than 16, so a long immediate is one access rather than two (`tms34010.cpp:63`). - **64 I/O registers over a 0x400-bit window**, in a *different order* — VESYNC and HESYNC are swapped relative to the 34010, and every subsequent index shifts. PMASK becomes PMASKL/PMASKH; DPYSTRT/DPYADR/ DPYTAP are replaced by DPYSTL/DPYSTH/DPYNXL/DPYNXH/DINCL/DINCH; CONVMP, CONTROL2 and CONFIG are new (`tms34010.h:180-251`). - **PSIZE accepts 32** (`tms34010.cpp:1421`). - **Non-power-of-two pitches in hardware**, via two-term conversion registers (`:1493-1531`). - **New instructions**: ADDXYI, BLMOVE, CEXEC, CLIP, CMOVxx, CVDXYL, CVMXYL, CVSXYL, FLINE, FPIXEQ/FPIXNE, LINIT, PFILL, RETM, RMO, RPIX, SETCDP/SETCMP/SETCSP, SWAPF, TFILL, TRAPL, VBLT, VFILL, VLCOL, plus the TMS34082 floating-point coprocessor interface. - **A big-endian mode**, which MAME does not implement at all (`tms34010.cpp:10-11`). - **A different clock divider**: MAME divides the input clock by 4 for the 34020 and by 8 for the 34010 (`tms34010.h:970-971`, `:1010-1011`). **MAME's TMS34020 is not a good oracle.** Of the 53 TMS34020-only opcode bodies in `34010ops.hxx`, **39 are `logerror` stubs that do nothing** — CEXEC, all the CMOVxx forms, FLINE, FPIXEQ, FPIXNE, GETPS, IDLE, LINIT, PFILL, `PIXBLT L,M,L`, RETM, SETCMP, SETCSP, SWAPF, TFILL, TRAPL, VBLT, VFILL, VLCOL and the rest. Only ADDXYI, BLMOVE (partially), CLIP, `CMP K`, CVDXYL, RMO, RPIX and SETCDP are actually implemented. So a TMS34020 milestone has *no* emulator-derived oracle worth the name for its new instructions, only the manual. ## Suggested reading order 1. This page. 2. [mame-oracle.md](mame-oracle.md) — the bit-address verification and a real trace make section 1 concrete. 3. [validation.md](validation.md) — what can and cannot be proved. 4. [timing.md](timing.md) and [undocumented-behavior.md](undocumented-behavior.md). 5. [handoff-brief.md](handoff-brief.md).