summaryrefslogtreecommitdiff
path: root/2020/05/seat_id.asm
diff options
context:
space:
mode:
Diffstat (limited to '2020/05/seat_id.asm')
-rw-r--r--2020/05/seat_id.asm25
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