/* A program to calculate the tenth fibonacci number */

:Heading:
// Library routine M3:- prints a heading from the tape then loads things over it
// Must be terminated by ..PK or ..PZ
PFGKIFAFRDLFUFOFE@A6FG@E8FEZPF
@&*Fibonacci!Generator
@&*!!!!!!!!BY!!!!!!!!!
@&*!!!!J!MARSHALL!!!!!
@&*#
..PK

// Master routine
T44K            // Load this section into location 44 in memory
GK	        // Set the @ parameter to the next instruction
:loop:	        // Label for the loop
T0F 	        // clear the accumulator
A avar F        // Accum=a
A bvar F        // Accum=a+b
U avar F        // Store a+b into a 
S bvar F        // Accum=a
T bvar F        // Store into b and clear accumulator
A ivar F        // Load the loop counter
S one F         // Subtract 1
U ivar F        // Store loop counter
E loop @        // Loop if loop counter is positive
T0F	        // Clear accumulator
A avar F	// Accum=a
T0F	        // Store into postion 0
:here:	        // Label to set up the wheeler jump (function call)
A here F	// Set up the call
G print F       // Call the print routine to display memory position 0
ZF	        // Stop and ring the bell

// Variables stored here
:avar:CONST(1,F)	//Variable a (current fibonacci number) = float constant 1
:bvar:CONST(1,F)	//Variable b (last fibonacci number) = float constant 1
:ivar:CONST(10,F)//Loop counter = float constant 10
:one:CONST(1,F)	//float constant =1

:print:         // Library subroutine P6 - displays the short integer in memory location 0
GKA3FT25@H29@VFT4DA3@TFH30@S6@T1F
V4DU4DAFG26@TFTFO5FA4DF4FS4F
L4FT4DA1FS3@G9@EFSFO31@E20@J995FJF!F

O40K#F          // sets the system into number shift while loading 
                // this is a function of initial orders 2 (output the character #)
E loop K        // Enter at the beginning of the loop
CONST(0,F)       // with accumulator set to 0
