adventofcode2023/06/main_part1.s
2023-12-06 00:10:38 -06:00

54 lines
685 B
ArmAsm

%define BUFF_LIM 32768
global _start
[bits 32]
[section .text]
%include "utils.s"
_start:
xor ecx, ecx ; race
; check race
check_race:
push ecx
mov esi, [timelist+ecx*4]
mov edi, [dists+ecx*4]
xor ebp, ebp ; poss
mov ecx, 1 ; test ms
check_strat:
mov eax, esi
sub eax, ecx ; remaining time
mul ecx
cmp eax, edi
jle .cont
inc ebp
.cont:
inc ecx
cmp ecx, esi
jl check_strat
mov eax, [final_value]
mul ebp
mov [final_value], eax
are_we_done:
pop ecx
inc ecx
cmp ecx, [race_count]
jl check_race
game_over:
mov eax, [final_value]
call print_dec
jmp exit
[section .data]
final_value: dd 1
race_count: dd 4
timelist: dd 53, 83, 72, 88
dists: dd 333, 1635, 1289, 1532
[section .bss]