atmega328p-blinking-led-asm/main.s

39 lines
541 B
ArmAsm
Raw Normal View History

2024-12-11 00:14:46 +00:00
.equ DDRB, 0x04
.equ PORTB, 0x05
.global main
main:
ldi r16, 1
out DDRB, r16
ldi r16, 0
out PORTB, r16
loop_start:
com r16
out PORTB, r16
init_sleep:
ldi r18, 0xFF
ldi r19, 0xFF
ldi r20, 0xFF
sleep_outer:
cpi r18, 0x00
breq loop_start
dec r18
rjmp sleep_inner1
sleep_inner0:
cpi r19, 0
breq sleep_inner0_reset
dec r19
rjmp sleep_inner1
sleep_inner0_reset:
ldi r19, 0xFF
rjmp sleep_outer
sleep_inner1:
cpi r20, 0
breq sleep_inner1_reset
dec r20
rjmp sleep_inner1
sleep_inner1_reset:
ldi r20, 0x1F
rjmp sleep_inner0