( The word below is designed to wait the proper 100us per tick at 500kHz when tickfactor is 1. If the CPU runs faster, tickfactor has to be adjusted accordingly. "t" in comments below means "T-cycle", which at 500kHz is worth 2us. ) CODE TICKS HL POP, chkPS, ( we pre-dec to compensate for initialization ) BEGIN, HL DECd, ( 6t ) IFZ, ( 12t ) JPNEXT, THEN, A tickfactor @ LDri, ( 7t ) BEGIN, A DECr, ( 4t ) JRNZ, ( 12t ) AGAIN, JR, ( 12t ) AGAIN, ( outer: 37t inner: 16t )