*=================================================================== * FILE: fibonacci.asm * * DESCRIPTION: Fibonacci test program for the ERISC processor model. * The Fibonacci sequence is computed via c=a+b;a++;b++ * with the staring condition a=0 and b=1 * The output sequence should be: * IPORT (hex): 0 1 2 3 4 5 6 7 8 9 a b c d * OPORT (hex): 0 1 1 2 3 5 8 d 15 22 37 59 90 e9 *=================================================================== .global _EXIT .text k .set 1 a .set 2 b .set 3 c .set 4 NOP SCAN POP k PUSHI 0 POP a PUSHI 1 POP b L00: PUSH k PUSHI 0 BEQ @L01 PUSH a PUSH b ADD POP c PUSH b POP a PUSH c POP b PUSH k PUSHI 1 SUB POP k JMP @L00 L01: PUSH a PRINT NOP NOP JMP @0 JMP @0 NOP NOP .end