diff options
| author | Bond_009 <bond.009@outlook.com> | 2022-12-01 22:30:22 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2022-12-01 22:30:22 +0100 |
| commit | baf4910870a6e8999802b9a4a22eabd4142a34e3 (patch) | |
| tree | 2d11443dc21e53bd0d99d015cf789937d6d95862 /2020/05/seat_id.asm | |
| parent | 49d0c908f24b2c193c9deed1716fe36061ba26a1 (diff) | |
Move all Advent of Codes into one repo
Diffstat (limited to '2020/05/seat_id.asm')
| -rw-r--r-- | 2020/05/seat_id.asm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/2020/05/seat_id.asm b/2020/05/seat_id.asm new file mode 100644 index 0000000..a372a9a --- /dev/null +++ b/2020/05/seat_id.asm @@ -0,0 +1,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 |
