Debian Codegraph @

examples/ASM/carry.S

raw
1
2 #include <avr/io.h>
3 .section .text ; denotes code section
4 .global main
5 main:
6 LDI R16, 255
7 STS DDRB, R16 ; All bits of port B as output
8 STS DDRD, R16 ; All bits of port D as output
9
10 LDI R16, 255 ; load R16 and R17 with some values
11 LDI R17, 0
12 ADD R16, R17 ; R16 <- R16 + r17
13
14 STS PORTB, R16 ; Sum to port B
15
16 LDS R16, SREG ; Load the Status register
17 STS PORTD, R16 ; display it on port D
18 .END