1, 2, 3 de étape 1

This commit is contained in:
Mylloon 2023-12-31 15:32:46 +01:00
parent d73a8e5c4b
commit 4debd0c1e5
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,3 @@
globals ()
exit;
end

View file

@ -0,0 +1,26 @@
globals (x, y, z, k)
x <- copy 6;
%rdi <- copy x;
print_int();
%rdi <- copy "\n";
print_string();
y <- copy 7;
%rdi <- copy y;
print_int();
%rdi <- copy "\n";
print_string();
z <- mul y, x;
%rdi <- copy z;
print_int();
%rdi <- copy "\n";
print_string();
k <- sub z, x;
%rdi <- copy k;
print_int();
%rdi <- copy "\n";
print_string();
end

View file

@ -0,0 +1,16 @@
def fact ()
%rax <- copy 1;
boucle: jumpif lte %rdi, 1 -> fin, suite;
suite: %rax <- mul %rax, %rdi;
%rdi <- sub %rdi, 1;
jump boucle;
fin: ret;
end
globals (res)
%rdi <- copy 5;
fact();
res <- copy %rax;
%rdi <- copy res;
print_int();
end

View file

@ -0,0 +1,9 @@
FLAP = ../../_build/default/src/flap.exe
TARGET = retrolix
main:
@for f in $(wildcard *.$(TARGET)); do \
printf "%s:\n" $$f; \
./$(FLAP) -s $(TARGET) -d true -r true $$f; \
printf "\n"; \
done