Search code examples
calculatorinfinite-looptexas-instrumentsti-basicz80

Is there a way to add code to an infinite z80 assembly loop?


A while ago, I asked what the fastest infinite loop was on a TI-84. One of the answers I got involved using an assembly infinite loop with this code:

AsmPrgm
18FE

However, this is a bit impractical, because it can only be exited with the reset button and doesnt run anything inside it.

Is there a way to put TI-Basic code inside of this loop and/or make it exit conditionally?

Here is the link to the original question and answer: What is the fastest infinite loop in TI-84+ Basic?


Solution

  • You can definitely make assembly programs exit conditionally. The command C9 is return, so if you have a program consisting of only AsmPrgmC9, running it as an assembly program will have it instantly finish (it will look the same as running a program with nothing in it). If you want to end the loop when some condition is met, then you'll need to start learning assembly as the answer will widely vary on what that condition is and what OS version/calculator you're using.