From baf4910870a6e8999802b9a4a22eabd4142a34e3 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Thu, 1 Dec 2022 22:30:22 +0100 Subject: Move all Advent of Codes into one repo --- 2020/05/seat_id.asm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 2020/05/seat_id.asm (limited to '2020/05/seat_id.asm') 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 -- cgit v1.2.3