Debian Codegraph @

examples/ASM/global-init.S

raw
1
2 ddrb = 0x17
3 portb = 0x18
4 ddrd = 0x11
5 portd = 0x12
6
7
8 .section .text ; denotes code section
9 .global __do_clear_bss ; and setup stack pointer
10
11 .global main
12 main:
13 LDI R16, 0xff ; load r16 with 255
14 OUT ddrb, R16 ; make all bits of port B as output
15 OUT ddrd, R16 ; make all bits of port D as output
16
17 LDI R16, 1
18 PUSH R16 ; push R16 content to the stack
19 INC R16
20 PUSH R16 ; push the incremented value
21 POP R17 ; should pop the last pushed value
22 POP R18 ; shoul pop the previous
23
24 OUT portb, R17 ; display on port B
25 OUT portd, R18 ; display on port D
26 .end