	list      p=16F84	; list directive to define processor
	#include <p16F84.inc>	; processor specific variable definitions
counter	equ	H'0c'	; A storage location for a software timer

	call initialize
main
	movlw	2	;Display first digit
	movwf	PORTA
	call	delay
	movlw	9	;Display second digit
	movwf	PORTA
	call	delay
	movlw	3	;Display third digit
	movwf	PORTA
	call	delay
	movlw	6	;Display fourth digit
	movwf	PORTA
	call	delay
	movlw	1	;Display fifth digit
	movwf	PORTA
	call	delay
	movlw	8	;Display sixth digit
	movwf	PORTA
	call	delay
	movlw	1	;Display seventh digit
	movwf	PORTA
	call	delay
	goto	main	;Repeat forever
; ****************************************************
; One-time initialization code goes here.
initialize
	bsf	STATUS,RP0	; Switch to Bank 1
	movlw	B'00000000'	; Make all five pins of Ports A and B outputs.
	movwf	TRISA
	movwf	TRISB
	bcf	STATUS,RP0	; Switch back to Bank 0.
	return
; ****************************************************
; Delay for some number of cycles.
; Let n0 = counter
;     n  = # of cycles to waste
;     t  = time to waste
;     T  = one instruction period
; Then choose n = t/T = 2 + 2 + 6(n0) + 4 = 8 + 6(n0)
; or
;             n0 = (t/T - 8)/6
delay	movlw	2		; This is a dummy value.  We'll need to compute the
				; correct value to get a 1 s delay.
	movwf	counter
delayloop
	movf	counter,F	; See if counter is zero yet.
	btfsc	STATUS,Z
	return			; It's zero so return
	decf	counter,F	; Decrement the counter and repeat
	goto	delayloop
; ****************************************************
	end	; This is necessary to tell the assembler the program is done.
