Debian Codegraph @

examples/ASM/add-2.S

raw
1 ; program add.S
2
3 DDRB = 0x37 ; memory mapped address of DDRB, use STS instruction
4 PORTB = 0x38
5
6 .section .text ; denotes code section
7 .global main
8 main:
9 LDI R16, 255 ; load R16 with 255
10 STS DDRB, R16 ; set all bits of port B as output
11
12 LDI R16, 1 ; load R16 with 11
13 LDI R17, 4 ; load R17 with 4
14 ADD R16, R17 ; R16 <- R16 + R17
15
16
17 STS PORTB, R16 ; result to port B, 4 LSBs should be on
18 .END