V I C T O R T E C H N O L O G Y
Chapter 6: Branch & Loop Programs
Program instructions typically execute sequentially through program line numbers, but it is possible to transfer or ‘branch’ to a program line that is not the next line of program memory.
Using the GTO instruction in a program will transfer an execution to any program line by using the designated three digit code of that line within the GTO command. After a branch, execution will resume sequentially as normal. For example, if program line 008 contains the command r GTO 004, then program line 004 will be executed after program line 008.
When the GTO instruction describes a lower number program line, the instructions contained within the lines between that line and the GTO instruction will be performed repeatedly. This is called ‘looping’.
To terminate the execution of a loop, insert a r x<y , r x=0 , or R/S instruction within the loop. Also, touching any key while executing the loop will stop the program.
Branching with Conditions
Sometimes you will need to branch to different lines of program memory, conditionally. There are two conditional test instructions used in program of conditional branching.
r x<y determines whether the value in the
r x=0 determines whether the value in the X register is equal to 0.
Using these instructions will either:
63