.include "m32def.inc"
.def line = R16 ; glowny rejestr, reprezentujacy swiecace diody
.def temp1 = R17 ; dwa pomocnicze
.def temp2 = R18 ; rejestry
.cseg
; WYJSCIOWY PORT C
ldi temp1, 0xff ; ustawiamy port c
out DDRC, temp1 ; na wyjscie
; WEJSCIOWY PORT B 7
cbi DDRB, 7 ; ustawia port B7 na wejscie
sbi PORTB, 7 ; podciaganie rezystoru do VCC
; USTAWIENIE WSKAZNIKU STOSU NA KONIEC PAMIECI RAM
ldi temp1, low(RAMEND)
out SPL, temp1
ldi temp2, high(RAMEND)
out SPH, temp2
ldi line, 1 ; stan poczatkowy glownego rejestru
main:
;sbis PINB, 7 ; jezeli przycisk A jest wlaczany,
call miganie ; to wywoluje sie procedura, ktora "porusza" diode
rjmp main
; PROCEDURA, KTORA "PORUSZA" DIODE
miganie:
lsl line
cpi line, 0 ; jezeli rejestr jest rowny 0,
brne m ; to ustaw stan
ldi line, 1 ; poczatkowy linii (00000001)
m:
mov temp1, line
ori line, 1
neg line
out PORTC, line ; zapisanie do portu C wartosc linii
neg line
mov line, temp1
call wait ; zatrzymywanie
ret
; PROCEDURA ZATRZYMYWANIA ZBUDOWANA Z DWOCH CYKLI
wait:
push temp1 ; zachowanie wartosci rejestru temp1
push temp2 ; zachowanie wartosci rejestru temp2
ldi temp1, 0xff
_for1:
ldi temp2, 0xff
_for2:
dec temp2
brne _for2
dec temp1
brne _for1
pop temp2 ; przywracanie wartosci rejestru temp2
pop temp1 ; przywracanie wartosci rejestru temp1
ret
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}