aboutsummaryrefslogtreecommitdiff
path: root/examples/logical.hdass
blob: 5e82b42741c8776865899657c45edfe9215b00a2 (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]

// With the logical_registers extension, r1..r14 name the general-purpose
// registers (r1 = rax, r2 = rbx, ...) instead of the architecture names.
// Computes (4 + 3) * 3 = 21 and returns it as the exit status.
const SYS_EXIT = 60

proc main
{
    r1 = 4        // rax
    r2 = 3        // rbx
    r1 += r2      // 7
    r1 *= r2      // 21

    r6 = r1       // rdi = 21 (the exit status)
    r1 = SYS_EXIT
    syscall
}