生活苦からさよなら~チョコと副業するたび記帳するたびワクワク
3年ごとに15万円もらえる女性のための保険


	LIST	P=PIC16F84A
	INCLUDE	"P16F84A.INC"
        __config _hs_osc & _wdt_off & _pwrte_off & _cp_off

	;wait has 96 orders

dat1	equ	0c	;LRABCXYZ
dat2	equ	0d	;000Sudlr
dat3	equ	0e
cnt	equ	0f
temp	equ	10
temp2	equ	11
temp3	equ	12

	org	0
	goto	init

init	bsf     status,rp0
	movlw   b'00000001'
	movwf   trisa
	movlw   b'00000000'
	movwf   trisb
	bcf     status,rp0
	clrf	porta
	clrf	portb
	clrf	dat1
	clrf	dat2
	clrf	dat3
	clrf	cnt
	clrf	temp
	movlw	d'1'
	movwf	temp2
	movlw	d'1'
	movwf	temp3

main	decfsz	temp2,1	;fuzzy
	goto	search
	movlw	d'200'
	movwf	temp2
	decfsz	temp3,1
	goto	search
	movlw	d'200'
	movwf	temp3
	clrf	porta
	clrf	portb
search	btfss	porta,0	;serch start bit
	goto	main
	call	wait
	btfsc	porta,0
	goto	main
	call	wait
	btfss	porta,0
	goto	main
	call	wait
	btfsc	porta,0
	goto	main
	call	wait
hit	call	scan	;start scanning
	call	led
	bcf	porta,2
	bcf	porta,3
	clrf	portb
	btfsc	dat2,4
	call	slow
	btfss	dat2,4
	call	control
	goto	main

slow	btfss	dat3,1
	bsf	dat3,1
	btfsc	dat3,1
	bcf	dat3,1
	btfss	dat3,1
	call	control
	return

scan	btfss	porta,0	;z
	bcf	dat1,0
	btfsc	porta,0
	bsf	dat1,0
	call	wait
	call	wait
	btfss	porta,0	;y
	bcf	dat1,1
	btfsc	porta,0
	bsf	dat1,1
	call	wait
	call	wait
	btfss	porta,0	;x
	bcf	dat1,2
	btfsc	porta,0
	bsf	dat1,2
	call	wait
	call	wait
	btfss	porta,0	;r
	bcf	dat1,6
	btfsc	porta,0
	bsf	dat1,6
	call	wait
	call	wait
	btfss	porta,0	;b
	bcf	dat1,4
	btfsc	porta,0
	bsf	dat1,4
	call	wait
	call	wait
	btfss	porta,0	;c
	bcf	dat1,3
	btfsc	porta,0
	bsf	dat1,3
	call	wait
	call	wait
	btfss	porta,0	;a
	bcf	dat1,5
	btfsc	porta,0
	bsf	dat1,5
	call	wait
	call	wait
	btfss	porta,0	;s
	bcf	dat2,4
	btfsc	porta,0
	bsf	dat2,4
	call	wait
	call	wait
	btfss	porta,0	;up
	bcf	dat2,3
	btfsc	porta,0
	bsf	dat2,3
	call	wait
	call	wait
	btfss	porta,0	;down
	bcf	dat2,2
	btfsc	porta,0
	bsf	dat2,2
	call	wait
	call	wait
	btfss	porta,0	;left
	bcf	dat2,1
	btfsc	porta,0
	bsf	dat2,1
	call	wait
	call	wait
	btfss	porta,0	;right
	bcf	dat2,0
	btfsc	porta,0
	bsf	dat2,0
	call	wait
	call	wait
	btfss	porta,0	;l
	bcf	dat1,7
	btfsc	porta,0
	bsf	dat1,7
	return

led	bcf	dat3,0
	clrw
	iorwf	dat1,0
	iorwf	dat2,0
	movwf	temp
	btfsc	temp,0
	bsf	dat3,0
	btfsc	temp,1
	bsf	dat3,0
	btfsc	temp,2
	bsf	dat3,0
	btfsc	temp,3
	bsf	dat3,0
	btfsc	temp,4
	bsf	dat3,0
	btfsc	temp,5
	bsf	dat3,0
	btfsc	temp,6
	bsf	dat3,0
	btfsc	temp,7
	bsf	dat3,0
	btfsc	dat3,0
	bsf	porta,1
	btfss	dat3,0
	bcf	porta,1
	return

control	btfsc	dat2,3	;up
	call	forward
	btfsc	dat2,2	;down
	call	back
	btfsc	dat2,1	;left
	call	pre_left
	btfsc	dat2,0	;right
	call	pre_right
	btfsc	dat1,7	;l
	call	round_left
	btfsc	dat1,6	;r
	call	round_right
	btfsc	dat1,5	;a
	call	joint1
	btfsc	dat1,4	;b
	call	joint2
	btfsc	dat1,3	;c
	call	joint3
	btfsc	dat1,2	;x
	call	joint1_
	btfsc	dat1,1	;y
	call	joint2_
	btfsc	dat1,0	;z
	call	joint3_
	return

forward
	call	d_left
	call	d_right
	return
back
	call	d_left_
	call	d_right_
	return

pre_left
	btfss	dat2,2
	call	turn_left
	btfsc	dat2,2
	call	turn_left_	
	return
pre_right
	btfss	dat2,2
	call	turn_right
	btfsc	dat2,2
	call	turn_right_
	return

turn_left
	call	d_right
	return
turn_right
	call	d_left
	return
turn_left_
	call	d_left_
	return
turn_right_
	call	d_right_
	return
round_left
	call	d_left_
	call	d_right
	return
round_right
	call	d_left
	call	d_right_
	return

d_left
	bcf	porta,2
	bsf	porta,3
	return
d_right
	bcf	portb,0
	bsf	portb,1
	return
d_left_
	bsf	porta,2
	bcf	porta,3
	return
d_right_
	bsf	portb,0
	bcf	portb,1
	return
joint1
	bcf	portb,2
	bsf	portb,3
	return
joint1_
	bsf	portb,2
	bcf	portb,3
	return
joint2
	bcf	portb,4
	bsf	portb,5
	return
joint2_
	bsf	portb,4
	bcf	portb,5
	return
joint3
	bcf	portb,6
	bsf	portb,7
	return
joint3_
	bsf	portb,6
	bcf	portb,7
	return
	
wait	movlw	d'31'	;wait has 96 orders
	movwf	cnt	;number of order = 3+3*31
waitd	decfsz	cnt,1
	goto	waitd
	return

	end
	

Index



激安パソコンは何と3万円台からデュアルコアPCを販売中

「旬」の食材おためしセット(送料無料)
安心・快適な住まい探しは『家選びネット』