Module machine

Module machine 

Source
Expand description

The machine table and the clock constants every module shares (machine.py).

One board, a table of rows: the PC Engine and the TurboGrafx-16 differ by a pin (the reference’s docs/start-here.md). Add-ons (SuperGrafx, CD) add rows or build on this board; they do not fork it.

Differences forced by Rust: time is i64 master clocks everywhere (the reference’s unbounded int; a line’s start may be negative with start_offset).

Structs§

Machine
One row of the machine table.

Constants§

ACTIVE_LINES
ADDRESS_MASK
CPU_CLOCKS_HIGH
[hw: pcetech 2.4] CPU clock is master/3 (high) or master/12 (low); power-up is low.
CPU_CLOCKS_LOW
FRAME_LINES_LONG
[hw: pcetech 7; doc: wiki] 263-line frame; the 262-line form follows VCE bit 2 (C3).
FRAME_LINES_SHORT
HARDWARE_BASE
The hardware page, bank $FF: physical $1FE000-$1FFFFF (pages 0x1FE0-0x1FFF).
HARDWARE_FIRST_PAGE
HSYNC_CLOCKS
[emu: Mednafen vce.cpp l.561 hblank_counter = hblank ? 237 : 1128] the VCE’s horizontal sync is 237 master clocks at the start of a line. Tier 5; the real width is not published (U19).
LINE_CLOCKS
[doc: wiki “Timing”; emu: Mednafen vce.cpp] a line is 1365 master clocks whatever the dot clock (C5: “roughly 342 dots” at 5 MHz is 1365 / 4 = 341.25).
MASTER_HZ
[hw: pcetech 2.4] 21.47727 MHz master clock (6 x NTSC colour burst).
PAGE_BITS
A page of the page table is 256 bytes over the 21-bit space: 8192 pages (docs/sockets.md).
PAGE_COUNT
PC_ENGINE
TIMER_TICK_CLOCKS
[hw: pcetech 2.2] the timer counts once per 1024 high-speed CPU cycles, whatever the CPU speed.
TOP_BLANK_LINES
[hw: pcetech 7] the frame layout: 14 top blank, 242 active, 4 bottom blank, 3 sync.
TURBOGRAFX_16
VSYNC_LINES
[emu: Mednafen vce.cpp vblank_counter = vblank ? 4095 : ...] the vertical sync is the last three lines of a frame (4095 = 3 x 1365). [hw: pcetech 7] “3 lines for the sync area”.

Functions§

py_floordiv
Python’s // on integers: the quotient rounded toward minus infinity.
round_ties_even
Python’s round() of a float: ties to even.