.include "tn15def.inc"

.equ cyan = PB0		

.equ red = PB1

.equ black = PB2

.equ yellow = PB3

.def count1 = R17 		; temporary storage

.def count2 = R18 		; temporary storage

.equ c = 20

	

.cseg

.org 0

rjmp main



step1:

	sbi PORTB, red

	cbi PORTB, cyan

	sbi PORTB, yellow

	cbi PORTB, black



	ldi count1, c

_step1_l0:

	ldi count2, c

_step1_l1:	

	dec count2

	brne _step1_l1

	dec count1

	brne _step1_l0



	ret



	

step2:

	sbi PORTB, red

	cbi PORTB, cyan

	cbi PORTB, yellow

	sbi PORTB, black



	ldi count1, c

_step2_l0:

	ldi count2, c

_step2_l1:	

	dec count2

	brne _step2_l1

	dec count1

	brne _step2_l0



	ret

	



step3:

	cbi PORTB, red

	sbi PORTB, cyan

	cbi PORTB, yellow

	sbi PORTB, black



	ldi count1, c

_step3_l0:

	ldi count2, c

_step3_l1:	

	dec count2

	brne _step3_l1

	dec count1

	brne _step3_l0



	ret



	

step4:

	cbi PORTB, red

	sbi PORTB, cyan

	sbi PORTB, yellow

	cbi PORTB, black



	ldi count1, c

_step4_l0:

	ldi count2, c

_step4_l1:	

	dec count2

	brne _step4_l1

	dec count1

	brne _step4_l0



	ret



	

main:

	sbi DDRB, PB0		; make all the pins outputs

	sbi DDRB, PB1

	sbi DDRB, PB2

	sbi DDRB, PB3

_main_loop:

	rcall step1

	rcall step2

	rcall step3

	rcall step4

	rjmp _main_loop

