C = (() => {
const HORIZ_START = 16;
const HORIZ_BLANK = (9 + HORIZ_START)
const HORIZ_DISPLAY = 40;
const HORIZ_TOTAL = (HORIZ_BLANK + HORIZ_DISPLAY)
const CELL_WIDTH = 14;
const VERT_NTSC_START = 38;
const VERT_DISPLAY = 192;
const NTSC_FSC = 315 / 88 * 1e6;
const NTSC_4FSC = 4 * NTSC_FSC;
const NTSC_HLENGTH = (52 + 8 / 9) * 1e-6;
const NTSC_HHALF = (35 + 2 / 3) * 1e-6;
const NTSC_HSTART = NTSC_HHALF - NTSC_HLENGTH / 2;
const NTSC_VLENGTH = 240;
const NTSC_VSTART = 19;
const ntscClockFrequency = NTSC_4FSC * HORIZ_TOTAL / 912;
const ntscVisibleRect = {x: ntscClockFrequency * NTSC_HSTART, y: NTSC_VSTART,
width: ntscClockFrequency * NTSC_HLENGTH, height: NTSC_VLENGTH};
const ntscDisplayRect = {x: HORIZ_START, y: VERT_NTSC_START,
width: HORIZ_DISPLAY, height: VERT_DISPLAY};
const vertStart = ntscDisplayRect.y;
const horizStart = Math.floor(ntscDisplayRect.x);
const imageSize = {width: Math.floor(CELL_WIDTH * ntscVisibleRect.width),
height: Math.floor(ntscVisibleRect.height)};
const imageLeft = Math.floor((horizStart - ntscVisibleRect.x) * CELL_WIDTH);
const colorBurst = 2 * Math.PI * (-33 / 360 + (imageLeft % 4) / 4);
const topLeft = {x: imageLeft, y: vertStart - ntscVisibleRect.y};
const topLeft80Col = {x: imageLeft - CELL_WIDTH / 2, y: vertStart - ntscVisibleRect.y};
return {
imageSize,
colorBurst,
topLeft,
NTSC_FSC,
NTSC_4FSC,
}
})()