timers
Time three ways: a root counter counting the screen's lines, a clock kept by counting frames, and how much of each frame the program's work takes, with sprites to add until it takes too much.
Controls
Up and down add and take away sprites, ten at a time while held.
A port of the SCEE tutorial's chapter 5, its three examples in one program. The first started root counter 1, which counts the television's horizontal lines, and counted each time it passed 65,250. The second kept a clock in minutes and seconds by counting frames, fifty to a second on the European consoles it was written for. The third drew sprites, more or fewer with up and down, and printed how many lines had passed since the last vertical blank, which is how long the frame's work took.
The root counters are the CPU's four timers: one counts the GPU's dot clock, one the horizontal lines, one the system clock divided by eight, and one the vertical blanks, which the library keeps for VSync. Each counts to 65,535 and round again, so a program measures a span by the difference of two readings. The frame count gives a clock without them: VSync(-1) returns the fields since the program started, sixty a second on an NTSC console and fifty on a PAL one. And VSync(1) returns the lines since the last vertical blank without waiting, which, read when a frame's work is done, is how much of the frame it took: a television draws 263 lines a field on NTSC and 313 on PAL, and work that takes more misses the next vertical blank and halves the frame rate.
Differences from the tutorial: the clock reads the console's own rate, rather than taking fifty frames to a second; the line count is drawn as a bar against the frame as well as printed; and the sprites move, a few hundred at most.