Program to make LEDs flash in a particular pattern
; Program to make lights flash in a particular pattern prog: equ $0800 stack: equ $0A00 PORTA: equ $0000 DDRA: equ $0002 CODE: section .text org prog lds #stack ; initialize stack pointer ldaa #$ff ; Make PORTA output staa DDRA ; 0xFF -> DDRA l1: ldx #table ; Start pointer at table l2: ldaa 1,x+ ; Get value; point to next staa PORTA ; Update LEDs jsr delay ; Wait a bit cpx #table_end ; More to do? bls l2 ; Yes, keep going through ; table bra l1 ; At end; reset pointer ; Subroutine to wait for 100 ms delay: psha pshx ldaa #250 loop2: ldx #800 loop1: dex bne loop1 deca bne loop2 pulx pula rts DATA: section .data org data table: dc.b $00 dc.b $80 dc.b $C0 dc.b $E0 dc.b $F0 dc.b $F8 dc.b $FC dc.b $FE table_end: dc.b $FF