He could have also written the thing in assembly, stored the machine code in DATA statements, loaded it into an array with a READ/POKE loop, and then called it with CALL ABSOLUTE.
I actually used this technique to replace Nibbles’ busy-waiting delay loop with an invocation of interrupt 0x15 service 0x86.