Introducing the Flow Chart

The Random House Webster's Dictionary tells us that a flowchart is a graphic representation of the successive steps in a procedure or system.  The flow chart is a simple idea.  Despite the best attempts of many, the flow chart is still an effective tool for understanding and writing software.  Despite the wealth of tools, there are situations where the flow chart is the most natural and appropriate choice.  These supplemental notes are written simply because the texts I have treat the topic a bit too lightly.  This document is a work in progress that will grow and improve in time. 

As far as writing assembly language programs, flow charts provide an helpful intermediate step between the high-level concept of what a program should do and the actual implementation.  This is the same basic idea associated with pseudo-code.  Unless you haven't noticed yet, even with the aid of comments, which do help immensely, assembly language is very dense and difficult to read.  In drawing a flow chart resist the temptation to exactly match the instructions in your program.  In being an intermediate step, the flow chart should be slightly higher level than the corresponding program code.

Entry and Exit Symbols

A program or procedure usually has an entry point and an exit point.  Despite the fact that both use the oval shape, the meaning is understood in context.  Either the word Start, Enter, or the name of the procedure is written in the entry symbol.  For procedures having a single exit symbol, the word Exit is written in the symbol.  Some procedures return a code to indicate such status information as success or failure.  By having several exit symbols in a flow chart, we can abstracts the idea of the return code.  An appropriate return code word is written into each exit symbol.

Entry and exit symbols

Processing Symbol

A processing symbol is drawn with a rectangle.  A processing symbol need not correspond to only one instruction or step, but it can correspond to several instructions executed in sequence without branching, or it can be an entire procedure with its own flow chart.  Naturally, to correspond to a procedure the execution must be contained in the context of the processing box.  In such a case the name of the procedure is written in the processing box.

Processing box

In the situation that a processing box corresponds to a procedure which returns status codes, each code corresponds to an exit point.  The following is such an example of a procedure named TEST that returns two possible exit codes.

Processing box with multiple exits

Input Output Symbol

The angled box symbol is a special processing box reserved for handling input and output.  The symbol is most often used to represent an entire procedure that handles input or output.  The Buffalo monitor has a library of such procedures.

Input/Output box

Decision Symbol

The decision or conditional branch symbol is drawn as a hexagon or a diamond shape.  In providing more area to write in, the the hexagon is less constrictive than the diamond shape.  If the expression TEST is true, the yes path is followed, otherwise the no path is followed. 

Decision symbols

The implementation of a conditional branch in assembly language is actually a two step process. 

While there may be several ways to implement a given conditional branch, in most cases the instructions used to condition and interpret the flags are understood in context.  To compare magnitudes the compare instruction ( cmp ) is most often used.  The bit test instructions are convenient for conditioning the flags for whether a specific bit is high or not.  In cases where is is absolutely necessary you can use a processing symbol to condition the flags and a decision box with a simple test to represent the conditional branch instruction.

The equal and not equal tests are = and !=, respectively.  Pay special attention to differentiate so called signed and unsigned conditional branch instructions.  Signed comparisons use words like greater than and less than and are drawn with algebraic symbols ( >, <, >=, <= ).  Unsigned comparisons use words like higher than and lower than and are drawn with symbols like hir, lor, his, los which mean, higher than, lower than, higher or same, and lower or same, respectively.

To and From Bubbles

In complicated flowcharts, consideration is needed to reduce clutter.  Bubbles are useful for avoiding long lines and allowing a flowchart to be drawn over several pages.  A name or symbol like 'A' drawn in each bubble associates a entry or 'to' bubble with an exit or 'from' bubble.  While a 'to' bubble may have several input paths, a 'from' bubble has only one exit path. 


Pay careful attention that all associated bubbles are actually drawn in the context of a single procedure.  Do not use bubbles to exit or return from a procedure. 

Clear Memory Example

The following illustrates one method for clearing or assigning zero to the first NN bytes of memory.  Here we assume 68HC11 assembly language so that A and X are seen as the A and X registers, respectively.  The right arrow means perform the assignment to.  The square brackets mean, the contents of so that [X] means index addressing with the a constant offset value of zero.

Clear memory flow chart

The following is one program corresponding to the given flow chart.  The EQU directive assigns a constant value to NN and the ORG directive sets the initial point of assembly.  Don't be confused by the EQU directive, its use only helps you read and maintain the program.  In assembling the program the name NN is simply replaced by its value $20.

* clearnn.asm - Jonathan Hill 9/26/2004
* Clear the first NN memory locations
NN:	EQU	$20

	ORG	$FF00	; Start of ROM
Start:	LDX	#$0000	; first address
Top:	CLR	$00,X	; top of the loop
	INX		; increment pointer
	CPX	#NN	; compare
	BNE	Top	; not done yet?

Loop:	BRA	Loop	; end of the program


Copyright and Revision Date

This document is written for ECE332, the microprocessor applications course offered by the ECE department in the College of Engineering at the University of Hartford.  Copies of this document may be made gratis for educational purposes only, provided that this statement remains intact.  The author retains the copyright on this document.
Author: Jonathan Hill - jmhill at
Copyright: Sun Sep 26 23:40:32 EDT 2004
Last Revised: Wed Oct 6 00:18:50 EDT 2010