From The Compiler, 5 Years ago, written in ARM Assembler.
Embed
  1. ╰─╼ cat led.S                                                                                          ╾─[1]──┄
  2. #include <avr/io.h>
  3.  
  4. #define temp r16
  5.  
  6. .global main
  7.  
  8. main:
  9.     ldi temp, (1 << 1)
  10.     out _SFR_IO_ADDR(DDRB), temp
  11.  
  12. loop:
  13.     ldi temp, (1 << 1)
  14.     out _SFR_IO_ADDR(PINB), temp ; Hardware toggle
  15.     rcall delay
  16.     rjmp loop
  17.  
  18. ; 100ms delay loop
  19. delay:
  20.     ldi  r18, 5
  21.     ldi  r19, 15
  22.     ldi  r20, 241
  23.  
  24. delay_inner:
  25.     dec  r20
  26.     brne delay_inner
  27.     dec  r19
  28.     brne delay_inner
  29.     dec  r18
  30.     brne delay_inner
  31.     nop
  32.     ret

Replies to led.S rss

Title Name Language When
Re: led.S The Compiler asm 5 Years ago.