File Description 	: Document of Program Flow Control
Author		 	: Stephen McNabb
Creation Date		: 21st February 1995
Last Updated		: 21st Februray 1995

	This document describes methods of obtaining high level program
structures within machine code. In a high level language you have ways
of testing a condition and carrying out commands depending on the result.

Example

	In 'C':	if (x == 1) printf("The value of x is 1\n");
		else printf("The value of x is not 1\n");
		
	All these can be also obtained with machine code. Below is a
description of some of the ways of obtaining these. The high level language
desccription of the methods is not based on a particular language but
instead is psuedo-code.


if a=1 then s1 else s2
----------------------

This means that if 'a' is equal to '1' then statement 1 will be executed,
otherwise statement 2 will be executed. d0 will store the value of 'a'.

if:	cmpi.b	#1,d0		/check if 'a' is 1
	bne	s2		/if not execute statement 2
s1:	.			-+
	.		 	 | Code for statement 1
	.			-+
	bra	exit		/if statement 1 executed the exit
s2:	.			-+
	.		 	 | Code for statement 2
	.			-+
exit:				/exit the if code
	

while a=1 do s1
---------------

This means that statement 1 will continue to be executed while 'a' is
equal to '1'. d0 holds the value of 'a'.

while:	cmpi.b	#1,d0		/check if 'a' is 1
	bne	exit		/if not then leave while loop
	.			-+
	.			 | Code for statement 1
	.			-+
	bra	while		/continue with while loop
exit:				/exit the while code

Note: Statement 1 must be capable of changing the value of 'a'.


for a = 0 to 6 do s1
--------------------

This means that statement 1 will be executed 7 times. A will be begin
with a value of 0 and will be incremented each time statement 1 is
executed. When it has the value of 6 then the loop will stop.

	clr	d0		/used to hold value of a starting at 0
for:	.			-+
	.			 | Code for statement 1
	.			-+
	addq.b 	#1,d0		/increment a each time
	cmpi.b	#6,d0		/check if it equal to 6
	ble	for		/if a<=6 then loop again
exit:				/exit the for loop


	This document will be extended to cover other high level structures,
such as the case statement, in the next issue.

*** End of File ***
