	;Expt4d.asm
        ;Project: Displaying WORDS
	;List P = 16F84
	;#include <p16F84.inc>
	;__CONFIG 1Bh    ;_CP_OFF & _PWRTE_ON & _WDT_OFF & _RC_OSC


	ORG 0		;This is the start of memory for the program.
SetUp	BSF 03,5	;Go to Bank 1
	CLRF 06		;Make all port B output		
	BCF 03,5	;Go to Bank 0 - the program memory area.	
	GOTO Main

Table1	ADDWF 02h,1	;Add W to the Program Counter to create a jump. 
	RETLW 73h	;P    This is jump=0 location.   format= gfedcba
	RETLW 3Eh	;U    This is jump=1 location.
	RETLW 6Dh	;S    This is jump=2 location.
	RETLW 76h	;H
	RETLW 00h	;blank
	RETLW 7Ch	;B
	RETLW 3Eh	;U
	RETLW 78h	;t
	RETLW 78h	;t
	RETLW 3Fh	;O
	RETLW 37h	;N	
	RETLW 00h	;blank

Delay	NOP		;Create approx 250mS delay
	DECFSZ 1A,1
	GOTO Delay
	DECFSZ 1B,1
	GOTO Delay
	RETURN

Word1	MOVF 1E,0	;Copy the jump-value into W
	CALL Table1	;W will return with display-value
	MOVWF 06	;Output display value
	CALL Delay	;Display for 0.25sec
	CALL Delay	;Display for 0.25sec
	CALL Delay	;Display for 0.25sec
	CLRF 06		;Clear the display
	CALL Delay	;Display for 0.25sec
	INCF 1E,1	;Increment jump-value to look at next table value
	MOVLW 0Ch	;The number of table-values (in hex)
	XORWF 1E,0	;Has the jump-value reached 0Ch?
	BTFSS 03,2	;Test the zero bit in the Status register
	GOTO Word1	;Loop to display next table-value
	RETURN		;Start again

		
Main	CLRF 1E
	CALL Word1
	GOTO Main

	END		;Tells assembler end of program