From 1907e4f2b231ed577d8f62c63ace9b366ef2cdc1 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 23 Mar 2026 13:41:50 +0100 Subject: [PATCH 1/2] build(ASM/make): init the assembly makefile --- ASM/Makefile | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 ASM/Makefile diff --git a/ASM/Makefile b/ASM/Makefile new file mode 100644 index 0000000..8d690d3 --- /dev/null +++ b/ASM/Makefile @@ -0,0 +1,156 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: rparodi +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2023/11/12 11:05:05 by rparodi #+# #+# # +# Updated: 2026/03/17 15:42:45 by rparodi ### ########.fr # +# # +# **************************************************************************** # + +# Variables + +# Name +NAME = DrQuine_ASM + +# Commands +AS ?= nasm +RM = rm -rf + +# Flags +ASFLAGS = -f elf64 + +# Directories +OBJDIRNAME = ./build + +# Programs +COLLEEN = Colleen/Colleen +GRACE = Grace/Grace +SULLY = Sully/Sully + +# Sources +SRC_COLLEEN = Colleen/Colleen.s +SRC_GRACE = Grace/Grace.s +SRC_SULLY = Sully/Sully.s + +# Objects +OBJ_COLLEEN = $(addprefix $(OBJDIRNAME)/,$(SRC_COLLEEN:.s=.o)) +OBJ_GRACE = $(addprefix $(OBJDIRNAME)/,$(SRC_GRACE:.s=.o)) +OBJ_SULLY = $(addprefix $(OBJDIRNAME)/,$(SRC_SULLY:.s=.o)) + +# Colors +GREEN = \033[32m +GREY = \033[0;90m +RED = \033[0;31m +GOLD = \033[38;5;220m +END = \033[0m + +# Rules + +# All (make all) +all: header $(NAME) footer + +# Exercices +ex0: $(COLLEEN) +ex1: $(GRACE) +ex2: $(SULLY) + +# Dependences for all +$(NAME): $(COLLEEN) $(GRACE) $(SULLY) + +# Compile Colleen +$(COLLEEN): $(OBJ_COLLEEN) + @$(AS) $(ASFLAGS) -o $@ $^ + +# Compile Grace +$(GRACE): $(OBJ_GRACE) + @$(AS) $(ASFLAGS) -o $@ $^ + +# Compile Sully +$(SULLY): $(OBJ_SULLY) + @$(AS) $(ASFLAGS) -o $@ $^ + +# Clean (make clean) +clean: + @printf '$(GREY) Removing $(END)$(RED)Objects$(END)\n' + @printf '$(GREY) Removing $(END)$(RED)Objects Folder$(END)\n' + @find . -name "Sully_*" -delete + @$(RM) $(OBJDIRNAME) + +# Clean (make fclean) +fclean: clean + @printf '$(GREY) Removing $(END)$(RED)Program$(END)\n' + @$(RM) $(COLLEEN) $(GRACE) $(SULLY) + @echo "" + +# Restart (make re) +re: header fclean all + +# Creating the objects +$(OBJDIRNAME)/%.o: %.s + @mkdir -p $(dir $@) + @printf '$(GREY) Compiling $(END)$(GREEN)$<$(END)\n' + @$(AS) $(ASFLAGS) -o $@ $< + +test: test_colleen test_grace test_sully + +test_colleen: $(COLLEEN) + @clear + @rm -rf /tmp/test_colleen.c + @$(COLLEEN) > /tmp/test_colleen.c + @printf '$(GREY)Output of the $(GOLD)Colleen$(END)\n' + @bat -plc /tmp/test_colleen.c + @printf "\n$(GREY)Here's the diff between $(GOLD)$(SRC_COLLEEN) $(GREY)and $(GOLD)/tmp/test_colleen.c$(END)\n" + @diff $(SRC_COLLEEN) /tmp/test_colleen.c | bat -ldiff + +test_grace: $(GRACE) + @$(GRACE) + @printf '\n\n\n$(GREY)Output of the $(GOLD)Grace$(END)\n' + @bat -plc ./Grace_kid.c + @printf "\n$(GREY)Here's the diff between $(GOLD)$(SRC_GRACE) $(GREY)and $(GOLD)Grace_kid.c $(END)\n" + @diff $(SRC_GRACE) ./Grace_kid.c | bat -ldiff + +test_sully: $(SULLY) + @$(SULLY) > /tmp/test_sully.c + @printf '$(GREY)Output of the $(GOLD)Sully$(END)\n' + @bat -plc /tmp/test_sully.c + @printf "\n$(GREY)Here's the diff between $(GOLD)$(SRC_SULLY) $(GREY)and $(GOLD)/tmp/test_sully.c$(END)\n" + @diff $(SRC_SULLY) /tmp/test_sully | bat -ldiff + +# Header +header: + @printf '\n\n' + @printf '$(GOLD) ******* ****** ******* $(END)\n' + @printf '$(GOLD) ****** *** ******* $(END)\n' + @printf '$(GOLD) ******* * ******* $(END)\n' + @printf '$(GOLD) ****** ******* $(END)\n' + @printf '$(GOLD) ******* ******* $(END)\n' + @printf '$(GOLD) ******************* ******* * $(END)\n' + @printf '$(GOLD) ******************* ******* *** $(END)\n' + @printf '$(GOLD) ****** ******* ****** $(END)\n' + @printf '$(GOLD) ****** $(END)\n' + @printf '$(GOLD) ****** $(END)\n' + @printf '$(GREY) Made by rparodi$(END)\n\n' + +# Footer +footer: + @printf "\n" + @printf "$(GOLD) ,_ _,$(END)\n" + @printf "$(GOLD) | \\___//|$(END)\n" + @printf "$(GOLD) |=6 6=|$(END)\n" + @printf "$(GOLD) \\=._Y_.=/$(END)\n" + @printf "$(GOLD) ) \` ( ,$(END)\n" + @printf "$(GOLD) / \\ (('$(END)\n" + @printf "$(GOLD) | | ))$(END)\n" + @printf "$(GOLD) /| | | |\\_//$(END)\n" + @printf "$(GOLD) \\| |._.| |/-\`$(END)\n" + @printf "$(GOLD) '\"' '\"'$(END)\n" + @printf ' $(GREY)The compilation is$(END) $(GOLD)finish$(END)\n $(GREY)Have a good $(END)$(GOLD)correction !$(END)\n' + +debug: ASFLAGS += -g -F dwarf +debug: re + +# Phony targets +.PHONY: all clean fclean re header footer debug From 42586d45d5da94c35b72d60b1f9e2ac6635878ca Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 23 Mar 2026 13:42:28 +0100 Subject: [PATCH 2/2] build(ASM/lsp): adding the lsp's asm configuration --- ASM/.asml-lsp.toml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ASM/.asml-lsp.toml diff --git a/ASM/.asml-lsp.toml b/ASM/.asml-lsp.toml new file mode 100644 index 0000000..c908466 --- /dev/null +++ b/ASM/.asml-lsp.toml @@ -0,0 +1,18 @@ +[[project]] +path = "" +version = "0.10.1" +assembler = "nasm" +instruction_set = "x86/x86-64" + +[project.opts] +compiler = "nasm" +compile_flags_txt = [ + "-f", + "elf64", + "-F", + "dwarf", + "-g", +] +diagnostics = true +default_diagnostics = false +