Thanks for the ideas. I found an easy way now:

This isnt the code but gives the idea.

READ 0, blah
startup:
if blah = "1" then goto 1
if blah = "2" then goto 2

WRITE 0, "1" 'if it wasnt 1 or 2 then it reaches here
goto startup

1:
2:

This way if it doesnt have a needed value, it writes it then restarts. The second time it runs it will have one of the right values.