From The Compiler, 5 Years ago, written in x86 Assembler.
This paste is a reply to led.S from The Compiler
- view diff
Embed
  1. #include <avr/io.h>
  2.  
  3. #define temp r16
  4.  
  5. .global main
  6.  
  7. main:
  8.     ldi temp, (1 << 1)
  9.     out _SFR_IO_ADDR(DDRB), temp
  10.  
  11. loop:
  12.     ldi temp, (1 << 1)
  13.     out _SFR_IO_ADDR(PINB), temp ; Hardware toggle
  14.     rcall delay
  15.     rjmp loop
  16.  
  17. ; 100ms delay loop
  18. delay:
  19.     ldi  r18, 5
  20.     ldi  r19, 15
  21.     ldi  r20, 241
  22.  
  23. delay_inner:
  24.     dec  r20
  25.     brne delay_inner
  26.     dec  r19
  27.     brne delay_inner
  28.     dec  r18
  29.     brne delay_inner
  30.     nop
  31.     ret