I'm doing Advent of Code again this year, and like last year, I'm doing it in x86_64 assembly.
The rules for this challenge were:
So why am I doing this? It's quite fun to program in assembly - at least for small programs. Also, I'm writing a compiler, and since I'm compiling to x86_64 assembly, it's good to practice writing assembly by hand.
I'm using the nasm assembler to assemble, and the standard Linux ld linker.
Unfortunately, I've been unable to finish this year. Assembly programming with structs was as difficult as I expected, and I did not manage to finish Day 11. I think I'll have to learn how to use more advanced macro-assembler features. I also found that register allocation was difficult. If I attempt this again next year, I'd probably write the assembly code using temporaries as a first pass, before doing register allocation. This might involve use of the pre-processor for register allocation - for example:
#define accumulator rax
#define length rcx
#define start r15
#define temp rdx
#define tempbyte dl
mov accumulator, 0
mov temp, 0
.loop:
mov tempbyte, [start + length]
add accumulator, temp
loop .loop