blob: 85820c92f81ed01af7c6948773f2b2e505793f31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
[entry: main]
[enable: logical_registers]
// Sums 5 + 4 + 3 + 2 + 1 = 15 with a named countdown loop, returns it as the
// exit status. Shows three-operand arithmetic (r1 = r1 + r2 -> add x0, x0, x1).
const SYS_EXIT = 93
proc main
{
r1 = 0
r2 = 5
while .countdown r2 > 0
{
r1 = r1 + r2
r2 = r2 - 1
}
r9 = SYS_EXIT
syscall
}
|