From c7466e7191f7f29c4b94bc07a72a66f7dc57109f Mon Sep 17 00:00:00 2001 From: hachem Date: Sat, 6 Dec 2025 03:42:18 +0100 Subject: [setup]: prepare day 2 --- Makefile | 5 +++-- input/day2.txt | 1 + input/test-day2.txt | 1 + src/Day2.asm | 24 ++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 input/day2.txt create mode 100644 input/test-day2.txt create mode 100644 src/Day2.asm diff --git a/Makefile b/Makefile index 4dbaa88..8f661ed 100644 --- a/Makefile +++ b/Makefile @@ -7,12 +7,12 @@ BUILD_DIR := build NASMFLAGS ?= -f elf32 -g -F dwarf LDFLAGS ?= -m elf_i386 -DAYS := Day1 Day2 Day3 Day4 +DAYS := Day1 Day2 ASM_SRCS := $(addprefix $(SRC_DIR)/,$(addsuffix .asm,$(DAYS))) OBJ_FILES := $(addprefix $(BUILD_DIR)/,$(addsuffix .o,$(DAYS))) BINARIES := $(addprefix $(BUILD_DIR)/,$(DAYS)) -.PHONY: all clean day1 list run-day% +.PHONY: all clean day1 day2 list run-day% all: $(BINARIES) @@ -26,6 +26,7 @@ $(BUILD_DIR)/Day%: $(BUILD_DIR)/Day%.o $(LD) $(LDFLAGS) -o $@ $< day1: $(BUILD_DIR)/Day1 +day2: $(BUILD_DIR)/Day2 run-day%: $(BUILD_DIR)/Day% ./$(BUILD_DIR)/Day$* diff --git a/input/day2.txt b/input/day2.txt new file mode 100644 index 0000000..7b308fc --- /dev/null +++ b/input/day2.txt @@ -0,0 +1 @@ +655-1102,2949-4331,885300-1098691,1867-2844,20-43,4382100-4484893,781681037-781860439,647601-734894,2-16,180-238,195135887-195258082,47-64,4392-6414,6470-10044,345-600,5353503564-5353567532,124142-198665,1151882036-1151931750,6666551471-6666743820,207368-302426,5457772-5654349,72969293-73018196,71-109,46428150-46507525,15955-26536,65620-107801,1255-1813,427058-455196,333968-391876,482446-514820,45504-61820,36235767-36468253,23249929-23312800,5210718-5346163,648632326-648673051,116-173,752508-837824 diff --git a/input/test-day2.txt b/input/test-day2.txt new file mode 100644 index 0000000..a3f22ef --- /dev/null +++ b/input/test-day2.txt @@ -0,0 +1 @@ +11-22,95-115,998-1012,1188511880-1188511890,222220-222224,1698522-1698528,446443-446449,38593856-38593862,565653-565659,824824821-824824827,2121212118-2121212124 diff --git a/src/Day2.asm b/src/Day2.asm new file mode 100644 index 0000000..d524d7c --- /dev/null +++ b/src/Day2.asm @@ -0,0 +1,24 @@ +; Advent of Code 2025 - Day 2 + +global _start + +%define SYS_EXIT 1 +%define SYS_WRITE 4 + +%define STDOUT 1 + +section .data + message db "Hello Day 2!", 0xA + length equ $-message + +section .text +_start: + mov eax, SYS_WRITE + mov ebx, STDOUT + mov ecx, message + mov edx, length + int 0x80 + + mov eax, SYS_EXIT + xor ebx, ebx + int 0x80 -- cgit v1.3