A game loop runs a game one frame at a time. Console games tie it to vertical blank, the pause between frames when video memory can be written, so time in them is counted in frames, and the timers routines wait on count down once per pass.

Games

Every claim about this mechanic, by game (7)
Super Mario Bros.: The Lost Levels 1986GameCoreRoutine and ScrollHandler are Super Mario Bros.'s with three changes: the game mode's task list gains GameModeDiskRoutines at its head and the core no longer reads the current player's saved joypad bits; each frame of play calls SimulateWind once a disk file beyond worlds 1 to 4 is loaded; ScrollHandler waits for the status bar's timer IRQ before it scrolls and keeps the name table in NameTableSelect, where Super Mario Bros. sets it in its PPU control mirror. GetScreenPosition is byte for byte the same.Code
Mega Man 2 1988Mega Man 2's _nmi_wait_0e and _nmi_wait_0d keep the steps of Mega Man's _nmi_wait: save the last buttons, wait for the NMI, call _joy, and mark the newly pressed buttons. The two differ only in the bank they map at the end, and each first calls _background_palette. Mega Man 2 drops the path for buttons the game forces and moves the water frame into _nmi_wait_water.Code
Both games' stage loops run a frame of play and wait for the NMI, but Mega Man 2's is new code: it calls its own routines in its own order, opens the menu on Start with no Select pause, and waits an extra frame now and then in water. Its region also starts the stage before the loop.Code
Mega Man 3 1990Both games' NMI handlers copy the sprites by DMA, write the queued screen and palette updates, set the scroll, and run the sound driver, but Mega Man 3's handler is new code. Mega Man 2's offsets the scroll for the Mecha Dragon and puts the sound off when the NMI interrupts a bank switch; Mega Man 3's also loads the MMC3's scanline counter for the frame's split-screen interrupt and picks the interrupt handler for the screen mode.Code
Both games run a stage a frame at a time in step with the NMI, but Mega Man 3's frame loop is new code built on a task scheduler. Mega Man 2's stage loop calls its routines in turn and then spins in _nmi_wait_0e until the NMI sets a flag, reading the pads after it. Mega Man 3 runs up to four tasks, each resumed from its own saved stack pointer; gameplay_frame_loop gives up the CPU for a frame through the scheduler, which reads the controllers only when it resumes task 0.Code
Mega Man 4 1991Mega Man 4's cooperative task scheduler, with its routines to start, kill, and yield tasks, is Mega Man 3's task_scheduler instruction for instruction; it sits 5 bytes lower, and only its jump and call addresses differ.Code
Mega Man 5 1992Mega Man 5's cooperative task scheduler is Mega Man 4's instruction for instruction; it sits 6 bytes higher, and only its jump and call addresses differ.Code