summaryrefslogtreecommitdiff
path: root/5/seat_id.asm
blob: a372a9a7ba10e63f17d49718a8d5b3881cdb2cae (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
global seat_id

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