;**************************************** ;* discolight * ;**************************************** .include "m8def.inc" ;include the definitions ;**************************************** ;Registers: ;R30 Lower byte Z pointer, used for ;set the constants describing each step .equ step0 = 0x08 .equ step1 = 0x0C .equ step2 = 0x04 .equ step3 = 0x06 .equ step4 = 0x02 .equ step5 = 0x03 .equ step6 = 0x01 .equ step7 = 0x09 ;**************************************** .org 0x0000 ;rjmp reset ;**************************************** ;.org 0x0014 ;let code start here ;**************************************** ;just some basic things on startup ;reset: ldi r29, 0xCC ;init magic clock byte out OSCCAL, r29 ldi r17, 0x0F ;set i/o direction for port B, 0-3 out, 4-7 in out DDRB, r17 ;apply ldi zl, seq_table*2 ;**** clr r17 loop: lpm out PORTB, r0 inc zl cpi zl, 2*(seq_table+8) brne loop ldi zl, 2*(seq_table) rjmp loop .org 0x0020 seq_table: .db step0, step1, step2, step3, step4, step5, step6, step7