== 240p Test Suite: Menu ==

PLUGE
Gradient color bars
SMPTE color bars
Color bars on gray
Color bleed
Monoscope
Convergence
Gray ramp
Solid color screen
IRE
Sharpness
Chroma crosstalk
Overscan
Safe areas
CPU clock speed
----
Shadow sprite
Stopwatch
Timing and reflex test
Hill zone scroll test
Vertical scroll test
Grid scroll test
Full screen stripes
Backlight zone test
Input test
Sound test
Audio sync test
MDFourier
About
Credits
Exit 240p Test Suite

== About ==

The 240p Test Suite has
two goals:

1. Evaluate TV sets and
   video processors for ability
   to handle 240p signals.
2. Turn a game console into
   a test signal generator
   to help in calibrating the
   black, white, and color
   levels and geometry of
   a display.

The Nintendo Entertainment
System (NES) outputs 240
picture lines in a progressive
"double struck" mode. It does
not support interlaced video,
and its 52-color palette is
closer to HSV than RGB.
----
To operate each test,
use the Control Pad and
the A and Select Buttons.
Start: Show relevant help
B: Close activity

The test suite is also
available for several other
consoles. For more info, visit
http://junkerhq.net/240p

== PLUGE ==

The PLUGE (picture line-up
generation equipment) pattern
is used to adjust the TV's
"brightness" or black level.

The inner bars are a signal
level slightly lower than
standard black, which causes
some TVs to distort or even
lose sync. The outer bars
are the darkest mix of
colors the NES can show.

Adjust brightness until
the outer bars are clearly
visible and inner bars are not.
----
↓: Darken the entire screen
  by 25% with emphasis filter
A: Switch outer bars
  between gray and color
Select: Go to
  PLUGE Contrast

Emphasis and gray outer bars
may misbehave on 2C03 or
2C05 RGB PPU (Vs. System,
PlayChoice, Famicom Titler,
Sharp C-1).
----
The PLUGE Contrast
pattern fills the screen
with a shark pictogram.
Use it with various
palettes to check
contrast and brightness.

A: Switch palette among
  normal, dark, or light colors
Select: Go to PLUGE

== Gradient color bars ==

Use this pattern to
calibrate red, green, and
blue colors on a TV.

Use the TV's contrast
control to adjust the white
level such that four levels
each of red, green, and blue
and three levels of white
are visible, and the lightest
level of red, green, and blue
is distinct from white.

A: Hide or show grid

== SMPTE color bars ==

Use this approximation
of SMPTE EG 1-1990
to calibrate for rough
color levels.

A: Toggle bars' brightness
Select: Play 1 kHz tone

Use blue filters or some TVs'
blue-only mode to confirm
color balance. Because the
NES's composite encoder
does not attempt to produce
accurate RGB hues, these
colors will not be pure.

The mini-PLUGE at bottom
right causes some TVs
to distort or lose sync.

== Color bars on gray ==

This pattern shows color
bars on a gray background.
Ideally, it would be used
with color filters to adjust
color balance. As with
SMPTE bars, the NES
PPU's HSV color model
makes filters imperfect.

A: Toggle bars' brightness
Select: Play 1 kHz tone

Based on Digital Video
Essentials: HD Basics

== Color bleed ==

Use this pattern to diagnose
color bleed caused by
incorrect color resampling.

↑↓←→: Move the
  pattern by one pixel
Hold ↑↓←→: Move the
  pattern every frame
A: Rotate stripes
Select: Show or hide
  frame counter

Concept by Konsolkongen

== Monoscope ==

This pattern contains
elements to calibrate
multiple aspects of a CRT.
Read your TV's service
manual to learn how.

Convergence:
Use the center crosshair
to check static (center
of screen) convergence.
Use the patterns at the
sides to check dynamic
(edge) convergence.

Adjust convergence at low
brightness. An overly bright
pattern causes bloom that
masks convergence issues.

↑↓: Change brightness
----
Corners:
After setting center and
edge convergence, use
magnets to adjust corner
purity and geometry.

Size and aspect ratio:
After setting horizontal
size, use a tape measure to
adjust vertical size until
the red squares in the
pattern are perfect squares.

Linearity:
The squares in each corner
should get you started.
Confirm your adjustment
using the scroll tests.

Pattern by khmr33

== Convergence ==

Use these to adjust a
CRT's color convergence.

Fine grid
↑↓: Change grid pattern
  (lines, dots, crosses)
Select: Invert grays
A: Go to colors

Color transition boundaries
↑↓: Hide or show
  black borders
A: Go to fine grid

== Gray ramp ==

Use this pattern to
check color balance.
This gray ramp should
not have a colored tint.

Cheap color LCDs may
have different gamma
curves per component.

== Solid color screen ==

Some displays and scalers
have problems with sudden
changes between deep black
and white or bright colors.
Other displays may have
stuck or damaged pixels.
Some cables produce audio
buzzing on a white screen.

←→: Change color among
  white, black, red,
  green, or blue
A on black screen: Switch
  between black and below
  black (some TVs lose sync)
A on white screen:
  Hide or show custom color
↑↓←→: Change custom color
Select: Toggle windowbox to
  test brightness limiter

== IRE ==

This test shows a rectangle
centered on the screen and
displays its brightness as a
percentage of standard white.

Some TVs lose sync when
brightness becomes negative.
A good TV won't.

↑↓: Change brightness
A: Toggle emphasis

Percentage values measured
by lidnariq of NESdev BBS

== Sharpness ==

Set the sharpness of
your TV to a value that
shows clean black and
gray transitions without
white lines on the side.

Modern TVs' "sharpness"
control performs edge
enhancement, intended
for live action SDTV or
VHS sources.
Most TVs have zero as
no change and high as
enhancement. A few have
middle as no change,
high as enhancement,
and low as blurring.

A: Toggle brick wall

== HEALTH WARNING ==

This pattern flashes.
Do not use it if you
have a seizure disorder.

A: View pattern
B: Cancel

== Chroma crosstalk ==

This pattern shows
colored stripes arranged
to show crosstalk between
luma and chroma of the
composite video output.

The 2C02 PPU's output stage
takes shortcuts to save cost.
Because it doesn't filter
chroma before adding it to
luma, diagonal stripes and
checkerboard patterns often
produce crosstalk artifacts.

On an NTSC console,
"NTSC" fades in and out.
Through S-Video or RGB,
the stripes are indistinct.

== CPU clock speed ==

Some emulators and console
modifications can overclock
the CPU to reduce slowdown
in games. This test measures
the CPU's clock rate using
the length of a scanline as
a time base.

Though the NES has no
real-time clock, a program
can measure the clock rate
relative to the PPU's roughly
15.7 kHz horizontal retrace.
This frequency cannot be
changed without causing
the display to lose color
or even lose sync.
----
Then it uses NMI and sprite
0 timing to measure cycles
per frame and per scanline.
It guesses the hsync rate
based on whether the PPU
is making 262 or 312 lines:

  NTSC: 15745.80 Hz
  PAL:   15602.18 Hz

From this, it calculates speed.
It repeats the calculation
every few frames, so if
the CPU's speed changes
while the test runs, the
displayed value will update.

== Overscan ==

Use this pattern to check
how much of the picture
edge your TV hides.

Historically, CRT TVs
have been calibrated to
"overscan", or draw the
picture slightly past the
visible area, in case aging
capacitors cause the picture
to shrink over time. This
continues into the modern
era, as many productions
have unwanted information
near the edge.

↑↓←→: Choose an edge
A + ↑↓←→: Move edge
Select: Invert grays
----
Move each edge inward until
you see the white border,
then go back one pixel. Or
leave one border pixel visible
and subtract 1. The result
is the amount of overscan
in pixels in each direction.

Poor high-voltage regulation
in a CRT causes image size
to depend on brightness,
changing the border's width.
To test this, press Select
and repeat the above steps.
----
The NES picture is 256x240
pixels. The nominal 4:3 frame
on NTSC is 280x240, including
12 pixels of border at left
and right. The displayed
amounts do not include this
side border.

PAL NES border is always
black. It covers 2 pixels
of the left and right sides
and 1 on the top.

== Safe areas ==

TV broadcasting standards
define safe areas to ensure
a TV's overscan does not
cut off important information.
For example, broadcasters
try to keep text within the
center 80% of the screen's
width and height, called the
title safe area.

== Shadow sprite ==

This test draws a shadow
sprite on every other frame,
flickering at 30 or 25 Hz.
Many games use such a
flicker effect to show
transparency, such as
during mercy invincibility.

Some deinterlacers display
drop shadows correctly but
still interpret 240p as 480i.
The striped sprite should
make this easy to spot.
----
↑↓←→: Move sprite
A: Skip flicker frame
  or rotate stripes
A+↑: Change shadow type
  (flicker or stripes)
A+←→: Change background
Select: Change sprite shape

These shouldn't happen:
- Background loses detail
- Shadow disappears
- Thin horizontal stripes
  in flicker pattern

Portrait of Gus by
  darryl.revok
Hill zone by mikejmoffitt
  & Damian Yerrick

== Stopwatch ==

This stopwatch helps you
measure a TV's lag, detect
dropped frames, time a
workout, or just count how
long your spouse has been
on the phone.

A: Start or stop
Select when stopped: Reset
Select when running: Lap
↑: Change ruler at left
   (show, hide, or show
   during even frames)
↓: Hide or show
   inactive circles

The clock face below helps
determine the frame even
when the numbers above are
blurry.
----
Lag measurement

To measure lag, get a
camera and connect two
displays to one NES. One is
being tested, and the other
(the reference) should be a
CRT SDTV or a display with
known lag. For example,
connect a CRT to the RF out
and your scaler to AV out.

Then photograph both
screens at once. The picture
will show the difference in
image processing latency
between them. Some LCD TVs
exceed five frames.
----
Lag measurement

The ruler helps count
scanlines of lag. Use a
short exposure on your
camera and divide lines by
15.7 to get milliseconds.
To avoid errors caused
by rolling shutter, put
the TVs side by side.

When an NESRGB or Hi-Def
NES mod is in use, the
video out works differently:
white for sprites and black
for background (or vice
versa). The frame counter
and ruler are drawn as
sprites to remain visible.
----
Dropped frames

A scaler with a frame buffer
may drop frames because the
frame rate of the NTSC NES
and Super NES (60.10 Hz) is
faster than standard (59.94
Hz). The displayed time gains
a second every 10 minutes.

At 59.94 Hz, it drops one
frame in 345: one per 5.75
seconds or two per 11.5.
At 60.00 Hz, it drops one
frame in 607: one per 10.12
seconds or two per 20.24.

Hi-Def NES compensates
for this by slightly slowing
the CPU and PPU.

== Timing and reflex test ==

This helps quantify a
display's processing lag by
showing a changing pattern
on the screen, optionally
with audio.

Press A when the moving
and still reticles align
to display the offset in
frames from the actual
intersection and whether it
was early or late. After ten
non-early presses, their
average is shown.
----
↑↓: Choose a setting
←→: Change setting's value

Settings include the direction
of the moving reticle
(horizontal, vertical, or both),
whether to randomize timing
of movement, and whether to
beep when A is pressed or
beep and flash when the
reticles align.

== Hill zone scroll test ==

This shows a scrolling
background with several
parallax strips. Use it
to notice any drops in
frame rate.

↑↓: Change speed
←→: Change direction
A: Start or stop

Hill zone by mikejmoffitt
  & Damian Yerrick

== Vertical scroll test ==

This shows a scrolling
background. Use it to
measure cadence detection
in a deinterlacer.

↑↓: Change speed
←→: Change direction
A: Start or stop

Map by Artemio Urbina
Tiles by Damian Yerrick

== Grid scroll test ==

A grid scrolls vertically
or horizontally. Use it
to test linearity and how
well the display copes with
scrolling and frame rate.
Some scalers may produce a
still image at maximum speed.

↑↓: Change speed
A: Start or stop
A + ↑↓←→: Change direction

== Full screen stripes ==

You should see a pattern of
lines, each one pixel wide.

↑↓←→: Move the
  pattern by one pixel
Hold ↑↓←→: Move the
  pattern every frame
A: Rotate stripes
Select: Show or hide
  frame counter

While you hold Up, the lines
should flicker. If holding
Up makes a still image, your
scaler is treating the signal
as interlaced and dropping
or weaving frames.

== Backlight zone test ==

This test displays a small
moving square, showing
how a display treats small
bright areas.
Some LED-lit LCDs dim
dark areas to make blacks
deeper, which causes
problems with scenes such
as starfields and credits.
Some CRTs' phosphors
cause bright moving
objects to leave a trail.
----
↑↓←→: Move the square
A: Hide or show square
A+↑↓: Change width
  (1, 2, 4, or 8 pixels)
A+←→: Change speed
  low: 1 pixel per frame
  high: 1 width per frame
Select: Invert grays

To measure image decay
time, use a high-speed
camera to record the
screen while closing
this help page or
moving at high speed.

== Sound test: Frequency ==

8000 Hz
4000 Hz
2000 Hz
1000 Hz
500 Hz
250 Hz
125 Hz
62 Hz
31 Hz
1000 Hz (pulse)
Hiss noise
Buzz noise
Crowd (PCM)

== Sound test ==

Use this test to ensure
that the audio output
works and that audio and
video are synchronized.

A: Play a sound and
  flash the screen

The NES CPU has two audio
output pins. It produces two
pulse (square) waves on
one and triangle, noise, and
sample playback on the other.

Most options in the menu use
the triangle wave because it
is the purest built-in tone,
though it has a prominent
overtone 5 octaves up.
----
The CPU generates noise with
a polynomial counter that
can operate in two modes:
hiss (32767 steps)
or buzz (93 steps).
On the earliest revisions
of the CPU, hiss and buzz
sound the same.

Some people modify NES
consoles to make fake stereo,
with pulse on the left and
everything else on the right.
----
The PCM (sampled sound)
output is tested with a
bytebeat composition,
defined by evaluating a
bitwise formula 8000 times
a second and using it as
sample values.

// "Crowd" by Kragen
// License: CC BY
main(t) { for (;;t++) putchar(
  ((t<<1)^
   ((t<<1)+(t>>7)&t>>12))
  | t>>(4-(1^7&(t>>19)))
  | t>>7
); }

http://canonical.org
  /~kragen/bytebeat

== MDFourier ==

This tool plays a series of
tones to generate an audio
signature for the MDFourier
analysis tool available at
junkerhq.net/MDFourier

Record the NES's audio
output using a sound card
and compare it to other
systems using the NES v7
profile (or newer).
Only the 2A03 is tested,
not Famicom expansion audio.

A: Play tones   B: Stop
←→: Change video background
  to test A/V crosstalk
  (menu, below black, black,
  white, 15k, or 8k)
----
Other tests that use the
triangle channel can leave
it in an unpredictable state.
This causes noise and DPCM
volume to vary between runs.
Only a power cycle or Reset
Button press fully resets it.

Start+Reset: Skip to
  MDFourier menu
A+Start+Reset: Start test

== Audio sync test ==

This test flashes the whole
screen white for two frames
along with a 1 kHz test tone
when the dot hits the floor.

You can verify the sync
between audio and video
with recording equipment
or an oscilloscope.

A: Start or stop

== Input test: Menu ==

Serial analyzer
FC controllers & mic
NES with Four Score
Zapper
Power Pad in 2P
Arkanoid Controller in 2P
Super NES Controller
Super NES Mouse in 2P

== Under construction ==

This part of Input test
isn't built yet.

https://github.com/pinobatch/
  240p-test-mini/issues/42

== Input test ==

Choose the test
corresponding to the
connected input devices,
then press buttons.

The serial analyzer strobes
then polls every 32 cycles
(18 μs). Use it to inspect the
packet format of homemade
or newly found input devices.

Because the B Button is
under test, some tests
are closed by holding the
Select and Start Buttons.

Caution: Hot-swapping
controllers can cause a
CPU voltage sag. Press the
Reset Button to recover.

== Zapper test ==

This tests whether a
Zapper light gun in port
2 will work with your TV.

Arrows at the right side
show where it's pointed (red)
and how long the photodiode
remains activated (gray).
A red arrow significantly
below where the barrel is
pointed indicates scaler lag.

Point barrel up and down:
  Move arrows
----
The Zapper uses a 15.7 kHz
resonator to tell a CRT
SDTV's light from, say, a
light bulb. Thus it won't see
a high-definition CRT, whose
horizontal sync rate is far
higher, or an LCD that doesn't
flicker in the first place.

It is conjectured that the
Zapper will see a 31 kHz CRT
with every other line dark,
such as a line doubler that
draws "scanlines" between
picture lines and has delay
less than 5 lines (317 μs).

== 240p Test Suite ==

$COMMIT
Monoscope; input test

Concept: Artemio Urbina
   🐦 @Artemio
Program: Damian Yerrick
   🦣 @pinobatch@
       peoplemaking.games

© 2011-2016 Artemio Urbina
© 2015-2023 Damian Yerrick
This is free software; see the
source for copying conditions.
There is NO warranty, not
even for MERCHANTABILITY
or FITNESS FOR A
PARTICULAR PURPOSE.
----
Thank you to my patrons:
Artemio Urbina, Joe Parsell,
Brad Smith, Rin Mari, Jeremy Z,
zeta0134, Jason Richmond,
Guto Maia, birdybro

You can help this project by
running the test on authentic
and clone NES consoles, both
straight to the TV and with
high-quality external scalers,
and spreading the word about
the project.

Interested? Apply at
  goo.gl/XF8ef6
Support us:
  patreon.com/pineight
