
***********************************************************************
*                            					      *
* This is a demo for an 8086 microprocessor running in a min mode.    *
* The program calculates Fibonacci numbers. The first two numbers,    *
* 1 and 1, are read from memory by the 8086 and it then begins with   *
* the calculations. As it calculates the numbers, they are stored     *
* serially in the memory for later inspection.....                    *
*                                                                     *
* The demo uses a reference element for the 8086mn. It is modelled    *     
* as a dynamic device.....                                            *
*                                                                     *
***********************************************************************

	ASEG	0FFFFH	;On reset the 8086 points at FFFF0H.
	JMPS	START	;Jump unconditionally to the START of the pgm.

	ASEG	0000H	;Program starts at memory location 0H.

 START:	MOV	BX,#200H;Load reg B with 200H. Reg B is the pointer
			;to memory where the numbers are stored.
	MOVB	AL,[BX] ;Move into reg AL the first number from mem
			;pointed to by reg B.
	INC	BX	;Increment the pointer to memory (reg B).
	MOVB	CL,[BX] ;Move into reg CL the second number from mem
			;pointed to be reg B.
	INC	BX	;Increment the pointer to memory (reg B).

 REPEAT:ADDB	AL,CL   ;Add the present two numbers to generate the
			;next number in reg AL.
	MOVB	[BX],AL ;Load the new generated number into memory at
			;the location pointed to by reg B.
	INC	BX	;Increment the memory pointer.
	ADDB	CL,AL	;Add the present two numbers to generate the 
			;next one in reg CL.
	MOVB	[BX],CL ;Load the new generated number into memory at
			;the location pointed to by reg B. 
	INC	BX	;Increment the memory pointer.
	JMP	REPEAT  ;Jump back to REPEAT and loop indefinitely. 

	ORG     200H
	DB      01, 01  ;Define the first two Fibonacci numbers.
	END
