Ok.... "Hey it works" Really well, I might add! A couple questions..
In elapsed.bas you've got:
if Ticks = 100 then
Ticks = Ticks-100
Is there a reason you subtract 100 instead of zeroing Ticks?

The question arises from a little excursion I had because of of the results I got doing subtraction to detect and handle rollovers. I found out that the first section evaluates true because of the unsigned nature of the math. I wound up reversing the sections and verifying the result for the rollover test wasn't > 255. Is there a better way. Also, what's the instruction count offset between 0x10000 - ((clock_freq / 4) /100) It looks like it's 7.

tmr is 80 Ticks sample at beginning of 500 ms interval
Ticks is 20 Ticks value now....

(The forum removed all my indentation, so it looks wierd)


ms100 = ticks
IF ms100 - tmr >= 50 THEN
GOSUB lptoggle
ELSE
IF ms100 < tmr THEN
IF (ms100 + 100) - tmr >= 50 THEN
GOSUB lptoggle
END IF
END IF
END IF
RETURN

lptoggle:
Toggle 0
RETURN