summaryrefslogtreecommitdiff
path: root/5/seat_id.asm
blob: 6b927ed2a3ef04b80c1366c5b2801994c1fcc46e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
global seat_id

section .data

section .text

seat_id:
    xor         eax, eax            ; set up return value
    cmp         BYTE [rdi], 'B'
    sete        al
    xor         ecx, ecx
%assign i 1
%rep    6
    shl         eax, 1
    cmp         BYTE [rdi + i], 'B'
    sete        cl
    or          eax, ecx
%assign i i+1
%endrep
%rep    3
    shl         eax, 1
    cmp         BYTE [rdi + i], 'R'
    sete        cl
    or          eax, ecx
%assign i i+1
%endrep
    ret