	device	pic16c84, rc_osc, wdt_off, protect_off

;register
CNT	EQU	10H

;digit data
;binary: -decgfab, 1-off 0-on
;
;    __a
;  f|  |b
;    -- g
;  e|__|c
;    d

DIGIT1	EQU	14H	;2:-de-g-ab
DIGIT2	EQU	6CH	;7:---c--ab
DIGIT3	EQU	08H	;0:-dec-fab

;
RP0_	EQU	05H


;reset vector
	ORG	00H
	JMP	INIT

;device initialise
	ORG	3C0H
INIT
	BSF	STATUS, RP0_		;bank 1
	CLRF	TRISA			;Port A:all output
	CLRF	TRISB			;Port B:all output
	MOVLW	80H			;Port B:pull-up disable
	MOVWF	OPTION
	BCF	STATUS, RP0_		;bank 0
	CLRF	INTCON			;disable all interrupt

;main routine
MAIN
	CLRF	PORTB
	MOVLW	6
	MOVWF	PORTA			;1st digit(right)
	MOVLW	DIGIT1
	MOVWF	PORTB
	CALL	WAIT

	CLRF	PORTB
	MOVLW	3			;2nd digit(center)
	MOVWF	PORTA
	MOVLW	DIGIT2
	MOVWF	PORTB
	CALL	WAIT

	CLRF	PORTB
	MOVLW	5			;3rd digit(left)
	MOVWF	PORTA
	MOVLW	DIGIT3
	MOVWF	PORTB
	CALL	WAIT

	GOTO	MAIN

;wait subroutine
WAIT
	MOVLW	0C7H			;about 25us x 199 times + alpha = 5ms?
	MOVWF	CNT
WAITLP
	NOP
	NOP
;	NOP
;	NOP
	djnz	CNT, WAITLP
	RETURN


	END
