M

Marks a location to which a GO F or GO B command transfers control.

Syntax

M

Comments

The M command is especially useful for frequently executed loops, because the Proc processor does not have to search the entire Proc from the top down to find the label, as it does for a G command (unless the Proc has been compiled using PQ-COMPILE).

Instead, as a Proc executes, the Proc processor takes note of any mark it encounters and remembers it. When another mark is encountered, the first mark is forgotten and the new mark is remembered.

A GO B command causes an immediate transfer to the last mark executed. A GO F command scans forward from the current line until a mark is found and resumes program execution from there.

The GO F command is slower then the GO B command because of the time taken in scanning line by line. Both commands are faster than the G command which scans from the beginning of the program to the specified statement label (unless the Proc has been compiled with PQ-COMPILE).

As much as possible, use the GO B command to execute a loop in Proc rather than a GO F or G command. Example 3 shows how to use a GO B statement to form a loop.

The M command must be executed for it to be remembered. Therefore, be careful not to branch around a mark, if you want the Proc processor to remember it when GO B is executed.

Other Proc commands can appear on the same line as an M command, but only if the M command is the first command on the line and the commands are separated by a subvalue mark (CTRL+\).

Example 1

001 PQN
.
.
.
010 GO F
.
.
019 M
020 OADDRESS?

This example encounters the GO F command on line 10 and scans forward to the M(ark) command on line 19. Program execution continues from line 19.

Example 2

001 PQN
002 C...
003 M
.
.
.
099 GO B

This example shows a GO B command on line 99 that causes an immediate transfer of program execution to the mark on line 3 (the 'remembered' mark).

Example 3

001 PQN
002 MV %1 "0"
003 M
004 F;%1;C1;+;?%1
005 IF %1 # 10 GO B
006 M
007 F;%1;C1;-;?%1
008 IFN %1 > 0 GO B
009 X-DONE-

In this example, the contents of %1 are incremented from zero to ten, then program control moves on to line 6. Then the contents are decremented back to zero. Two loops are formed using GO B and M commands.