PIC16F84電子遊戯(71)サブページ
最終更新日:2002年4月30日
ゴジラついに登場(1ページ)へ (2ページ)へ

ゴジラついに登場を作ろうの全ソースリスト
;**********************************************************************
;    Filename:      gozila.asm                                           *
;    Date:          2002/3/30                                         *
;    File Version:                                                    *
;**********************************************************************
 
         list      p=16F84             ; list directive to define processor
         #include <p16F84.inc>         ; processor specific variable definitions
         LIST
; P16F84.INC  Standard Header File, Version 2.00    Microchip Technology, Inc.
         LIST
  
         __CONFIG   _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
 
;***** VARIABLE DEFINITIONS
w_temp        EQU     0x0C        ; variable used for context saving 
status_temp   EQU     0x0D        ; variable used for context saving
 
led_data        EQU     0x11            ;LED set data
                                        ;led_data,0  SEBIRE1 LED
                                        ;led_data,1  SEBIRE2 LED
                                        ;led_data,2  SEBIRE3 LED
                                        ;led_data,3  SEBIRE4 LED
					;led_data,4  SEBIRE5 LED
					;led_data,5  SEBIRE6 LED
					;led_data,6  KUCHI LED
  
acount1         EQU     0x13            ;LED auto count ram1
acount2         EQU     0x14            ;LED auto count ram2 
 
wait_data       EQU     0x15            ;wait data ram
color_count     EQU     0x16            ;color count ram
taihi           EQU     0x17            ;taihi data
wait_data2	EQU	0x18		;wait data2 ram

sebi1_count     EQU     0x19            ;SEBIRE1 count ram
sebi2_count	EQU     0x1a            ;SEBIRE2 count ram
sebi3_count     EQU     0x1b            ;SEBIRE3 count ram
sebi4_count	EQU     0x1c            ;SEBIRE4 count ram
sebi5_count	EQU	0x1d		;SEBIRE5 count ram
sebi6_count	EQU	0x1e		;SEBIRE6 count ram
kuchi_count	EQU	0x1f		;KUCHI count ram
 
sebi1_on	EQU     0x20            ;SEBIRE1 LED ON data ram
sebi1_off	EQU     0x21            ;SEBIRE1 LED OFF data ram
sebi2_on	EQU     0x22            ;SEBIRE2 LED ON data ram
sebi2_off	EQU     0x23            ;SEBIRE2 LED OFF data ram
sebi3_on	EQU     0x24            ;SEBIRE3 LED ON data ram
sebi3_off	EQU     0x25            ;SEBIRE3 LED OFF data ram
sebi4_on	EQU     0x26            ;SEBIRE4 LED ON data ram
sebi4_off	EQU     0x27            ;SEBIRE4 LED OFF data ram
sebi5_on	EQU	0x28		;SEBIRE5 LED ON data ram
sebi5_off	EQU	0x29		;SEBIRE5 LED OFF data ram
sebi6_on	EQU	0x2a		;SEBIRE6 LED ON data ram
sebi6_off	EQU	0x2b		;SEBIRE6 LED OFF data ram
kuchi_on	EQU	0x2c		;KUCHI LED ON data ram
kuchi_off	EQU	0x2d		;KUCHI LED OFF data ram

 
int_count1      EQU     0x30            ;int count1
int_count2      EQU     0x31            ;int count2
int_count3      EQU     0x32            ;int count3
 
tm0_setdata     EQU     0f3h            ;FFH-F3H=12 12*16=192usec
;**********************************************************************
                ORG     0x000             ; processor reset vector
                goto    main              ; go to beginning of program
 
                ORG     0x004             ; interrupt vector location
                movwf   w_temp            ; save off current W register contents
                movf    STATUS,w          ; move status register into W register
                movwf   status_temp       ; save off contents of STATUS register
                ;---------------------------------------------------------------
                bcf     INTCON,T0IF
                movlw   tm0_setdata
                movwf   TMR0
                ;---------------------------------
                movlw   01h
                addwf   int_count1,1
                btfss   STATUS,0
                goto    int_next2
                movlw   01h
                addwf   int_count2,1
                btfsc   STATUS,0
                incf    int_count3,1
                ;---------------------------------
int_next2
                movlw   01h             ;LED mode auto shori
                addwf   acount1,1
                btfsc   STATUS,0
                incf    acount2,1
                btfss   acount2,0       ;
                goto    sebire1_leds
                call    led_change      
                call    led_set
                call    auto_clear
                ;----------------------- SEBIRE1
sebire1_leds	decfsz  sebi1_count,1
                goto    sebire2_leds
                btfsc   led_data,0      ;SEBIRE1 OFF?
                goto    sebire1_leds_2
sebire1_leds_3	bsf     led_data,0      ;SEBIRE1 ON
                movf    sebi1_on,0
                movwf   sebi1_count
                movf    sebi1_count,0
                btfsc   STATUS,2
                goto    sebire1_leds_2
                goto    sebire2_leds
sebire1_leds_2	bcf     led_data,0      ;SEBIRE1 OFF
                movf    sebi1_off,0
                movwf   sebi1_count
                movf    sebi1_count,0
                btfsc   STATUS,2
                goto    sebire1_leds_3             
                ;----------------------- SEBIRE2
sebire2_leds	decfsz  sebi2_count,1
                goto    sebire3_leds
                btfsc   led_data,1      ;SEBIRE2 OFF?
                goto    sebire2_leds_2
sebire2_leds_3	bsf     led_data,1      ;SEBIRE2 ON
                movf    sebi2_on,0
                movwf   sebi2_count
                movf    sebi2_count,0
                btfsc   STATUS,2
                goto    sebire2_leds_2
                goto    sebire3_leds
sebire2_leds_2	bcf     led_data,1      ;SEBIRE2 OFF
                movf    sebi2_off,0
                movwf   sebi2_count
                movf    sebi2_count,0
                btfsc   STATUS,2
                goto    sebire2_leds_3             
                ;----------------------- SEBIRE3
sebire3_leds	decfsz  sebi3_count,1
                goto    sebire4_leds
                btfsc   led_data,2      ;SEBIRE3 OFF?
                goto    sebire3_leds_2
sebire3_leds_3	bsf     led_data,2      ;SEBIRE3 ON
                movf    sebi3_on,0
                movwf   sebi3_count
                movf    sebi3_count,0
                btfsc   STATUS,2
                goto    sebire3_leds_2
                goto    sebire4_leds
sebire3_leds_2	bcf     led_data,2      ;SEBIRE3 OFF
                movf    sebi3_off,0
                movwf   sebi3_count
                movf    sebi3_count,0
                btfsc   STATUS,2
                goto    sebire3_leds_3             
                ;----------------------- SEBIRE4
sebire4_leds	decfsz  sebi4_count,1
                goto    sebire5_leds
                btfsc   led_data,3      ;SEBIRE4 OFF?
                goto    sebire4_leds_2
sebire4_leds_3	bsf     led_data,3      ;SEBIRE4 ON
                movf    sebi4_on,0
                movwf   sebi4_count
                movf    sebi4_count,0
                btfsc   STATUS,2
                goto    sebire4_leds_2
                goto    sebire5_leds
sebire4_leds_2	bcf     led_data,3      ;SEBIRE4 OFF
                movf    sebi4_off,0
                movwf   sebi4_count
                movf    sebi4_count,0
                btfsc   STATUS,2
                goto    sebire4_leds_3             
                ;----------------------- SEBIRE5
sebire5_leds	decfsz  sebi5_count,1
                goto    sebire6_leds
                btfsc   led_data,4      ;SEBIRE5 OFF?
                goto    sebire5_leds_2
sebire5_leds_3	bsf     led_data,4      ;SEBIRE5 ON
                movf    sebi5_on,0
                movwf   sebi5_count
                movf    sebi5_count,0
                btfsc   STATUS,2
                goto    sebire5_leds_2
                goto    sebire6_leds
sebire5_leds_2	bcf     led_data,4      ;SEBIRE5 OFF
                movf    sebi5_off,0
                movwf   sebi5_count
                movf    sebi5_count,0
                btfsc   STATUS,2
                goto    sebire5_leds_3             
                ;----------------------- SEBIRE6
sebire6_leds	decfsz  sebi6_count,1
                goto    kuchi_leds
                btfsc   led_data,5      ;SEBIRE6 OFF?
                goto    sebire6_leds_2
sebire6_leds_3	bsf     led_data,5      ;SEBIRE6 ON
                movf    sebi6_on,0
                movwf   sebi6_count
                movf    sebi6_count,0
                btfsc   STATUS,2
                goto    sebire6_leds_2
                goto    kuchi_leds
sebire6_leds_2	bcf     led_data,5      ;SEBIRE6 OFF
                movf    sebi6_off,0
                movwf   sebi6_count
                movf    sebi6_count,0
                btfsc   STATUS,2
                goto    sebire6_leds_3             
                ;------------------------ KUCHI
kuchi_leds	decfsz  kuchi_count,1
                goto    next_leds_3
                btfsc   led_data,6      ;KUCHI OFF?
                goto    kuchi_leds_2
kuchi_leds_3    bsf     led_data,6      ;KUCHI ON
                movf    kuchi_on,0
                movwf   kuchi_count
                movf    kuchi_count,0
                btfsc   STATUS,2
                goto    kuchi_leds_2
                goto    next_leds_3
kuchi_leds_2    bcf     led_data,6      ;KUCHI OFF
                movf    kuchi_off,0
                movwf   kuchi_count
                movf    kuchi_count,0
                btfsc   STATUS,2
                goto    kuchi_leds_3
                ;----------------------------------
next_leds_3
                ;----------------------------------
int_end
                movf    status_temp,w     ; retrieve copy of STATUS register
                movwf   STATUS            ; restore pre-isr STATUS register contents
                swapf   w_temp,f
                swapf   w_temp,w          ; restore pre-isr W register contents
                retfie                    ; return from interrupt
;--------------------------------------------------------------------------
main
                call    port_set
                movlw   00h
                movwf   PORTA
                movlw   080h
                movwf   PORTB
 
                call    timer0_set
 
                movlw   50h
                movwf   color_count
                call    auto_clear
 
                movlw   00h
                movwf   led_data        ;LED ALL OFF
                call    set_lo_leds
                movf    sebi1_on,0
                movwf   sebi1_count 	;SEBIRE1 count data set
                movf    sebi2_on,0
                movwf   sebi2_count 	;SEBIRE1 count data set
                movf    sebi3_on,0
                movwf   sebi3_count 	;SEBIRE1 count data set
                movf    sebi4_on,0
                movwf   sebi4_count 	;SEBIRE1 count data set
                movf    sebi5_on,0
                movwf   sebi5_count 	;SEBIRE1 count data set
                movf    sebi6_on,0
                movwf   sebi6_count 	;SEBIRE1 count data set
                movf    kuchi_on,0
                movwf   kuchi_count 	;KUCHI count data set

main_sleep
                bcf     INTCON,GIE
                nop
                bcf     INTCON,T0IE
                nop
                bcf     INTCON,T0IF
                nop
                bcf     INTCON,RBIF
                nop
                bsf     INTCON,RBIE
                nop
                call    icnt_clear
                movlw   080h
                movwf   PORTB
                nop
                sleep
                nop
                bcf     INTCON,RBIE
                nop
                bsf     INTCON,GIE
                nop
                bsf     INTCON,T0IE
                nop
		call	out1_out
;--------------------------------------
main_loop
                btfsc   int_count3,1
                goto    main_sleep2
;--------------------------------------
main_key

;--------------------------------------
sebire1_led
                btfss   led_data,0
                goto    sebire1_led_off
                bsf     PORTB,0
                nop
                goto    sebire2_led
sebire1_led_off
                bcf     PORTB,0
                nop
;--------------------------------------
sebire2_led
                btfss   led_data,1
                goto    sebire2_led_off
                bsf     PORTB,1
                nop
                goto    sebire3_led
sebire2_led_off
                bcf     PORTB,1
                nop
;--------------------------------------
sebire3_led
                btfss   led_data,2
                goto    sebire3_led_off
                bsf     PORTB,2
                nop
                goto    sebire4_led
sebire3_led_off
                bcf     PORTB,2
                nop
;--------------------------------------
sebire4_led
                btfss   led_data,3
                goto    sebire4_led_off
                bsf     PORTB,3
                nop
                goto    sebire5_led
sebire4_led_off
                bcf     PORTB,3
                nop
;--------------------------------------
sebire5_led
                btfss   led_data,4
                goto    sebire5_led_off
                bsf     PORTB,4
                nop
                goto    sebire6_led
sebire5_led_off
                bcf     PORTB,4
                nop
;--------------------------------------
sebire6_led
                btfss   led_data,5
                goto    sebire6_led_off
                bsf     PORTB,5
                nop
                goto    kuchi_led
sebire6_led_off
                bcf     PORTB,5
                nop
;--------------------------------------
kuchi_led
                btfss   led_data,6
                goto    kuchi_led_off
                bsf     PORTB,6
                nop
                goto    main_next_3
kuchi_led_off
                bcf     PORTB,6
                nop
;--------------------------------------
main_next_3
                goto    main_loop
;--------------------------------------
main_sleep2
		call	out2_out
		goto	main_sleep
;-------------------------------------------------------------------------------
out1_out
		bsf	PORTA,0
		nop
		call	wait_1
		call	wait_1
		call	wait_1
		bcf	PORTA,0
		nop
		return
out2_out
		bsf	PORTA,1
		nop
		call	wait_1
		call	wait_1
		call	wait_1
		bcf	PORTA,1
		nop
		return
;-------------------------------------------------------------------------------
wait_1          
                movlw   0ffh
                movwf   wait_data
wait_2
                nop
                decfsz  wait_data,1
                goto    wait_2
                return
;-------------------------------------------------------------------------------
auto_clear      movlw   00h
                movwf   acount1         ;LED auto count clear
                movwf   acount2
                return
;-------------------------------------------------------------------------------
led_change      decf    color_count,1
                btfsc   STATUS,2
                goto    led_change2
                return
led_change2     movlw   50h
                movwf   color_count
                return
;-------------------------------------------------------------------------------
led_set
	        call    set_on_sebire1
                movwf   sebi1_on
                sublw	70h
                movwf   sebi1_off

	        call    set_on_sebire2
                movwf   sebi2_on
                sublw	70h
                movwf   sebi2_off

	        call    set_on_sebire3
                movwf   sebi3_on
                sublw	70h
                movwf   sebi3_off

	        call    set_on_sebire4
                movwf   sebi4_on
                sublw	70h
                movwf   sebi4_off

	        call    set_on_sebire5
                movwf   sebi5_on
                sublw	70h
                movwf   sebi5_off

	        call    set_on_sebire6
                movwf   sebi6_on
                sublw	70h
                movwf   sebi6_off

	        call    set_on_kuchi
                movwf   kuchi_on
                sublw	70h
                movwf   kuchi_off

		return

;--------------------------------------------------------------------------------
icnt_clear      movlw   00h
                movwf   int_count1
                movwf   int_count2
                movwf   int_count3
                return
;--------------------------------------------------------------------------------
set_on_sebire1
		movf    color_count,0
                movwf   taihi
                movlw   low(sebire1_on_table)
                addwf   taihi,1
                movlw   high(sebire1_on_table)
                movwf   PCLATH
                addcf   PCLATH,1
                movf    taihi,0
                movwf   PCL
sebire1_on_table   
                retlw   000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	020h
		retlw	030h
		retlw	040h
		retlw	050h
		retlw	060h
		retlw	070h
		retlw	060h
		retlw	050h
		retlw	040h
		retlw	030h
		retlw	020h
		retlw	010h
;--------------------------------------------------------------------------------
set_on_sebire2
		movf    color_count,0
                movwf   taihi
                movlw   low(sebire2_on_table)
                addwf   taihi,1
                movlw   high(sebire2_on_table)
                movwf   PCLATH
                addcf   PCLATH,1
                movf    taihi,0
                movwf   PCL
sebire2_on_table   
                retlw   000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	020h
		retlw	030h
		retlw	040h
		retlw	050h
		retlw	060h
		retlw	070h
		retlw	060h
		retlw	050h
		retlw	040h
		retlw	030h
		retlw	020h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
;--------------------------------------------------------------------------------
set_on_sebire3
		movf    color_count,0
                movwf   taihi
                movlw   low(sebire3_on_table)
                addwf   taihi,1
                movlw   high(sebire3_on_table)
                movwf   PCLATH
                addcf   PCLATH,1
                movf    taihi,0
                movwf   PCL
sebire3_on_table   
                retlw   000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	020h
		retlw	030h
		retlw	040h
		retlw	050h
		retlw	060h
		retlw	070h
		retlw	060h
		retlw	050h
		retlw	040h
		retlw	030h
		retlw	020h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
;--------------------------------------------------------------------------------
set_on_sebire4
		movf    color_count,0
                movwf   taihi
                movlw   low(sebire4_on_table)
                addwf   taihi,1
                movlw   high(sebire4_on_table)
                movwf   PCLATH
                addcf   PCLATH,1
                movf    taihi,0
                movwf   PCL
sebire4_on_table   
                retlw   000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	020h
		retlw	030h
		retlw	040h
		retlw	050h
		retlw	060h
		retlw	070h
		retlw	060h
		retlw	050h
		retlw	040h
		retlw	030h
		retlw	020h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
;--------------------------------------------------------------------------------
set_on_sebire5
		movf    color_count,0
                movwf   taihi
                movlw   low(sebire5_on_table)
                addwf   taihi,1
                movlw   high(sebire5_on_table)
                movwf   PCLATH
                addcf   PCLATH,1
                movf    taihi,0
                movwf   PCL
sebire5_on_table   
                retlw   000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	020h
		retlw	030h
		retlw	040h
		retlw	050h
		retlw	060h
		retlw	070h
		retlw	060h
		retlw	050h
		retlw	040h
		retlw	030h
		retlw	020h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
;--------------------------------------------------------------------------------
set_on_sebire6
		movf    color_count,0
                movwf   taihi
                movlw   low(sebire6_on_table)
                addwf   taihi,1
                movlw   high(sebire6_on_table)
                movwf   PCLATH
                addcf   PCLATH,1
                movf    taihi,0
                movwf   PCL
sebire6_on_table   
                retlw   000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	030h
		retlw	050h
		retlw	070h
		retlw	050h
		retlw	030h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	020h
		retlw	030h
		retlw	040h
		retlw	050h
		retlw	060h
		retlw	070h
		retlw	060h
		retlw	050h
		retlw	040h
		retlw	030h
		retlw	020h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
;--------------------------------------------------------------------------------
set_on_kuchi
		movf    color_count,0
                movwf   taihi
                movlw   low(kuchi_on_table)
                addwf   taihi,1
                movlw   high(kuchi_on_table)
                movwf   PCLATH
                addcf   PCLATH,1
                movf    taihi,0
                movwf   PCL
kuchi_on_table   
                retlw   000h
		retlw	000h
		retlw	000h
		retlw	010h
		retlw	010h
		retlw	020h
		retlw	020h
		retlw	030h
		retlw	030h
		retlw	040h
		retlw	040h
		retlw	050h
		retlw	050h
		retlw	050h
		retlw	060h
		retlw	060h
		retlw	060h
		retlw	070h
		retlw	070h
		retlw	070h
		retlw	070h
		retlw	070h
		retlw	070h
		retlw	060h
		retlw	050h
		retlw	040h
		retlw	030h
		retlw	020h
		retlw	010h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h
		retlw	000h

;-------------------------------------------------------------------------------
set_lo_leds     movlw   00h
                movwf   sebi1_on
                movwf   sebi2_on
                movwf   sebi3_on
                movwf   sebi4_on
                movwf   sebi5_on
                movwf   sebi6_on
                movwf   kuchi_on
 
                movlw   70h
                movwf   sebi1_off
                movwf   sebi2_off
                movwf   sebi3_off
                movwf   sebi4_off
                movwf   sebi5_off
                movwf   sebi6_off
                movwf   kuchi_off

                return
;-------------------------------------------------------------------------------
port_set                                ;RA0,RA1,RA2,RA3,RA4(OUT)
                                        ;RB0,RB1,RB2,RB3,RB4,RB5,RB6(OUT)
                                        ;RB7(IN)
                bsf     STATUS,RP0
                clrf    TRISA
                clrf    TRISB
                bsf     TRISB,7
                nop
                bcf     STATUS,RP0
                return
 
timer0_set
 
                bsf     STATUS,RP0
                movlw   083h            ;(1)PORTB NOT PULLUP
                                        ;(0)INTEDG
                                        ;(0)TOCS
                                        ;(0)TOSE
                                        ;(0)PSA
                                        ;(011)1/16
                movwf   OPTION_REG
                bcf     STATUS,RP0
                 
                movlw   tm0_setdata
                movwf   TMR0
                return
 
 
                END                     ; directive 'end of program'

不明点などあればメールお願いいたします。nonchansoft@nifty.com