diff options
author | June McEnroe <june@causal.agency> | 2016-12-03 22:00:23 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2016-12-03 22:00:23 -0500 |
commit | dfbd0cb2428b792aaf2d65fe51c72cc8697bcb2f (patch) | |
tree | 68194a531112fea257e4d191a87d2fdc7d90ebed /day01.asm | |
parent | Use lower case hex digits (diff) | |
download | aoc-dfbd0cb2428b792aaf2d65fe51c72cc8697bcb2f.tar.gz aoc-dfbd0cb2428b792aaf2d65fe51c72cc8697bcb2f.zip |
Remove assembly code
I can't do it.
Diffstat (limited to '')
-rw-r--r-- | day01.asm | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/day01.asm b/day01.asm deleted file mode 100644 index 083f971..0000000 --- a/day01.asm +++ /dev/null @@ -1,76 +0,0 @@ -%include "sys.asm" -%include "lib.asm" - -%define rPosX r8 -%define rPosY r9 -%define rDirX r10 -%define rDirY r11 - -global _start -_start: - sub rsp, 4096 - syscall SYS_READ, FD_STDIN, rsp, 4096 - mov rdi, rax ;; Length. - xor rcx, rcx ;; Index. - - xor rPosX, rPosX - xor rPosY, rPosY - xor rDirX, rDirX - mov rDirY, -1 ;; North. - - .loopTurn: - cmp byte [rsp + rcx], 'L' - jne .right - .left: ;; L(dx, dy) = (dy, -dx) - neg rDirX - jmp .swap - .right: ;; R(dx, dy) = (-dy, dx) - neg rDirY - .swap: - xchg rDirX, rDirY - - xor rax, rax - .loopDigit: - inc rcx - movzx rdx, byte [rsp + rcx] - cmp dl, '0' - jb .breakDigit - - ;; rax = rax * 10 + rdx - '0' - shl rax, 1 - lea rax, [rax + rax * 4 - '0'] - add rax, rdx - jmp .loopDigit - .breakDigit: - add rcx, 2 ;; Discard comma and space. - - mov rdx, rax - imul rdx, rDirX - add rPosX, rdx - - mov rdx, rax - imul rdx, rDirY - add rPosY, rdx - - cmp rcx, rdi - jb .loopTurn - - ;; abs(x) = (x ^ (x >> 63)) - (x >> 63) - mov rax, rPosX - sar rax, 63 - xor rPosX, rax - sub rPosX, rax - - mov rax, rPosY - sar rax, 63 - xor rPosY, rax - sub rPosY, rax - - push `\n` - lea rdi, [rPosX + rPosY] - call hex32 - push rax - syscall SYS_WRITE, FD_STDOUT, rsp, 9 - - xor rax, rax -syscall SYS_EXIT, rax |