(covers information from several alternate timelines)
A subroutine was a subprogram in a computer, often called up to execute by a higher level program. It consisted of instructions that performed a specific set of tasks for a main routine. Subroutines often accounted for the sentient qualities of AI.
In 2258 of the alternate reality, James T. Kirk installed and activated a subroutine which changed the parameters of the Kobayashi Maru scenario, thereby allowing him to beat it, something which was considered cheating. (Star Trek)
In late 2375, Noah Lessing of the USS Equinox designed a subroutine to mask the internal sensors of the USS Voyager, allowing the Equinox crew to steal a modified field generator that provided protection against nucleogenic lifeforms. (VOY: "Equinox")